/* ============================================================
   ISSD Career Guidance & Placement Management System
   Main Stylesheet — ISSD Teal/Slate Theme
   ============================================================ */

/* ---- CSS Variables (Light Theme) ---- */
:root {
    --primary: #2D6E7E;
    --primary-dark: #1E4F5C;
    --primary-light: #3D8FA3;
    --primary-50: #EBF4F7;
    --primary-100: #C7E3EB;
    --accent: #4AAFCA;
    --accent-light: #7FCFDF;

    --success: #2ECC71;
    --success-bg: #E8F8F0;
    --warning: #F39C12;
    --warning-bg: #FEF5E7;
    --danger: #E74C3C;
    --danger-bg: #FDEDEC;
    --info: #3498DB;
    --info-bg: #EBF5FB;

    --bg: #F0F4F7;
    --bg-card: #FFFFFF;
    --bg-sidebar: #1A3A44;
    --bg-sidebar-hover: #243F4A;
    --bg-sidebar-active: rgba(74, 175, 202, 0.15);
    --sidebar-text: #A8C4CC;
    --sidebar-text-active: #FFFFFF;
    --sidebar-label: #4D7A86;

    --text-primary: #1A2E35;
    --text-secondary: #5A7480;
    --text-muted: #8AA5AE;
    --border: #DDE8ED;
    --border-focus: #4AAFCA;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.05);

    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --sidebar-w: 260px;
    --topbar-h: 64px;
    --transition: all 0.25s ease;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg: #0F1E24;
    --bg-card: #162830;
    --bg-sidebar: #0A1820;
    --bg-sidebar-hover: #162830;
    --border: #203540;
    --text-primary: #E8F2F5;
    --text-secondary: #7AAAB8;
    --text-muted: #4D7A86;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.4);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-light); }
img { max-width: 100%; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    min-height: 100vh;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.sidebar-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    padding: 4px;
}

.sidebar-brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.25rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 1px;
    line-height: 1;
}

.brand-sub {
    font-size: 0.65rem;
    color: var(--sidebar-label);
    font-weight: 500;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--sidebar-label);
    padding: 16px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    text-decoration: none;
    position: relative;
}

.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: #fff;
}

.nav-item.active {
    background: var(--bg-sidebar-active);
    color: var(--accent-light);
    border-left: 3px solid var(--accent);
}

.nav-item.active .nav-icon { color: var(--accent); }

.nav-icon {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.85;
}

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

.nav-badge.badge-success { background: var(--success); }
.nav-badge.badge-warning { background: var(--warning); }
.nav-badge.badge-danger { background: var(--danger); }

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-user {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-user:hover { background: var(--bg-sidebar-hover); }

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 0.8rem; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.65rem; color: var(--sidebar-label); }

.logout-btn {
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    transition: var(--transition);
    font-size: 1rem;
}
.logout-btn:hover { background: rgba(231,76,60,0.2); color: #ff6b5b; }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* ---- Topbar ---- */
.topbar {
    height: var(--topbar-h);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.menu-toggle:hover { background: var(--primary-50); color: var(--primary); }

.breadcrumb-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.breadcrumb-link { color: var(--primary); }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-current { color: var(--text-secondary); font-weight: 500; }

.topbar-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: var(--transition);
    position: relative;
}

.topbar-btn:hover { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); }

/* Notifications */
.notif-wrapper { position: relative; }

.notif-dot {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

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

.notif-dropdown.open { display: block; animation: dropIn 0.2s ease; }

.notif-header {
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
}

.notif-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 0.85rem; }
.notif-empty i { font-size: 1.5rem; margin-bottom: 6px; color: var(--success); display: block; }

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.notif-item:hover { background: var(--bg); }
.notif-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; flex-shrink: 0; }
.notif-info { background: var(--info-bg); color: var(--info); }
.notif-warning { background: var(--warning-bg); color: var(--warning); }
.notif-danger { background: var(--danger-bg); color: var(--danger); }
.notif-success { background: var(--success-bg); color: var(--success); }
.notif-title { font-size: 0.8rem; font-weight: 500; color: var(--text-primary); }
.notif-time { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }

/* User Menu */
.user-menu-wrapper { position: relative; }

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
}

.user-menu-btn:hover { background: var(--bg); }
.topbar-avatar { width: 28px; height: 28px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: #fff; }
.user-menu-name { display: none; }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 200;
    overflow: hidden;
    padding: 6px 0;
}

.user-dropdown.open { display: block; animation: dropIn 0.2s ease; }

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: var(--transition);
}

.user-dropdown a:hover { background: var(--bg); }
.user-dropdown a i { width: 16px; }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.text-danger { color: var(--danger) !important; }

