/* MedX Business Growth AI — Admin Panel, light theme
   Colors pull from ThemeSetting (see layouts/admin.blade.php inline :root override)
   but these are the defaults matching the brand spec. */
:root {
    --primary: #0F766E;
    --primary-light: #14B8A6;
    --accent: #2563EB;
    --bg: #FFFFFF;
    --card: #F8FAFC;
    --border: #E2E8F0;
    --text: #0F172A;
    --text-muted: #64748B;
    --danger: #EF4444;
    --warning: #F59E0B;
    --success: #16A34A;
    --sidebar-width: 248px;
    --radius: 10px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    background: #FBFCFD;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 4px; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 8px; }

/* ---- Shell layout ---- */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: #FFFFFF;
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 20;
    transition: transform .2s ease;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}
.sidebar-brand img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
.sidebar-brand .logo-fallback {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.sidebar-brand strong { font-size: 14px; display: block; }
.sidebar-brand span { font-size: 11px; color: var(--text-muted); }

.nav-group { padding: 12px 12px; overflow-y: auto; flex: 1; }
.nav-group-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted); padding: 14px 10px 6px;
}
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 8px;
    color: #334155; font-size: 13.5px; font-weight: 500;
    margin-bottom: 2px;
}
.nav-link:hover { background: var(--card); }
.nav-link.active { background: var(--primary); color: #fff; }
.nav-link .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .55; flex-shrink: 0; }

.sidebar-footer { padding: 14px 20px; border-top: 1px solid var(--border); }
.sidebar-footer form button {
    width: 100%; background: none; border: 1px solid var(--border);
    border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--text-muted);
    cursor: pointer; font-family: var(--font);
}
.sidebar-footer form button:hover { border-color: var(--danger); color: var(--danger); }

.main { margin-left: var(--sidebar-width); flex: 1; min-width: 0; }
.topbar {
    height: 60px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; background: #fff; position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; }
.topbar .user-pill { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.content { padding: 24px; max-width: 1280px; }

/* ---- Cards / panels ---- */
.card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px color-mix(in srgb, var(--primary) 22%, transparent);
    transition: box-shadow .18s ease, transform .18s ease;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-header h2 { font-size: 15px; }
.card-header p { color: var(--text-muted); font-size: 12.5px; margin: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
    box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px -12px color-mix(in srgb, var(--primary) 22%, transparent);
    transition: box-shadow .18s ease, transform .18s ease;
}
.stat-card:hover, .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(15,23,42,.06), 0 16px 32px -14px color-mix(in srgb, var(--primary) 30%, transparent);
}
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.stat-icon {
    width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center;
    justify-content: center; margin-bottom: 12px;
}
.stat-card .value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.stat-card .delta { font-size: 12px; margin-top: 4px; }
.stat-card .delta.up { color: var(--success); }
.stat-card .delta.down { color: var(--danger); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
    text-align: left; padding: 10px 12px; color: var(--text-muted);
    font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 12px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #FAFBFC; }

/* ---- Badges ---- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
}
.badge-green { background: #DCFCE7; color: #15803D; }
.badge-amber { background: #FEF3C7; color: #B45309; }
.badge-red { background: #FEE2E2; color: #B91C1C; }
.badge-gray { background: #F1F5F9; color: #475569; }
.badge-blue { background: #DBEAFE; color: #1D4ED8; }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid.single { grid-template-columns: 1fr; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: #334155; }
.field .hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=search], input[type=date], input[type=tel], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
    font-family: var(--font); font-size: 13.5px; background: #fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,.12); }
input[type=color] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type=text] { max-width: 110px; }
textarea { resize: vertical; min-height: 70px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.switch { position: relative; width: 38px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: #CBD5E1; border-radius: 999px; transition: .15s; cursor: pointer; }
.switch .track::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::before { transform: translateX(16px); }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; font-family: var(--font);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #0B5B54; }
.btn-secondary { background: #fff; border-color: var(--border); color: var(--text); }
.btn-secondary:hover { background: var(--card); }
.btn-danger { background: #fff; border-color: #FCA5A5; color: var(--danger); }
.btn-danger:hover { background: #FEF2F2; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-row { display: flex; gap: 10px; margin-top: 6px; }

/* ---- Misc ---- */
.muted { color: var(--text-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.pagination { display: flex; gap: 6px; margin-top: 16px; align-items: center; }
.pagination a, .pagination span { padding: 6px 11px; border-radius: 6px; font-size: 12.5px; border: 1px solid var(--border); }
.pagination a:hover { background: var(--card); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.bulk-bar {
    display: none; align-items: center; gap: 12px;
    padding: 10px 16px; background: #EFF6FF; border: 1px solid #BFDBFE;
    border-radius: 8px; margin-bottom: 14px; font-size: 13px;
}
.bulk-bar strong { color: #1D4ED8; }
td.checkbox-col, th.checkbox-col { width: 32px; }
.impersonation-token {
    background: #0F172A; color: #E2E8F0; padding: 10px 12px; border-radius: 8px;
    font-family: ui-monospace, monospace; font-size: 12px; word-break: break-all;
    margin-top: 8px; user-select: all;
}
.alert { padding: 12px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: #DCFCE7; color: #15803D; }
.alert-error { background: #FEE2E2; color: #B91C1C; }
.alert ul { margin: 4px 0 0 18px; padding: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tabs a { padding: 10px 14px; font-size: 13.5px; font-weight: 500; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
code.inline { background: var(--card); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
pre.endpoint { background: #0F172A; color: #E2E8F0; padding: 14px 16px; border-radius: 8px; font-size: 12.5px; overflow-x: auto; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .form-grid { grid-template-columns: 1fr; }
}
