/* ===== ROOT VARIABLES ===== */
:root {
  --primary: #1a5276;
  --primary-light: #2e86c1;
  --primary-pale: #eaf2fb;
  --accent: #148f77;
  --accent-light: #e8f8f5;
  --amber: #d68910;
  --amber-light: #fef9e7;
  --rose: #c0392b;
  --rose-light: #fdedec;
  --white: #ffffff;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --sidebar-w: 72px;
  --sidebar-w-open: 230px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; overflow-y: auto; }
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #eaf2fb 0%, #f0f9f6 50%, #fef9e7 100%);
}
.login-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  animation: blobFloat 8s ease-in-out infinite;
}
.blob1 { width: 400px; height: 400px; background: var(--primary); top: -100px; left: -100px; }
.blob2 { width: 300px; height: 300px; background: var(--accent); bottom: -80px; right: -60px; animation-delay: -3s; }
.blob3 { width: 250px; height: 250px; background: var(--amber); top: 50%; right: 20%; animation-delay: -6s; }
@keyframes blobFloat { 0%,100% { transform: translate(0,0) scale(1); } 33% { transform: translate(20px,-20px) scale(1.05); } 66% { transform: translate(-10px,15px) scale(0.96); } }

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
  animation: fadeUp 0.6s ease;
}
@keyframes fadeUp { from { opacity:0; transform: translateY(30px); } to { opacity:1; transform: translateY(0); } }

.login-logo { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.5rem; }
.logo-icon { width: 52px; height: 52px; background: linear-gradient(135deg, var(--primary), var(--primary-light)); border-radius: 14px; display: flex; align-items: center; justify-content: center; color: white; flex-shrink: 0; overflow: hidden; }
.logo-icon img { width: 36px; height: 36px; object-fit: contain; }
.logo-icon svg { width: 32px; height: 32px; }
.logo-text h1 { font-family: 'Playfair Display', serif; font-size: 1.4rem; color: var(--primary); line-height: 1.2; }
.logo-text span { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.05em; }
.login-subtitle { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 2rem; margin-top: 0.5rem; padding: 0.4rem 0.8rem; background: var(--primary-pale); border-radius: 6px; display: inline-block; }
.login-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--text); letter-spacing: 0.02em; }
.input-wrap { position: relative; }
.input-wrap .input-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 1rem; pointer-events: none; }
.input-wrap input { width: 100%; padding: 0.75rem 1rem 0.75rem 2.5rem; border: 2px solid var(--border); border-radius: var(--radius-sm); outline: none; transition: border-color var(--transition), box-shadow var(--transition); background: #fafbfc; }
.input-wrap input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(46,134,193,0.12); background: white; }
.toggle-pass { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); cursor: pointer; font-size: 1rem; }
.login-error { font-size: 0.82rem; color: var(--rose); background: var(--rose-light); padding: 0.5rem 0.75rem; border-radius: 6px; display: none; }
.btn-login { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.9rem; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; border: none; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: all var(--transition); letter-spacing: 0.02em; }
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(26,82,118,0.3); }
.btn-login svg { width: 18px; height: 18px; }
.login-note { font-size: 0.75rem; color: var(--text-light); text-align: center; margin-top: 1.5rem; }

/* ===== APP LAYOUT ===== */
.app { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition);
  overflow: hidden;
  overflow-y: auto;
  scrollbar-width: none;
}
.sidebar:hover { width: var(--sidebar-w-open); }

.sidebar-header { display: flex; align-items: center; gap: 0.85rem; padding: 1.25rem 1rem; border-bottom: 1px solid rgba(255,255,255,0.1); overflow: hidden; white-space: nowrap; min-height: 72px; }
.sidebar-logo { width: 36px; height: 36px; flex-shrink: 0; color: rgba(255,255,255,0.9); display:flex; align-items:center; justify-content:center; }
.sidebar-logo svg { width: 36px; height: 36px; }
.sidebar-logo img { width: 36px; height: 36px; object-fit: contain; }
.sidebar-brand { opacity: 0; transition: opacity var(--transition); }
.sidebar:hover .sidebar-brand { opacity: 1; }
.brand-name { display: block; font-family: 'Playfair Display', serif; font-size: 1rem; color: white; font-weight: 700; line-height: 1.2; }
.brand-sub { display: block; font-size: 0.72rem; color: rgba(255,255,255,0.6); font-weight: 400; }

