/* ============================================
   EquipTrain AI - Main Stylesheet
   Medical Equipment Training & Competency Platform
   Shares the XxxTrack family design system (navy sidebar,
   12px cards, same shadow language) with its own accent: Amber.
   ============================================ */

/* --- Color Variables --- */
:root {
    --primary:      #D97706;  /* Training Amber */
    --primary-dark: #B45309;  /* Hover / pressed */
    --primary-light:#FEF3E2;  /* Tinted backgrounds */
    --navy:         #0A1628;  /* Sidebar dark (shared across family) */
    --navy-mid:     #1a2f4e;  /* Sidebar gradient end */
    --sidebar-text: #A8B9CC;
    --body-bg:      #F0F4F8;
    --border:       #E8EDF2;
    --text:         #2C3E50;
    --text-muted:   #6C757D;
    --success:      #198754;
    --warning:      #FFC107;
    --danger:       #DC3545;
}

/* --- Body & Layout --- */
body {
    background-color: var(--body-bg);
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text);
}

.wrapper {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar (icon rail, matches MedTrack's pattern) --- */
.sidebar {
    width: 64px;
    height: 100vh;
    background: linear-gradient(180deg, var(--navy) 0%, var(--navy-mid) 100%);
    position: fixed;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 1050;
    transition: width 0.25s cubic-bezier(0.4,0,0.2,1);
    display: flex;
    flex-direction: column;
}
.sidebar.sidebar-expanded,
html.sb-pinned .sidebar { width: 260px; }
html:not(.sb-pinned) .sidebar:not(.sidebar-expanded):not(.open) .nav-item span,
html:not(.sb-pinned) .sidebar:not(.sidebar-expanded):not(.open) .brand-text,
html:not(.sb-pinned) .sidebar:not(.sidebar-expanded):not(.open) .nav-group-toggle-inner span,
html:not(.sb-pinned) .sidebar:not(.sidebar-expanded):not(.open) .nav-group-chevron,
html:not(.sb-pinned) .sidebar:not(.sidebar-expanded):not(.open) .sidebar-pin-btn {
    display: none;
}
html:not(.sb-pinned) .sidebar:not(.sidebar-expanded):not(.open) .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-pin-btn {
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 15px;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background-color 0.15s;
    margin-left: auto;
    flex-shrink: 0;
    line-height: 1;
}
.sidebar-pin-btn:hover {
    color: #ffffff;
    background: rgba(255,255,255,0.08);
}
html.sb-pinned .sidebar-pin-btn {
    color: var(--primary);
}
html.sb-pinned .sidebar-pin-btn:hover {
    color: #ffffff;
    background: rgba(217,119,6,0.25);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    gap: 12px;
    min-height: 64px;
    white-space: nowrap;
    overflow: hidden;
}
.brand-icon {
    width: 40px; height: 40px; min-width: 40px;
    background: var(--primary);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: white; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.brand-name { color: white; font-weight: 700; font-size: 15px; letter-spacing: 0.5px; }
.brand-sub  { color: var(--sidebar-text); font-size: 11px; letter-spacing: 0.3px; }

/* --- Sidebar Nav --- */
.sidebar-nav { padding: 10px 0 40px; overflow-y: auto; overflow-x: hidden; flex: 1; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
    white-space: nowrap;
    transition: all 0.2s;
}
.nav-item i { font-size: 18px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: white;
    border-left-color: var(--primary);
}
.nav-item.active {
    background: rgba(217,119,6,0.2);
    color: white;
    border-left-color: var(--primary);
}

/* Collapsible group (Question Management dropdown) */
.nav-group-toggle {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px 10px 20px;
    cursor: pointer;
    border-left: 3px solid transparent;
    color: var(--sidebar-text);
}
.nav-group-toggle:hover { background: rgba(255,255,255,0.04); }
.nav-group-toggle.open { border-left-color: rgba(217,119,6,0.5); }
.nav-group-body { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.nav-group-body.open { max-height: 600px; }
.nav-item-child { padding-left: 44px; font-size: 13px; }

/* --- Main Content --- */
.main-content {
    margin-left: 64px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1);
}
html.sb-pinned .main-content { margin-left: 260px; }

/* --- Topbar --- */
.topbar {
    background: white;
    padding: 12px 25px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 999;
}
.topbar-title { flex: 1; font-size: 18px; font-weight: 600; color: var(--navy); margin: 0; }
.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 10px; color: #4A5568; font-size: 14px; }
.user-avatar {
    width: 36px; height: 36px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 14px;
}

/* --- Page Content --- */
.page-content { padding: 25px; flex: 1; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-header h1 { font-size: 22px; font-weight: 700; color: var(--navy); margin: 0; }

/* --- Cards --- */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    margin-bottom: 20px;
}
.card-header {
    background: white;
    border-bottom: 1px solid var(--border);
    border-radius: 12px 12px 0 0 !important;
    padding: 15px 20px;
    font-weight: 600;
    color: var(--navy);
}

/* --- Stat / Action Cards --- */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border-left: 4px solid var(--primary);
}
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
    background: var(--primary-light);
    color: var(--primary);
}
.stat-number { font-size: 28px; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* Equipment action grid (Ask AI / Learn / Quick Guide / Safety / Test Me) */
.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    text-decoration: none;
    color: var(--navy);
    transition: transform 0.15s, box-shadow 0.15s;
}
.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.1);
    color: var(--navy);
}
.action-card i { font-size: 28px; color: var(--primary); }
.action-card span { font-weight: 600; font-size: 14px; }

