/* =========================================================
   Star Health Care Center - Admin Stylesheet
   ========================================================= */
:root {
  --primary: #0d47a1;
  --primary-dark: #082e6b;
  --primary-light: #1976d2;
  --accent: #00b894;
  --navy: #0b1f3a;
  --text: #334155;
  --muted: #64748b;
  --bg: #f1f5fb;
  --white: #fff;
  --border: #e2e8f2;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --radius: 14px;
  --shadow: 0 10px 34px rgba(13, 71, 161, 0.1);
  --grad: linear-gradient(135deg, #0d47a1, #1976d2 55%, #00b894);
  --sidebar-w: 260px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Poppins', 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button, input, select, textarea { font-family: inherit; }

/* ---------- Login page ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-left { background: var(--grad); background-size: 200% 200%; animation: gradMove 9s ease infinite; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #fff; padding: 50px; }
.login-left::before, .login-left::after { content: ""; position: absolute; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.18); }
.login-left::before { width: 380px; height: 380px; top: -90px; right: -70px; animation: floaty 10s ease-in-out infinite; }
.login-left::after { width: 300px; height: 300px; bottom: -90px; left: -60px; animation: floaty 13s ease-in-out infinite reverse; }
.login-left .inner { position: relative; z-index: 2; max-width: 460px; }
.login-left h1 { font-size: 36px; margin-bottom: 16px; }
.login-left p { opacity: 0.92; margin-bottom: 30px; }
.login-left .feat { display: flex; gap: 14px; margin-bottom: 18px; align-items: center; }
.login-left .feat .ic { width: 46px; height: 46px; flex: none; border-radius: 12px; background: rgba(255, 255, 255, 0.14); display: grid; place-items: center; }
.login-left .feat .ic svg { width: 22px; height: 22px; }
.login-left .feat b { display: block; }
.login-left .feat span { font-size: 13px; opacity: 0.85; }
.login-right { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login-card { width: min(420px, 100%); }
.login-card .brand-line { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-card .logo { width: 52px; height: 52px; border-radius: 14px; background: var(--grad); color: #fff; display: grid; place-items: center; animation: pulseRing 3s ease-out infinite; }
.login-card .logo svg { width: 28px; height: 28px; }
.login-card h2 { font-size: 24px; color: var(--navy); margin-bottom: 4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }

/* ---------- Admin layout ---------- */
.admin-body { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--navy); color: #c7d9f2; position: fixed; top: 0; bottom: 0; left: 0; z-index: 100; display: flex; flex-direction: column; transition: transform 0.35s ease; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 20px 22px; border-bottom: 1px solid rgba(255, 255, 255, 0.09); }
.sidebar-brand .logo { width: 44px; height: 44px; border-radius: 12px; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }
.sidebar-brand .logo svg { width: 24px; height: 24px; }
.sidebar-brand h3 { color: #fff; font-size: 15px; line-height: 1.25; }
.sidebar-brand small { font-size: 11px; opacity: 0.7; letter-spacing: 1px; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-nav .nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.6px; color: #5f7ba3; margin: 18px 12px 8px; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 10px; color: #c7d9f2; font-size: 14px; font-weight: 500; margin-bottom: 3px; transition: 0.25s; position: relative; }
.sidebar-nav a svg { width: 19px; height: 19px; flex: none; }
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.sidebar-nav a.active { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(13, 71, 161, 0.45); }
.sidebar-nav a .badge { margin-left: auto; background: var(--warning); color: var(--navy); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 20px; }
.sidebar-nav a .badge.red { background: var(--danger); color: #fff; }
.sidebar-foot { padding: 16px; border-top: 1px solid rgba(255, 255, 255, 0.09); }
.sidebar-foot .admin-mini { display: flex; align-items: center; gap: 11px; }
.sidebar-foot .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 700; }
.sidebar-foot .avatar svg { width: 20px; height: 20px; }
.sidebar-foot b { color: #fff; font-size: 13.5px; display: block; line-height: 1.3; }
.sidebar-foot small { font-size: 11.5px; opacity: 0.7; }

.main-area { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.topbar-admin { background: var(--white); padding: 14px 26px; display: flex; align-items: center; justify-content: space-between; gap: 18px; box-shadow: 0 4px 18px rgba(13, 71, 161, 0.06); position: sticky; top: 0; z-index: 90; }
.topbar-admin .left { display: flex; align-items: center; gap: 14px; }
.menu-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: 10px; padding: 8px; cursor: pointer; color: var(--navy); }
.menu-toggle svg { width: 20px; height: 20px; }
.topbar-admin h2 { font-size: 19px; color: var(--navy); }
.topbar-admin .right { display: flex; align-items: center; gap: 12px; }
.topbar-admin .btn-view { display: inline-flex; align-items: center; gap: 8px; padding: 9px 18px; background: var(--grad); color: #fff; border-radius: 50px; font-weight: 600; font-size: 13.5px; transition: 0.3s; }
.topbar-admin .btn-view:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(13, 71, 161, 0.3); }
.topbar-admin .btn-view svg { width: 16px; height: 16px; }
.admin-content { padding: 28px; flex: 1; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border-radius: 10px; font-weight: 600; font-size: 14px; border: none; cursor: pointer; transition: 0.25s; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--grad); color: #fff; }
.btn-primary:hover { box-shadow: 0 10px 22px rgba(13, 71, 161, 0.3); transform: translateY(-2px); }
.btn-outline { background: #fff; border: 1.6px solid var(--border); color: var(--muted); }
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary); }
.btn-danger { background: #fff; border: 1.6px solid #fecaca; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-success { background: var(--accent); color: #fff; }
.btn-success:hover { box-shadow: 0 10px 22px rgba(0, 184, 148, 0.3); transform: translateY(-2px); }
.btn-sm { padding: 8px 14px; font-size: 12.5px; }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.card-head h3 { color: var(--navy); font-size: 17px; }
.card-body { padding: 24px; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 28px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; display: flex; gap: 16px; align-items: center; box-shadow: var(--shadow); transition: transform 0.3s, box-shadow 0.3s; position: relative; overflow: hidden; }
.stat-card:hover { transform: translateY(-5px); box-shadow: 0 18px 40px rgba(13, 71, 161, 0.16); }
.stat-card .ic { width: 58px; height: 58px; border-radius: 15px; display: grid; place-items: center; color: #fff; flex: none; }
.stat-card .ic svg { width: 28px; height: 28px; }
.stat-card h4 { font-size: 13px; color: var(--muted); font-weight: 500; }
.stat-card .val { font-size: 28px; font-weight: 800; color: var(--navy); line-height: 1.15; }
.stat-card::after { content: ""; position: absolute; top: -30px; right: -30px; width: 90px; height: 90px; border-radius: 50%; opacity: 0.08; background: currentColor; }
.sc-blue .ic { background: var(--primary-light); } .sc-blue { color: var(--primary-light); }
.sc-teal .ic { background: var(--accent); } .sc-teal { color: var(--accent); }
.sc-amber .ic { background: var(--warning); } .sc-amber { color: var(--warning); }
.sc-red .ic { background: var(--danger); } .sc-red { color: var(--danger); }
.sc-violet .ic { background: #8b5cf6; } .sc-violet { color: #8b5cf6; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead th { text-align: left; padding: 13px 16px; background: #f8fafc; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table tbody td { padding: 13px 16px; border-bottom: 1px solid #eef2f8; vertical-align: middle; }
.table tbody tr { transition: 0.2s; }
.table tbody tr:hover { background: #f8fbfe; }
.table .avatar-sm { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; }
.table .actions { display: flex; gap: 7px; justify-content: flex-end; }
.table .actions form { display: inline; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: #fff; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: 0.2s; }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { transform: translateY(-2px); }
.icon-btn.blue:hover { background: var(--primary-light); border-color: var(--primary-light); color: #fff; }
.icon-btn.green:hover { background: var(--success); border-color: var(--success); color: #fff; }
.icon-btn.red:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn.amber:hover { background: var(--warning); border-color: var(--warning); color: #fff; }
.icon-btn.violet:hover { background: #8b5cf6; border-color: #8b5cf6; color: #fff; }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 13px; border-radius: 50px; font-size: 12px; font-weight: 600; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.pending { background: #fef3c7; color: #b45309; }
.pill.confirmed { background: #d1fae5; color: #047857; }
.pill.completed { background: #dbeafe; color: #1d4ed8; }
.pill.cancelled { background: #fee2e2; color: #b91c1c; }
.pill.active { background: #d1fae5; color: #047857; }
.pill.inactive { background: #fee2e2; color: #b91c1c; }
.pill.read { background: #d1fae5; color: #047857; }
.pill.unread { background: #fef3c7; color: #b45309; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-weight: 600; font-size: 13.5px; color: var(--navy); }
.form-group label .req { color: var(--danger); }
.form-group .hint { font-size: 12px; color: var(--muted); }
.form-control, .form-group input, .form-group select, .form-group textarea {
  border: 1.6px solid var(--border); border-radius: 10px; padding: 11px 14px; font-size: 14px; color: var(--text); background: #fbfdff; outline: none; transition: 0.25s; width: 100%;
}
.form-control:focus, .form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary-light); box-shadow: 0 0 0 4px rgba(25, 118, 210, 0.12); background: #fff; }
.form-group textarea { resize: vertical; min-height: 120px; }
.form-error { color: var(--danger); font-size: 12px; }
.form-actions { display: flex; gap: 12px; margin-top: 8px; }
.form-check { display: flex; align-items: center; gap: 9px; }
.form-check input { width: 18px; height: 18px; accent-color: var(--primary); }
.preview-img { width: 90px; height: 90px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }

/* ---------- Filters ---------- */
.filter-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.filter-bar form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 24px; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: 9px; background: #fff; border: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.pagination .active, .pagination .current { background: var(--grad); color: #fff; border-color: transparent; }

/* ---------- Dashboard extra ---------- */
.welcome-banner { background: var(--grad); background-size: 200% 200%; animation: gradMove 9s ease infinite; border-radius: var(--radius); padding: 30px 34px; color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; position: relative; overflow: hidden; }
.welcome-banner::after { content: ""; position: absolute; width: 260px; height: 260px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.15); top: -80px; right: -40px; animation: floaty 10s ease-in-out infinite; }
.welcome-banner h3 { font-size: 22px; margin-bottom: 6px; }
.welcome-banner p { opacity: 0.92; font-size: 14px; max-width: 560px; }
.panel-title { font-size: 16px; color: var(--navy); font-weight: 700; margin: 8px 0 14px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--border); }
.list-row:last-child { border-bottom: none; }
.list-row .lr-av { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-soft, #e8f1fc); display: grid; place-items: center; color: var(--primary); font-weight: 700; }
.list-row b { color: var(--navy); font-size: 14px; display: block; line-height: 1.3; }
.list-row small { color: var(--muted); font-size: 12px; }

/* ---------- Message view ---------- */
.msg-detail { max-width: 760px; }
.msg-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 20px 0; }
.msg-meta .mm { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; }
.msg-meta .mm small { color: var(--muted); font-size: 12px; display: block; }
.msg-meta .mm b { color: var(--navy); font-size: 14px; }
.msg-text { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; font-size: 15px; line-height: 1.8; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.settings-grid .form-group.full { grid-column: 1 / -1; }

/* ---------- Flash ---------- */
.alert { padding: 15px 20px; border-radius: 12px; margin-bottom: 22px; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; animation: slideIn 0.4s ease; }
.alert svg { width: 20px; height: 20px; flex: none; }
.alert-success { background: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ---------- Auth errors ---------- */
.auth-alert { background: #fee2e2; border: 1px solid #fecaca; color: #b91c1c; border-radius: 12px; padding: 13px 18px; font-size: 14px; margin-bottom: 20px; }

/* ---------- Animations ---------- */
@keyframes gradMove { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
@keyframes floaty { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-22px); } }
@keyframes pulseRing { 0% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0.4); } 70% { box-shadow: 0 0 0 18px rgba(0, 184, 148, 0); } 100% { box-shadow: 0 0 0 0 rgba(0, 184, 148, 0); } }
@keyframes slideIn { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.anim-item { animation: fadeUp 0.5s ease both; }
.d1 { animation-delay: 0.06s; } .d2 { animation-delay: 0.12s; } .d3 { animation-delay: 0.18s; } .d4 { animation-delay: 0.24s; }

/* ---------- Responsive ---------- */
@media (max-width: 992px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 30px 0 60px rgba(0, 0, 0, 0.25); }
  .main-area { margin-left: 0; }
  .menu-toggle { display: block; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .login-wrap { grid-template-columns: 1fr; }
  .login-left { display: none; }
}
@media (max-width: 640px) {
  .admin-content { padding: 18px; }
  .form-grid, .settings-grid, .msg-meta { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .topbar-admin .btn-view span { display: none; }
}