.sidebar-nav { flex: 1; padding: 1rem 0; display: flex; flex-direction: column; gap: 0.25rem; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all var(--transition);
  border-radius: 0;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}
.nav-item::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: white; transform: scaleY(0); transition: transform var(--transition); border-radius: 0 2px 2px 0; }
.nav-item:hover { color: white; background: rgba(255,255,255,0.1); }
.nav-item.active { color: white; background: rgba(255,255,255,0.15); }
.nav-item.active::before { transform: scaleY(1); }
.nav-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: transform var(--transition); }
.nav-item:hover .nav-icon { transform: scale(1.15); }
.nav-icon svg { width: 20px; height: 20px; }
.nav-label { font-size: 0.88rem; font-weight: 500; opacity: 0; transition: opacity var(--transition); }
.sidebar:hover .nav-label { opacity: 1; }

.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; gap: 0.75rem; overflow: hidden; white-space: nowrap; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.user-details { opacity: 0; transition: opacity var(--transition); flex: 1; min-width: 0; }
.sidebar:hover .user-details { opacity: 1; }
.user-name { display: block; font-size: 0.82rem; color: white; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.user-role { display: block; font-size: 0.72rem; color: rgba(255,255,255,0.55); }
.btn-logout { background: rgba(255,255,255,0.1); border: none; color: rgba(255,255,255,0.7); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all var(--transition); opacity: 0; }
.sidebar:hover .btn-logout { opacity: 1; }
.btn-logout:hover { background: rgba(255,255,255,0.2); color: white; }
.btn-logout svg { width: 16px; height: 16px; }

/* ===== MAIN CONTENT ===== */
.main-content { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; padding: 2rem; transition: margin-left var(--transition); }

/* ===== TAB CONTENT ===== */
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; gap: 1rem; flex-wrap: wrap; }
.page-header h2 { font-family: 'Playfair Display', serif; font-size: 1.7rem; color: var(--primary); font-weight: 700; }
.page-header p { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.2rem; }
.header-actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.header-filters { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.filter-group { display: flex; flex-direction: column; gap: 0.3rem; }
.filter-group label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.filter-group input[type="date"],
.filter-group select { padding: 0.5rem 0.75rem; border: 2px solid var(--border); border-radius: var(--radius-sm); outline: none; font-size: 0.85rem; background: white; cursor: pointer; transition: border-color var(--transition); }
.filter-group input[type="date"]:focus,
.filter-group select:focus { border-color: var(--primary-light); }
.btn-clear { padding: 0.5rem 1rem; background: var(--bg); border: 2px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); font-size: 0.82rem; font-weight: 500; cursor: pointer; transition: all var(--transition); margin-top: 1.3rem; }
.btn-clear:hover { border-color: var(--primary-light); color: var(--primary); }

