/* BoTrygtHjemme Portal — Modern Dashboard CSS */
@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
    --primary: #1a56db;
    --primary-dark: #1347bb;
    --primary-light: #ebf1fd;
    --accent: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --purple: #8b5cf6;
    --teal: #14b8a6;
    --orange: #f97316;

    --bg: #f0f4fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --border-soft: #f1f5f9;

    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --sidebar-bg: #0f1729;
    --sidebar-text: #94a3b8;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-active: rgba(26,86,219,0.2);
    --sidebar-active-border: #1a56db;
    --sidebar-width: 260px;

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1), 0 8px 32px rgba(0,0,0,0.06);

    --topbar-h: 64px;
    --font-display: 'Syne', sans-serif;
    --font-body: 'DM Sans', sans-serif;
}

/* Admin theme */
[data-role="admin"] { --primary: #7c3aed; --primary-dark: #6d28d9; --primary-light: #ede9fe; --sidebar-active: rgba(124,58,237,0.2); --sidebar-active-border: #7c3aed; }
/* Verificator theme */
[data-role="verificator"] { --primary: #0891b2; --primary-dark: #0e7490; --primary-light: #ecfeff; --sidebar-active: rgba(8,145,178,0.2); --sidebar-active-border: #0891b2; }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
.portal-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.brand-icon {
    width: 38px; height: 38px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white;
    flex-shrink: 0;
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 16px;
    color: white;
    display: block;
    letter-spacing: -0.3px;
}

.brand-sub {
    font-size: 10px;
    color: var(--sidebar-text);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    margin: 12px 12px 0;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: white;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: white;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--sidebar-text);
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all .15s;
    border-left: 3px solid transparent;
}

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: var(--sidebar-active); color: white; border-left-color: var(--sidebar-active-border); }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-logout:hover { background: rgba(239,68,68,0.15); color: #f87171; }

/* ── Main Wrapper ── */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
    height: var(--topbar-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    position: sticky; top: 0;
    z-index: 50;
}

.topbar-title h1 {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    flex: 1;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 6px;
}

.icon-btn {
    width: 38px; height: 38px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    position: relative;
    transition: all .15s;
}

.icon-btn:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }
.icon-btn svg { width: 16px; height: 16px; }

.notif-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px; height: 18px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid white;
}

.notif-wrapper { position: relative; }

.notif-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    display: none;
    z-index: 200;
    overflow: hidden;
}

.notif-dropdown.open { display: block; }

.notif-header {
    padding: 14px 16px;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notif-clear { font-size: 12px; color: var(--primary); text-decoration: none; }
.notif-item { padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
.notif-item strong { font-size: 13px; display: block; }
.notif-item p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notif-item time { font-size: 11px; color: var(--text-light); }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
}

.user-avatar-sm {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700;
    font-size: 12px;
    color: white;
}

/* ── Page Content ── */
.page-content {
    flex: 1;
    padding: 28px;
}

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.card-body { padding: 20px; }

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: transform .2s, box-shadow .2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.blue { background: #ebf1fd; color: #1a56db; }
.stat-icon.green { background: #d1fae5; color: #10b981; }
.stat-icon.yellow { background: #fef3c7; color: #f59e0b; }
.stat-icon.red { background: #fee2e2; color: #ef4444; }
.stat-icon.purple { background: #ede9fe; color: #8b5cf6; }
.stat-icon.teal { background: #ccfbf1; color: #14b8a6; }

.stat-value {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -1px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Table ── */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--surface-2); }

th {
    padding: 11px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13.5px;
    vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-teal   { background: #ccfbf1; color: #134e4a; }
.badge-orange { background: #fff7ed; color: #9a3412; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all .15s;
    white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-outline { background: white; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 7px; }

/* ── Forms ── */
.form-grid { display: grid; gap: 16px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }

label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.2px;
}

.form-control {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.1);
}

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

.form-control::placeholder { color: var(--text-light); }

.form-hint { font-size: 11.5px; color: var(--text-muted); }

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Search ── */
.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrap svg {
    position: absolute;
    left: 11px;
    width: 15px; height: 15px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    padding: 8px 12px 8px 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    width: 240px;
    outline: none;
    transition: all .15s;
}

.search-input:focus { border-color: var(--primary); width: 280px; }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    justify-content: flex-end;
}

.page-btn {
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    text-decoration: none;
    color: var(--text);
    transition: all .15s;
}

.page-btn:hover, .page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Modal ── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 999;
    display: none;
}

.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    animation: modalIn .2s ease;
}

@keyframes modalIn {
    from { transform: scale(0.95) translateY(10px); opacity: 0; }
    to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    width: 32px; height: 32px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}

.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Status Timeline ── */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 5px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--border);
}

.timeline-date { font-size: 11px; color: var(--text-light); margin-bottom: 4px; }
.timeline-title { font-size: 13px; font-weight: 600; }
.timeline-body { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* ── Login Page ── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f1729 0%, #1a2940 50%, #0f1729 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(26,86,219,0.15) 0%, transparent 70%);
    top: -100px; right: -100px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(8,145,178,0.1) 0%, transparent 70%);
    bottom: -50px; left: -50px;
}

.login-card {
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    padding: 44px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.login-logo-icon {
    width: 48px; height: 48px;
    background: var(--primary);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    color: white;
}

.login-logo-text .name {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    color: white;
    display: block;
}

.login-logo-text .sub {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.login-heading {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    color: white;
    margin-bottom: 6px;
}

.login-sub {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 28px;
}

.login-card label { color: rgba(255,255,255,0.8); }

.login-card .form-control {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,255,255,0.12);
    color: white;
}

.login-card .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,0.3);
    background: rgba(255,255,255,0.1);
}

.login-card .form-control::placeholder { color: rgba(255,255,255,0.25); }

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: rgba(255,255,255,0.4);
}

.login-footer a { color: var(--accent); text-decoration: none; }
.login-footer a:hover { text-decoration: underline; }

/* ── Detail View ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-item {}
.detail-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-muted); margin-bottom: 4px; }
.detail-value { font-size: 14px; color: var(--text); }

/* ── Responsive ── */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .menu-toggle { display: flex; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .search-input { width: 180px; }
    .search-input:focus { width: 220px; }
}

@media (max-width: 480px) {
    .page-content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 28px 24px; }
}

/* ── Utils ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