/* ---- Flash Messages ---- */
.flash-message {
    margin: 16px 24px 0;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    font-weight: 500;
    animation: slideIn 0.4s ease;
}

.flash-success { background: var(--success-bg); color: #1A7A4A; border-left: 4px solid var(--success); }
.flash-danger { background: var(--danger-bg); color: #A93226; border-left: 4px solid var(--danger); }
.flash-warning { background: var(--warning-bg); color: #9A6A0A; border-left: 4px solid var(--warning); }
.flash-info { background: var(--info-bg); color: #1A6FA8; border-left: 4px solid var(--info); }

.flash-close { background: none; border: none; cursor: pointer; margin-left: auto; opacity: 0.6; font-size: 0.85rem; }

/* ---- Page Content ---- */
.page-content { padding: 24px; flex: 1; min-width: 0; }

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-left h1 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.page-header-left p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.page-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i { color: var(--primary); }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg); }

/* Stat Cards */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Variant for report/summary pages that want a fixed 4-up KPI row on
   desktop, collapsing through the same breakpoints as the default grid. */
.stat-cards-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    cursor: default;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--card-accent, var(--primary));
}

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

.stat-card-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card-body { flex: 1; min-width: 0; }

.stat-card-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stat-card-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 4px;
}

.stat-card-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Color variants */
.stat-primary { --card-accent: var(--primary); }
.stat-primary .stat-card-icon { background: var(--primary-50); color: var(--primary); }
.stat-success { --card-accent: var(--success); }
.stat-success .stat-card-icon { background: var(--success-bg); color: var(--success); }
.stat-warning { --card-accent: var(--warning); }
.stat-warning .stat-card-icon { background: var(--warning-bg); color: var(--warning); }
.stat-danger { --card-accent: var(--danger); }
.stat-danger .stat-card-icon { background: var(--danger-bg); color: var(--danger); }
.stat-info { --card-accent: var(--info); }
.stat-info .stat-card-icon { background: var(--info-bg); color: var(--info); }
.stat-accent { --card-accent: var(--accent); }
.stat-accent .stat-card-icon { background: var(--primary-100); color: var(--primary-dark); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-sm { padding: 6px 12px; font-size: 0.78rem; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--primary-light); color: #fff; }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #27AE60; color: #fff; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #CB4335; color: #fff; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #D68910; color: #fff; }

.btn-info { background: var(--info); color: #fff; }
.btn-info:hover { background: #2471A3; color: #fff; }

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }

.btn-outline-primary { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); color: var(--text-primary); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }

table.data-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 0.875rem;
}

/* Wide, data-dense tables (10+ columns) need more breathing room than the
   default min-width so columns don't get crushed on a typical 1280–1440px
   laptop screen — they scroll horizontally instead of squeezing text. */
table.data-table.data-table-wide { min-width: 980px; }