/* ===== STAT CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.stat-card { background: white; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 1rem; transition: all var(--transition); border: 1px solid var(--border); }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 24px; height: 24px; }
.stat-card.primary .stat-icon { background: var(--primary-pale); color: var(--primary); }
.stat-card.green .stat-icon { background: var(--accent-light); color: var(--accent); }
.stat-card.amber .stat-icon { background: var(--amber-light); color: var(--amber); }
.stat-card.rose .stat-icon { background: var(--rose-light); color: var(--rose); }
.stat-info { flex: 1; min-width: 0; }
.stat-value { display: block; font-size: 1.8rem; font-weight: 700; color: var(--text); line-height: 1; margin-bottom: 0.25rem; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

/* ===== CHARTS ===== */
.charts-row { display: grid; grid-template-columns: 1.2fr 1fr; gap: 1.5rem; margin-bottom: 2rem; }
.chart-card { background: white; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.chart-card.large { }
.chart-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.chart-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.chart-badge { font-size: 0.72rem; background: var(--primary-pale); color: var(--primary); padding: 0.2rem 0.6rem; border-radius: 20px; font-weight: 600; }
.chart-wrap { position: relative; height: 260px; }
.chart-wrap canvas { max-height: 260px; }

/* ===== TABLES ===== */
.doctor-table-card, .table-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 0.75rem; }
.card-header h3 { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.badge { background: var(--primary-pale); color: var(--primary); font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.75rem; border-radius: 20px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { background: #f8fafd; padding: 0.85rem 1rem; text-align: left; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 2px solid var(--border); white-space: nowrap; }
.data-table td { padding: 0.9rem 1rem; font-size: 0.88rem; color: var(--text); border-bottom: 1px solid #f1f5f9; }
.data-table tbody tr:hover { background: #fafbff; }
.data-table tbody tr:last-child td { border-bottom: none; }
.loading-row { text-align: center; color: var(--text-muted); padding: 3rem 1rem !important; font-style: italic; }

/* Progress bar in table */
.progress-wrap { display: flex; align-items: center; gap: 0.75rem; }
.progress-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; min-width: 80px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary-light), var(--accent)); border-radius: 4px; transition: width 0.8s ease; }
.progress-pct { font-size: 0.8rem; font-weight: 600; color: var(--primary); min-width: 36px; }

/* ===== BUTTONS ===== */
.btn-primary { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.2rem; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: white; border: none; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(26,82,118,0.3); }
.btn-primary svg { width: 16px; height: 16px; }
.btn-secondary { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.6rem 1.2rem; background: white; color: var(--primary); border: 2px solid var(--primary-light); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem; cursor: pointer; transition: all var(--transition); white-space: nowrap; }
.btn-secondary:hover { background: var(--primary-pale); }
.btn-secondary svg { width: 16px; height: 16px; }
.btn-danger { padding: 0.35rem 0.7rem; background: var(--rose-light); color: var(--rose); border: 1px solid #f5c6c2; border-radius: 6px; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all var(--transition); }
.btn-danger:hover { background: var(--rose); color: white; }

/* ===== DOCTORS GRID ===== */
.doctors-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }
.doctor-card { background: white; border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border); transition: all var(--transition); display: flex; flex-direction: column; gap: 0.75rem; }
.doctor-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.doctor-avatar { width: 52px; height: 52px; background: linear-gradient(135deg, var(--primary-pale), #d6eaf8); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700; color: var(--primary); }
.doctor-card-name { font-size: 1rem; font-weight: 600; color: var(--text); }
.doctor-card-phone { font-size: 0.82rem; color: var(--text-muted); }
.doctor-card-count { font-size: 0.82rem; background: var(--primary-pale); color: var(--primary); padding: 0.25rem 0.6rem; border-radius: 20px; font-weight: 600; display: inline-block; }
.doctor-card-actions { display: flex; gap: 0.5rem; margin-top: 0.25rem; }

/* ===== SEARCH INPUT ===== */
.search-input { padding: 0.6rem 1rem; border: 2px solid var(--border); border-radius: var(--radius-sm); outline: none; font-size: 0.88rem; background: white; transition: border-color var(--transition); width: 220px; }
.search-input:focus { border-color: var(--primary-light); }

/* ===== SEARCHABLE DOCTOR DROPDOWN ===== */
.searchable-select-wrap { position: relative; }
.searchable-select-wrap input { width: 100%; padding: 0.6rem 0.85rem; border: 2px solid var(--border); border-radius: var(--radius-sm); outline: none; font-size: 0.88rem; transition: border-color var(--transition); }
.searchable-select-wrap input:focus { border-color: var(--primary-light); }
.doctor-dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: white; border: 2px solid var(--primary-light); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); max-height: 200px; overflow-y: auto; z-index: 200; display: none; }
.doctor-dropdown.open { display: block; }
.doctor-option { padding: 0.7rem 1rem; cursor: pointer; font-size: 0.88rem; transition: background var(--transition); display: flex; align-items: center; justify-content: space-between; }
.doctor-option:hover { background: var(--primary-pale); }
.doctor-option-phone { font-size: 0.78rem; color: var(--text-muted); }
.selected-doctor-phone { font-size: 0.82rem; color: var(--accent); font-weight: 600; margin-top: 0.4rem; padding: 0.3rem 0.6rem; background: var(--accent-light); border-radius: 6px; display: none; }

/* ===== REPORTS CARD ===== */
.reports-card { background: white; border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.reports-filters { margin-bottom: 2rem; }
.reports-filters h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 1rem; }
.filters-row { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.filters-row .filter-group input,
.filters-row .filter-group select { min-width: 140px; }

.report-preview { background: var(--bg); border-radius: var(--radius-sm); padding: 1.5rem; margin-bottom: 2rem; display: flex; align-items: center; justify-content: space-between; border: 2px dashed var(--border); }
.preview-stats { }
.preview-value { display: block; font-size: 2rem; font-weight: 700; color: var(--primary); }
.preview-label { font-size: 0.82rem; color: var(--text-muted); }
.btn-preview { display: flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.4rem; background: white; border: 2px solid var(--border); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.88rem; cursor: pointer; transition: all var(--transition); color: var(--text); }
.btn-preview:hover { border-color: var(--primary-light); color: var(--primary); }
.btn-preview svg { width: 18px; height: 18px; }

.download-section h3 { font-size: 1rem; font-weight: 600; color: var(--text); margin-bottom: 1rem; }
.download-buttons { display: flex; gap: 1rem; flex-wrap: wrap; }
.btn-download { display: flex; align-items: center; gap: 1rem; padding: 1.2rem 1.5rem; border: 2px solid var(--border); border-radius: var(--radius); background: white; cursor: pointer; transition: all var(--transition); flex: 1; min-width: 200px; }
.btn-download:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.btn-download.pdf:hover { border-color: #e74c3c; }
.btn-download.csv:hover { border-color: var(--accent); }
.download-icon { font-size: 2rem; }
.download-info { flex: 1; text-align: left; }
.download-type { display: block; font-weight: 700; font-size: 0.95rem; color: var(--text); }
.download-desc { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.2rem; }
.download-arrow { width: 20px; height: 20px; color: var(--text-muted); }
.report-table-wrap { margin-top: 2rem; }
.report-table-wrap h3 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }

/* ===== MODALS ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 1rem; overflow-y: auto; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: var(--radius-lg); width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); max-height: 90vh; display: flex; flex-direction: column; }
.modal.small { max-width: 340px; }
@keyframes modalIn { from { opacity:0; transform: scale(0.85) translateY(20px); } to { opacity:1; transform: scale(1) translateY(0); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.modal-close { background: var(--bg); border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; justify-content: center; transition: all var(--transition); }
.modal-close:hover { background: var(--rose-light); color: var(--rose); }
.modal-body { padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto; flex: 1; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: 0.75rem; justify-content: flex-end; flex-shrink: 0; }
.modal-body .form-group input:not([type="radio"]):not([type="checkbox"]),
.modal-body .form-group select,
.modal-body .form-group textarea { width: 100%; padding: 0.65rem 0.85rem; border: 2px solid var(--border); border-radius: var(--radius-sm); outline: none; transition: border-color var(--transition); }
.modal-body .form-group input:not([type="radio"]):not([type="checkbox"]):focus,
.modal-body .form-group select:focus,
.modal-body .form-group textarea:focus { border-color: var(--primary-light); }
.phone-input-wrap { display: flex; align-items: center; border: 2px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; transition: border-color var(--transition); }
.phone-input-wrap:focus-within { border-color: var(--primary-light); }
.phone-prefix { padding: 0.65rem 0.85rem; background: var(--bg); color: var(--primary); font-weight: 600; font-size: 0.88rem; white-space: nowrap; border-right: 1px solid var(--border); flex-shrink: 0; }
.phone-input-wrap input { border: none; outline: none; padding: 0.65rem 0.75rem; flex: 1; min-width: 0; font-size: 0.88rem; }
.btn-cancel { padding: 0.6rem 1.2rem; background: var(--bg); border: 2px solid var(--border); border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem; cursor: pointer; color: var(--text-muted); transition: all var(--transition); }
.btn-cancel:hover { border-color: var(--text-muted); color: var(--text); }
.form-error { font-size: 0.82rem; color: var(--rose); background: var(--rose-light); padding: 0.5rem 0.75rem; border-radius: 6px; display: none; }
.form-error.show { display: block; }

/* ===== DOWNLOAD CHOICE ===== */
.download-choice-wrap { display: flex; gap: 1rem; justify-content: center; }
.choice-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 1.5rem 1rem; border: 2px solid var(--border); border-radius: var(--radius); background: white; cursor: pointer; transition: all var(--transition); font-weight: 600; color: var(--text); font-size: 0.9rem; }
.choice-btn:hover { border-color: var(--primary-light); background: var(--primary-pale); color: var(--primary); transform: translateY(-2px); }
.choice-icon { font-size: 2.5rem; }

/* ===== TOAST ===== */
.toast { position: fixed; bottom: 2rem; right: 2rem; padding: 0.85rem 1.5rem; background: var(--text); color: white; border-radius: var(--radius-sm); font-size: 0.88rem; font-weight: 500; box-shadow: var(--shadow-lg); z-index: 9999; opacity: 0; transform: translateY(20px); transition: all 0.3s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--accent); }
.toast.error { background: var(--rose); }
.toast.info { background: var(--primary); }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .charts-row { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .main-content { padding: 1rem; margin-left: var(--sidebar-w); }
  .page-header { flex-direction: column; align-items: flex-start; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .sidebar { width: var(--sidebar-w); }
  .sidebar:hover { width: var(--sidebar-w-open); }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 2rem 1.5rem; }
  .download-buttons { flex-direction: column; }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== PRICE DISPLAY FIELDS ===== */
.price-display-wrap input[readonly] {
  background: #f8fbff;
  cursor: not-allowed;
  font-weight: 700;
  color: var(--primary);
}

/* ===== BOOKINGS BADGE ===== */
#bookingsBadge {
  position: absolute;
  top: -4px;
  right: -10px;
  background: #e53e3e;
  color: white;
  font-size: 9px;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
}