/* --- Buttons --- */
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); }

/* --- Tables --- */
.table th {
    background: #F8FAFC;
    color: #4A5568;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
}
.table td { vertical-align: middle; font-size: 14px; }
.table th, .table td { border-right: 1px solid var(--border); }
.table th:last-child, .table td:last-child { border-right: none; }
.table tbody tr:nth-child(even) td { background: #F5F8FC; }

/* --- Badges --- */
.badge-approved   { background: #E5F7F0; color: #00875A; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-draft      { background: #FEF3E2; color: var(--primary-dark); padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-withdrawn,
.badge-superseded { background: #F1F3F5; color: #6C757D; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-passed     { background: #E5F7F0; color: #00875A; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-failed     { background: #FFE5E5; color: #CC0000; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-expired    { background: #FEF3E2; color: var(--primary-dark); padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-sync-pending,
.badge-sync-failed{ background: #FFF3CD; color: #856404; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-neutral    { background: #F1F3F5; color: #4A5568; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-untested   { background: #F1F3F5; color: #6C757D; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }

/* --- Mobile Hamburger Toggle & Backdrop --- */
.mobile-sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--navy);
    background: transparent;
    border: none;
    font-size: 24px;
    padding: 4px 8px;
    margin-right: 8px;
    border-radius: 6px;
    cursor: pointer;
    line-height: 1;
    transition: background-color 0.15s ease;
}
.mobile-sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 22, 40, 0.5);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.sidebar-backdrop.show {
    display: block;
    opacity: 1;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 991px) {
    .sidebar { width: 260px; transform: translateX(-260px); transition: transform 0.3s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-pin-btn { display: none !important; }
    .main-content { margin-left: 0 !important; }
    html.sb-pinned .main-content { margin-left: 0 !important; }
    .mobile-sidebar-toggle { display: inline-flex; }
}
@media (min-width: 992px) {
    .mobile-sidebar-toggle { display: none !important; }
    .sidebar-backdrop { display: none !important; }
}
@media (max-width: 768px) {
    .topbar { padding: 10px 14px; }
    .topbar-title { font-size: 15px; }
    .page-content { padding: 14px; }
    .page-header { flex-wrap: wrap; gap: 10px; }
    .stat-number { font-size: 22px; }
}

/* --- Guest Login (two-panel split, layouts/guest.blade.php) --- */
.guest-body { margin: 0; min-height: 100vh; }
.login-page { display: flex; min-height: 100vh; }

.login-left {
    flex: 1 1 45%;
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-mid) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px 64px;
}
.login-left-inner { max-width: 460px; margin: 0 auto; width: 100%; }

.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 48px; }
.login-brand .brand-icon { width: 48px; height: 48px; font-size: 22px; }
.login-brand .brand-name { font-size: 24px; }
.login-brand .brand-sub { font-size: 13px; }

.login-heading { font-size: 32px; font-weight: 700; line-height: 1.25; margin-bottom: 16px; color: white; }
.login-subtext { font-size: 15px; color: var(--sidebar-text); line-height: 1.6; margin-bottom: 40px; }

.login-features { display: flex; flex-direction: column; gap: 20px; }
.login-feature { display: flex; align-items: center; gap: 14px; }
.login-feature-icon {
    width: 40px; height: 40px; min-width: 40px;
    border-radius: 10px;
    background: rgba(217,119,6,0.2);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.login-feature-text { font-size: 14px; font-weight: 600; color: white; }

.login-right {
    flex: 1 1 55%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}
.login-right-inner { max-width: 400px; width: 100%; }
.login-welcome-heading { font-size: 26px; font-weight: 700; color: var(--navy); margin-bottom: 6px; }
.login-welcome-sub { font-size: 14px; color: var(--text-muted); margin-bottom: 28px; }

.login-input-icon {
    background: white;
    border-right: none;
    color: var(--text-muted);
}
.login-form .form-control { border-left: none; }
.login-form .form-control:focus { box-shadow: none; border-color: var(--primary); }
.login-form .input-group:focus-within .login-input-icon,
.login-form .input-group:focus-within .form-control { border-color: var(--primary); }
.login-password-toggle {
    background: white;
    border-left: none;
    color: var(--text-muted);
    cursor: pointer;
}
.login-password-toggle:hover { color: var(--navy); }

.login-footer { margin-top: 28px; text-align: center; font-size: 12px; color: var(--text-muted); }

@media (max-width: 991px) {
    .login-page { flex-direction: column; }
    .login-left {
        flex: 0 0 auto;
        padding: 32px 24px;
        align-items: center;
        text-align: center;
    }
    .login-left-inner { max-width: none; }
    .login-brand { justify-content: center; margin-bottom: 0; }
    .login-heading, .login-subtext, .login-features { display: none; }
    .login-right { padding: 32px 20px; }
}
@media (max-width: 768px) {
    .login-left { padding: 24px 16px; }
    .login-right { padding: 24px 16px; }
    .login-welcome-heading { font-size: 22px; }
}