.data-table thead tr { background: var(--bg); }

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--primary-50); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ---- Sort header ---- */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { color: var(--primary); }
.sortable::after { content: ' ↕'; opacity: 0.4; font-size: 0.7rem; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-primary { background: var(--primary-100); color: var(--primary-dark); }
.badge-success { background: var(--success-bg); color: #1A7A4A; }
.badge-warning { background: var(--warning-bg); color: #9A6A0A; }
.badge-danger { background: var(--danger-bg); color: #A93226; }
.badge-info { background: var(--info-bg); color: #1A6FA8; }
.badge-secondary { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border); }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-label.required::after { content: ' *'; color: var(--danger); }

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-control:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(74, 175, 202, 0.12); }
.form-control:hover:not(:focus) { border-color: var(--primary-100); }
.form-control.is-invalid { border-color: var(--danger); }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235A7480' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 36px; cursor: pointer; }

.form-hint { font-size: 0.75rem; color: var(--text-muted); }
.form-error { font-size: 0.75rem; color: var(--danger); }

/* Search bar */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.search-input {
    width: 100%;
    padding: 9px 14px 9px 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.search-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(74,175,202,0.12); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 24, 32, 0.7);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-lg { max-width: 800px; }
.modal-sm { max-width: 420px; }

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

.modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title i { color: var(--primary); }
.modal-close { background: none; border: none; font-size: 1.1rem; color: var(--text-muted); cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); transition: var(--transition); }
.modal-close:hover { background: var(--bg); color: var(--text-primary); }

.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ============================================================
   TABS
   ============================================================ */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    gap: 2px;
    margin-bottom: 20px;
    overflow-x: auto;
}

.tab-btn {
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: var(--transition);
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   RATING STARS
   ============================================================ */
.star-rating { display: flex; gap: 6px; align-items: center; }
.star { font-size: 1.6rem; color: var(--border); cursor: pointer; transition: var(--transition); }
.star.active, .star:hover { color: #F39C12; }

/* ============================================================
   INSPECTION CHECKLIST
   ============================================================ */
.checklist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 10px;
}

.checklist-item:last-child { border-bottom: none; }

.checklist-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.checklist-label i { color: var(--primary); width: 18px; }

.rating-group { display: flex; gap: 6px; }

.rating-btn {
    width: 32px; height: 32px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.rating-btn:hover, .rating-btn.selected { background: var(--primary); color: #fff; border-color: var(--primary); }
.rating-btn[data-val="5"].selected { background: var(--success); border-color: var(--success); }
.rating-btn[data-val="1"].selected { background: var(--danger); border-color: var(--danger); }

/* ============================================================
   CHARTS SECTION
   ============================================================ */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.chart-container { position: relative; height: 280px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: block;
    opacity: 0.4;
}

.empty-state h3 { font-size: 1rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 0.875rem; }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

/* ============================================================
   STUDENT / COMPANY CARDS
   ============================================================ */
.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

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

.profile-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.profile-info { flex: 1; min-width: 0; }
.profile-name { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); margin-bottom: 2px; }
.profile-sub { font-size: 0.78rem; color: var(--text-secondary); }
.profile-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    padding: 16px 0 0;
    flex-wrap: wrap;
}

.page-btn {
    width: 34px; height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    background: var(--bg-card);
    transition: var(--transition);
    text-decoration: none;
}

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

.page-btn:disabled, .page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrapper {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
    top: -200px; right: -200px;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
    bottom: -100px; left: -100px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
}

.login-logo-wrap { text-align: center; margin-bottom: 28px; }
.login-logo { width: 72px; height: 72px; object-fit: contain; margin-bottom: 12px; }
.login-title { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.login-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ============================================================
   SIDEBAR OVERLAY (mobile)
   ============================================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ============================================================
   MISC
   ============================================================ */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.fw-bold { font-weight: 700; } .fw-medium { font-weight: 500; }
.text-primary-c { color: var(--primary); } .text-success { color: var(--success); }
.text-warning { color: var(--warning); } .text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); } .text-sm { font-size: 0.8rem; }
.action-btns { display: flex; gap: 6px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideIn { from { transform: translateX(-10px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { to { transform: translateX(-10px); opacity: 0; } }
@keyframes dropIn { from { transform: translateY(-8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn 0.4s ease both; }
.slide-up { animation: slideUp 0.4s ease both; }
.delay-1 { animation-delay: 0.1s; } .delay-2 { animation-delay: 0.2s; } .delay-3 { animation-delay: 0.3s; }

/* ============================================================
   RESPONSIVE
   ============================================================
   Breakpoints used throughout:
   1024px - tablets / small laptops: sidebar becomes an off-canvas
             drawer, multi-column grids drop to fewer columns.
   768px  - large phones / small tablets (portrait): tighter
             spacing, topbar/search bar/page header stack up.
   480px  - phones: single-column everything, larger tap targets,
             condensed tables, full-width buttons/modals.
   ============================================================ */

/* ---- Tablet & below (≤1024px) ---- */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: flex; }
    .sidebar-overlay.open { display: block; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; }
    .user-menu-name { display: block; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .chart-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

/* ---- Large phones / small tablets (≤768px) ---- */
@media (max-width: 768px) {
    /* Topbar */
    .topbar { padding: 0 14px; height: 58px; }
    .topbar-left { gap: 10px; }
    .topbar-right { gap: 6px; }
    .breadcrumb-nav { font-size: 0.78rem; max-width: 55vw; overflow: hidden; }
    .breadcrumb-link, .breadcrumb-current { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: bottom; }
    .topbar-btn { width: 34px; height: 34px; }
    .user-menu-btn { padding: 5px 8px; }
    .user-menu-name { font-size: 0.78rem; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Notifications / user dropdown should never overflow the viewport */
    .notif-dropdown { width: min(320px, calc(100vw - 28px)); right: -8px; }
    .user-dropdown { width: min(180px, calc(100vw - 28px)); }

    /* Page layout */
    .page-content { padding: 16px; }
    .page-header { flex-direction: column; align-items: stretch; }
    .page-header-left h1 { font-size: 1.25rem; }
    .page-header-actions { width: 100%; }
    .page-header-actions .btn { flex: 1; justify-content: center; }

    /* Stat cards: 2 per row on tablets/phones-landscape */
    .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 16px; gap: 12px; }
    .stat-card-icon { width: 40px; height: 40px; font-size: 1.05rem; }
    .stat-card-value { font-size: 1.4rem; }

    /* Cards */
    .card-header { padding: 14px 16px; flex-wrap: wrap; }
    .card-body { padding: 16px; }

    /* Forms */
    .form-grid, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; gap: 14px; }
    .form-control, .search-input { font-size: 0.9rem; padding: 11px 14px 11px 14px; }
    .search-input { padding-left: 36px; }

    /* Search / filter bars stack and go full width.
       Several modules set inline `min-width:140-160px` on these <select>
       filters; override it here so they actually collapse to 100% width
       on narrow screens instead of forcing horizontal overflow. */
    .search-bar { flex-direction: column; align-items: stretch; }
    .search-bar select.form-control,
    .search-bar .btn,
    .search-bar a.btn { width: 100% !important; min-width: 0 !important; }

    /* Tables: keep horizontal scroll, just tighten padding */
    .data-table th, .data-table td { padding: 10px 12px; font-size: 0.82rem; }

    /* Profile / company cards */
    .profile-card { padding: 14px; gap: 12px; }
    .profile-avatar { width: 44px; height: 44px; font-size: 1rem; }

    /* Grids */
    .grid-auto { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
    .chart-grid { grid-template-columns: 1fr; }
    .chart-container { height: 240px; }

    /* Modals */
    .modal { max-width: 100%; max-height: 95vh; }
    .modal-header { padding: 16px 18px; }
    .modal-body { padding: 18px; }
    .modal-footer { padding: 14px 18px; flex-wrap: wrap; }
    .modal-footer .btn { flex: 1; justify-content: center; }

    /* Tabs scroll horizontally already; just shrink padding */
    .tab-btn { padding: 9px 14px; font-size: 0.82rem; }

    /* Login */
    .login-card { padding: 28px 22px; }
    .login-wrapper { padding: 16px; }
}

/* ---- Phones (≤480px) ---- */
@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }
    .stat-card { flex-direction: row; }

    .page-header-left h1 { font-size: 1.15rem; }
    .page-header-left p { font-size: 0.8rem; }

    /* Stack page header action buttons vertically for easy tapping */
    .page-header-actions { flex-direction: column; }

    /* Buttons get a bit taller for touch, and full width when alone in a row */
    .btn { padding: 10px 16px; }
    .btn-sm { padding: 8px 12px; }

    /* Action buttons in tables: keep compact but tappable */
    .action-btns { gap: 4px; }
    .action-btns .btn-icon { width: 30px; height: 30px; font-size: 0.8rem; }

    /* Notification / user dropdowns full-width-ish on tiny screens */
    .notif-dropdown { width: calc(100vw - 20px); right: -4px; }
    .user-dropdown { width: calc(100vw - 20px); right: -4px; }

    /* Sidebar takes a touch more width on very narrow phones for readability */
    .sidebar { width: min(var(--sidebar-w), 86vw); }

    /* Profile cards stack avatar above content if content is tight */
    .profile-card { flex-wrap: wrap; }

    /* Pagination centers and wraps nicely */
    .pagination { justify-content: center; }

    /* Chart height shrinks further on small phones */
    .chart-container { height: 200px; }

    /* Rating widgets stay touch-friendly */
    .rating-btn { width: 36px; height: 36px; }
    .star { font-size: 1.8rem; }

    /* Search bar icon alignment still correct at this size */
    .search-input-wrapper { min-width: 0; }

    .login-card { padding: 24px 16px; }
    .login-logo { width: 60px; height: 60px; }
    .login-title { font-size: 1.15rem; }

    /* Topbar: prioritize the menu button and breadcrumb; trim chrome */
    .topbar { padding: 0 10px; gap: 6px; }
    .topbar-left { gap: 6px; min-width: 0; }
    .breadcrumb-nav { max-width: 38vw; }
    .breadcrumb-link, .breadcrumb-current { max-width: 90px; }
    .topbar-right { gap: 4px; }
    .topbar-btn { width: 32px; height: 32px; font-size: 0.82rem; }
    .user-menu-btn { padding: 4px 6px; gap: 5px; }
    .user-menu-btn .fa-chevron-down { display: none; }
    .user-menu-name { display: none; }
    .topbar-avatar { width: 26px; height: 26px; font-size: 0.7rem; }
}

/* ---- Generic helpers usable inline in any module ---- */
/* Long, unbroken text (emails, links, ids) should wrap instead of forcing
   horizontal scroll on narrow screens. */
.text-wrap-anywhere { overflow-wrap: anywhere; word-break: break-word; }

/* Utility to hide elements on small screens without inline styles */
@media (max-width: 768px) { .hide-mobile { display: none !important; } }
@media (min-width: 769px) { .hide-desktop { display: none !important; } }

/* Print styles */
@media print {
    .sidebar, .topbar, .page-header-actions, .btn, .action-btns { display: none !important; }
    .main-content { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