/* ===== NAV LABEL POSITION FIX ===== */
.nav-label {
  font-size: 0.88rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity var(--transition);
  position: relative;
  white-space: nowrap;
}
.sidebar:hover .nav-label { opacity: 1; }

/* ===== MODAL SCROLL FIX (ensure body scrolls) ===== */
.modal-overlay.open {
  display: flex;
  align-items: flex-start;
  padding-top: 2rem;
  padding-bottom: 2rem;
  overflow-y: auto;
}

@media (min-height: 700px) {
  .modal-overlay.open {
    align-items: center;
  }
}

/* ===== DONE BOOKING MODAL wider ===== */
#doneBookingModal .modal {
  max-width: 500px;
}

/* ===== HOLIDAY SCHEDULE BOX ===== */
.holiday-schedule-box {
  background: var(--primary-pale);
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid var(--border);
}

/* ===== TABLE RESPONSIVE ===== */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== READONLY INPUT STYLES ===== */
input[readonly] {
  background: #f8fbff !important;
  cursor: not-allowed;
}

/* ===== REVENUE SECTION ===== */
.revenue-section {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.revenue-total-card {
  background: linear-gradient(135deg, #1a5276, #2e86c1);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: 0 8px 24px rgba(26,82,118,0.25);
}

.revenue-total-icon {
  width: 52px;
  height: 52px;
  background: rgba(255,255,255,0.2);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}
.revenue-total-icon svg { width: 26px; height: 26px; }

.revenue-total-label {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.75);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.revenue-total-value {
  font-size: 2rem;
  font-weight: 800;
  color: white;
  line-height: 1.1;
  font-family: 'Playfair Display', serif;
}

.revenue-total-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.6);
  margin-top: 0.3rem;
}

.revenue-breakdown {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.revenue-breakdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.revenue-bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 130px;
  align-items: center;
  gap: 1rem;
}

.revenue-bar-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}

.revenue-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.revenue-dot.cash   { background: #d68910; }
.revenue-dot.online { background: #148f77; }

.revenue-bar-wrap {
  height: 10px;
  background: #f1f5f9;
  border-radius: 20px;
  overflow: hidden;
}

.revenue-bar-fill {
  height: 100%;
  border-radius: 20px;
  transition: width 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.revenue-bar-fill.cash   { background: linear-gradient(90deg, #f0b429, #d68910); }
.revenue-bar-fill.online { background: linear-gradient(90deg, #1dd1a1, #148f77); }

.revenue-bar-vals {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.revenue-pct {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 38px;
  text-align: right;
}

@media (max-width: 900px) {
  .revenue-section { grid-template-columns: 1fr; }
}

/* ===== PAYMENT TYPE RADIO BUTTONS ===== */
.payment-type-group {
  display: flex;
  gap: 0.75rem;
}

.payment-radio-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.1rem;
  border: 2px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  flex: 1;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.2s;
  background: white;
  color: var(--text);
}

.payment-radio-label:hover {
  border-color: var(--primary-light);
}

.payment-radio-label.selected-cash {
  border-color: #d68910 !important;
  background: #fef9e7 !important;
  color: #b7770d;
}

.payment-radio-label.selected-online {
  border-color: var(--accent) !important;
  background: var(--accent-light) !important;
  color: var(--accent);
}

.payment-radio-label input[type="radio"] {
  width: 16px !important;
  height: 16px !important;
  padding: 0 !important;
  border: none !important;
  cursor: pointer;
  flex-shrink: 0;
}

/* ============================================
   MOBILE RESPONSIVE - COMPLETE OVERHAUL
   ============================================ */

/* ===== MOBILE BOTTOM NAV ===== */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--primary);
  z-index: 200;
  padding: 0 0 env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
}
.mobile-nav-inner {
  display: flex;
  align-items: stretch;
  height: 60px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.mobile-nav-inner::-webkit-scrollbar { display: none; }
.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0 14px;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  min-width: 60px;
  border: none;
  background: none;
}
.mobile-nav-item svg { width: 20px; height: 20px; }
.mobile-nav-item span { font-size: 9px; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }
.mobile-nav-item.active { color: white; }
.mobile-nav-item.active svg { filter: drop-shadow(0 0 6px rgba(255,255,255,0.5)); }
.mobile-nav-logout {
  margin-left: auto;
  border-left: 1px solid rgba(255,255,255,0.1);
}

/* ===== MOBILE HEADER ===== */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--primary);
  z-index: 150;
  align-items: center;
  padding: 0 1rem;
  gap: 0.75rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.mobile-header-logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}
.mobile-header-logo img { width: 100%; height: 100%; object-fit: contain; }
.mobile-header-title {
  flex: 1;
  color: white;
  font-family: 'Playfair Display', serif;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}
.mobile-header-title small {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.6);
  font-weight: 400;
}
.mobile-header-user {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  /* Hide desktop sidebar */
  .sidebar { display: none !important; }

  /* Show mobile header and bottom nav */
  .mobile-header { display: flex; }
  .mobile-bottom-nav { display: block; }

  /* Main content adjustments */
  .main-content {
    margin-left: 0 !important;
    padding: 1rem;
    padding-top: calc(56px + 1rem);
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0) + 1rem);
  }

  /* Page header stack */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }
  .page-header h2 { font-size: 1.3rem; }
  .page-header .btn-primary { width: 100%; justify-content: center; padding: 0.75rem; }

  /* Stats grid - 2 col on mobile */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
  .stat-card { padding: 1rem; gap: 0.75rem; }
  .stat-icon { width: 40px; height: 40px; border-radius: 10px; }
  .stat-icon svg { width: 18px; height: 18px; }
  .stat-value { font-size: 1.4rem; }
  .stat-label { font-size: 0.72rem; }

  /* Charts stack */
  .charts-row { grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.25rem; }
  .chart-wrap { height: 200px; }
  .chart-wrap canvas { max-height: 200px; }

  /* Table cards */
  .card-header { padding: 0.85rem 1rem; }
  .card-header h3 { font-size: 0.88rem; }
  .data-table th { padding: 0.65rem 0.75rem; font-size: 0.7rem; }
  .data-table td { padding: 0.7rem 0.75rem; font-size: 0.82rem; }

  /* Header filters stack */
  .header-filters { flex-direction: column; align-items: stretch; width: 100%; }
  .filter-group { flex-direction: row; align-items: center; gap: 0.5rem; }
  .filter-group label { min-width: 60px; font-size: 0.7rem; }
  .filter-group input, .filter-group select { flex: 1; font-size: 0.82rem; }
  .btn-clear { margin-top: 0; width: 100%; }
  .search-input { width: 100%; }
  .header-actions { flex-direction: column; width: 100%; }
  .header-actions .btn-primary, .header-actions .btn-secondary { width: 100%; justify-content: center; }

  /* Doctors grid */
  .doctors-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .doctor-card { padding: 1rem; }

  /* Modals - full screen on mobile */
  .modal-overlay { padding: 0; align-items: flex-end !important; }
  .modal {
    max-width: 100% !important;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.1, 0.64, 1);
  }
  @keyframes modalSlideUp {
    from { transform: translateY(100%); opacity: 0.5; }
    to { transform: translateY(0); opacity: 1; }
  }
  .modal-header { padding: 1.1rem 1.25rem; }
  .modal-body { padding: 1.1rem 1.25rem; }
  .modal-footer { padding: 0.85rem 1.25rem; }
  .modal-footer .btn-primary,
  .modal-footer .btn-cancel { flex: 1; justify-content: center; padding: 0.75rem; }

  /* Reports */
  .filters-row { flex-direction: column; }
  .filters-row .filter-group { flex-direction: column; align-items: flex-start; }
  .download-buttons { flex-direction: column; }
  .btn-download { min-width: unset; }
  .report-preview { flex-direction: column; gap: 1rem; text-align: center; }

  /* Holiday status buttons */
  #tab-holiday [style*="display:flex"][style*="gap:1rem"] {
    flex-direction: column !important;
  }
  #tab-holiday button[onclick*="sendCenterStatus"] {
    width: 100%;
    justify-content: center;
  }

  /* Revenue section */
  .revenue-section { grid-template-columns: 1fr; }

  /* Toast - bottom center on mobile */
  .toast { bottom: calc(60px + env(safe-area-inset-bottom, 0) + 0.75rem); right: 1rem; left: 1rem; text-align: center; }

  /* Doctor dropdown */
  .doctor-dropdown { max-height: 160px; }

  /* Download choice */
  .download-choice-wrap { flex-direction: column; }
  .choice-btn { padding: 1rem; }

  /* Login card */
  .login-card { margin: 1rem; padding: 2rem 1.5rem; }
}

/* ===== VERY SMALL PHONES (≤380px) ===== */
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 1.2rem; }
  .doctors-grid { grid-template-columns: 1fr; }
  .page-header h2 { font-size: 1.15rem; }
  .data-table th, .data-table td { padding: 0.55rem 0.6rem; font-size: 0.75rem; }
}
