/* =============================================================
   TRC — Technology Readiness Council
   Clean modern light theme
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
    /* Brand */
    --navy:         #0c2340;
    --navy-700:     #163352;
    --teal:         #00a3c1;
    --teal-dark:    #007a94;
    --teal-50:      #f0fbfd;
    --teal-100:     #d0f1f8;

    /* Page surfaces */
    --page-bg:      #f1f5f9;
    --surface:      #ffffff;
    --surface-2:    #f8fafc;
    --surface-3:    #f1f5f9;

    /* Text */
    --text-1:       #0f172a;
    --text-2:       #475569;
    --text-3:       #94a3b8;

    /* Borders */
    --border:       #e2e8f0;
    --border-2:     #cbd5e1;

    /* Status */
    --green:        #059669;
    --green-bg:     #ecfdf5;
    --red:          #dc2626;
    --red-bg:       #fef2f2;
    --amber:        #d97706;
    --amber-bg:     #fffbeb;

    /* Elevation */
    --shadow-xs:    0 1px 2px rgba(15,23,42,0.06);
    --shadow-sm:    0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
    --shadow:       0 4px 6px rgba(15,23,42,0.07), 0 2px 4px rgba(15,23,42,0.04);
    --shadow-md:    0 10px 15px rgba(15,23,42,0.08), 0 4px 6px rgba(15,23,42,0.04);
    --shadow-lg:    0 20px 25px rgba(15,23,42,0.10), 0 8px 10px rgba(15,23,42,0.04);

    /* Shape */
    --radius-sm:    4px;
    --radius:       6px;
    --radius-lg:    10px;
    --radius-xl:    16px;
    --radius-full:  9999px;

    /* Motion */
    --ease:         0.15s ease;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }

/* ── Base ───────────────────────────────────────────────────── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--page-bg);
    color: var(--text-1);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* ── Typography ─────────────────────────────────────────────── */
h1 { font-size: 1.6rem;  font-weight: 700; color: var(--text-1); line-height: 1.2; }
h2 { font-size: 1.25rem; font-weight: 600; color: var(--text-1); line-height: 1.3; }
h3 { font-size: 1.05rem; font-weight: 600; color: var(--text-1); }
h4 { font-size: 0.75rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.07em; }
p  { color: var(--text-2); line-height: 1.7; margin-bottom: 1rem; }

/* Dark hero banners — override element-level color rules so text stays white */
.hero h1, .hero h2, .hero h3 { color: #fff !important; }
.hero p  { color: rgba(255,255,255,0.85) !important; }
.hero a  { color: #fff !important; }
p:last-child { margin-bottom: 0; }

/* ── Links ──────────────────────────────────────────────────── */
a {
    color: var(--teal-dark);
    text-decoration: none;
    transition: color var(--ease);
}
a:hover { color: var(--teal); }

/* ── Page layout ────────────────────────────────────────────── */
.page-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 32px 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 28px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-1);
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
    background-color: var(--navy);
    display: flex;
    align-items: stretch;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 56px;
    box-shadow: 0 1px 0 rgba(255,255,255,0.06), var(--shadow-sm);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff !important;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding-right: 20px;
    margin-right: 4px;
    border-right: 1px solid rgba(255,255,255,0.1);
    text-decoration: none !important;
    background: none !important;
    flex-shrink: 0;
}
.navbar-brand:hover { color: var(--teal-100) !important; background: none !important; }

.navbar-brand .brand-mark {
    width: 28px;
    height: 28px;
    background-color: var(--teal);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

/* Nav items */
.navbar > .dropdown,
.navbar > a {
    display: flex;
    align-items: stretch;
}

.navbar a,
.navbar .dropbtn {
    display: flex !important;
    align-items: center;
    color: rgba(255,255,255,0.65) !important;
    padding: 0 14px !important;
    font-size: 0.835rem !important;
    font-weight: 500 !important;
    text-decoration: none !important;
    background: none !important;
    cursor: pointer;
    white-space: nowrap;
    transition: color var(--ease) !important;
    border-bottom: 2px solid transparent;
}

.navbar > .dropdown:hover > .dropbtn,
.navbar > a:hover {
    color: #ffffff !important;
    border-bottom-color: var(--teal) !important;
    background: none !important;
}

/* Dropdown panel */
.navbar > .dropdown { position: relative; }

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    padding: 6px 0;
}

.navbar > .dropdown:hover > .dropdown-content { display: block !important; }

.dropdown-content > a,
.dropdown-content > .submenu > a {
    display: flex !important;
    align-items: center;
    color: var(--text-1) !important;
    padding: 8px 12px !important;
    font-size: 0.835rem !important;
    font-weight: 400 !important;
    border-radius: var(--radius) !important;
    border-bottom: none !important;
    transition: background-color var(--ease), color var(--ease) !important;
    gap: 8px;
}

.dropdown-content > a:hover {
    background-color: var(--teal-50) !important;
    color: var(--teal-dark) !important;
}

.dropdown-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

/* Submenu */
.dropdown-content .submenu { position: relative; }
.dropdown-content .submenu > a { justify-content: space-between; }
.dropdown-content .submenu > a::after { content: '›'; color: var(--text-3); font-size: 1rem; }
.dropdown-content .submenu > a:hover {
    background-color: var(--teal-50) !important;
    color: var(--teal-dark) !important;
}

.submenu-content {
    display: none;
    position: absolute;
    left: 100%;
    top: -4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-width: 220px;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    padding: 6px 0;
}


.submenu-content a {
    display: flex !important;
    align-items: center;
    color: var(--text-1) !important;
    padding: 8px 12px !important;
    font-size: 0.835rem !important;
    font-weight: 400 !important;
    border-radius: var(--radius) !important;
    border-bottom: none !important;
    transition: background-color var(--ease), color var(--ease) !important;
}
.submenu-content a:hover {
    background-color: var(--teal-50) !important;
    color: var(--teal-dark) !important;
}

.incident-management .submenu-content { right: 100%; left: auto; }

/* Search */
.search-button {
    display: flex !important;
    align-items: center;
    margin-left: auto;
    align-self: center;
    padding: 6px 14px !important;
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    border-bottom: 1px solid rgba(255,255,255,0.12) !important;
    border-radius: var(--radius) !important;
    color: rgba(255,255,255,0.7) !important;
    font-family: inherit;
    font-size: 0.82rem !important;
    font-weight: 500 !important;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--ease), color var(--ease) !important;
}
.search-button:hover {
    background: rgba(255,255,255,0.14) !important;
    color: #fff !important;
    border-color: rgba(255,255,255,0.2) !important;
}

/* Search panel */
#search-box {
    display: none;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}
#search-box form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 800px;
    margin: 0 auto;
}
#search-box input[type="text"] {
    flex: 1;
    min-width: 240px;
    padding: 9px 14px;
    font-size: 0.9rem;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    color: var(--text-1);
    font-family: inherit;
    display: block;
    width: auto;
}
#search-box input[type="text"]:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-100); }
#search-box input[type="submit"] { padding: 9px 20px; display: inline-flex; width: auto; }

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    width: 100%;
}
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.83rem;
    color: var(--text-2);
    cursor: pointer;
    font-weight: 400;
    margin-bottom: 0;
}
.checkbox-group input[type="checkbox"] {
    accent-color: var(--teal);
    width: auto;
    display: inline;
    padding: 0;
    border: none;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn,
input[type="submit"],
button[type="submit"],
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 18px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    transition: all var(--ease);
    line-height: 1.4;
    white-space: nowrap;
}

/* Primary */
.btn,
.btn-primary,
input[type="submit"],
button[type="submit"] {
    background-color: var(--teal);
    color: #fff;
    border-color: var(--teal);
    box-shadow: var(--shadow-xs);
}
.btn:hover,
.btn-primary:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
    background-color: var(--teal-dark);
    border-color: var(--teal-dark);
    color: #fff;
    box-shadow: var(--shadow-sm);
}

/* Secondary */
.btn-secondary {
    background-color: var(--surface);
    color: var(--text-1);
    border-color: var(--border-2);
    box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
    background-color: var(--surface-3);
    border-color: var(--border-2);
    color: var(--text-1);
}

/* Navy */
.btn-navy {
    background-color: var(--navy);
    color: #fff;
    border-color: var(--navy);
    box-shadow: var(--shadow-xs);
}
.btn-navy:hover {
    background-color: var(--navy-700);
    color: #fff;
}

/* Danger */
.btn-danger,
.delete-button,
.red-button {
    background-color: var(--red);
    color: #fff;
    border-color: var(--red);
    box-shadow: var(--shadow-xs);
}
.btn-danger:hover,
.delete-button:hover,
.red-button:hover {
    background-color: #b91c1c;
    color: #fff;
}

/* Ghost */
.btn-ghost {
    background-color: transparent;
    color: var(--text-2);
    border-color: var(--border);
}
.btn-ghost:hover {
    background-color: var(--surface-3);
    color: var(--text-1);
    border-color: var(--border-2);
}

.btn-sm  { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg  { padding: 11px 26px; font-size: 1rem; }

/* ── Card ───────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    transition: box-shadow var(--ease), border-color var(--ease), transform var(--ease);
}
.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-2);
}
.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-1);
    margin-bottom: 6px;
}
.card-body { color: var(--text-2); font-size: 0.875rem; }
.card-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ── Panel ──────────────────────────────────────────────────── */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-2);
}
.panel-body { padding: 20px; }

/* ── Tables ─────────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: var(--surface);
}

thead th {
    background-color: var(--surface-2);
    color: var(--text-3);
    text-align: left;
    padding: 11px 16px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color var(--ease);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background-color: var(--teal-50); }

td {
    padding: 12px 16px;
    color: var(--text-1);
    vertical-align: middle;
}

th, td { border: none; }

/* Wrapped in a card */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-top: 16px;
}
.table-wrap table { margin-top: 0; }

/* Legacy bordered tables */
table.bordered th, table.bordered td { border: 1px solid var(--border); }

/* ── Forms ──────────────────────────────────────────────────── */
label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-1);
    margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
input[type="tel"],
input[type="url"],
select,
textarea {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-family: inherit;
    font-size: 0.9rem;
    background-color: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: var(--radius);
    color: var(--text-1);
    transition: border-color var(--ease), box-shadow var(--ease);
    line-height: 1.5;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-100);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2394a3b8' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea { resize: vertical; min-height: 100px; }

.form-group  { margin-bottom: 20px; }
.form-hint   { font-size: 0.8rem; color: var(--text-3); margin-top: 4px; }
.form-error  { font-size: 0.8rem; color: var(--red); margin-top: 4px; }

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 180px; }

.edit-form { max-width: 640px; }
.edit-form table { background: none; box-shadow: none; border: none; }
.edit-form td { padding: 6px 4px; background: none; border: none; }

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    margin-bottom: 20px;
    border: 1px solid;
}
.alert-success { background: var(--green-bg); border-color: #a7f3d0; color: #065f46; }
.alert-danger  { background: var(--red-bg);   border-color: #fecaca; color: #991b1b; }
.alert-warning { background: var(--amber-bg); border-color: #fde68a; color: #92400e; }
.alert-info    { background: var(--teal-50);  border-color: var(--teal-100); color: var(--teal-dark); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-teal    { background: var(--teal-100); color: var(--teal-dark); }
.badge-navy    { background: var(--navy); color: #fff; }
.badge-green   { background: #d1fae5; color: #065f46; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.badge-amber   { background: #fef3c7; color: #92400e; }

/* ── Section label ──────────────────────────────────────────── */
.section-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    margin-bottom: 12px;
}

/* ── Stat cards ─────────────────────────────────────────────── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 0.78rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text-1); line-height: 1; }
.stat-sub   { font-size: 0.8rem; color: var(--text-3); margin-top: 4px; }
.stat-grid  { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }

/* ── Divider ────────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ── Utilities ──────────────────────────────────────────────── */
.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-muted    { color: var(--text-2); }
.text-sm       { font-size: 0.85rem; }
.text-xs       { font-size: 0.75rem; }
.text-teal     { color: var(--teal-dark); }
.text-danger   { color: var(--red); }
.text-success  { color: var(--green); }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.flex          { display: flex; }
.flex-col      { flex-direction: column; }
.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end   { justify-content: flex-end; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 24px; }

.w-full { width: 100%; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.p-4  { padding: 24px; }

.hidden { display: none; }

/* ── Chart containers ───────────────────────────────────────── */
.chart-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}
canvas { max-width: 100%; }

/* ── Logo ───────────────────────────────────────────────────── */
.logo {
    background-image: url('../TECHCOMPLY.png');
    background-size: contain;
    background-repeat: no-repeat;
    width: 140px;
    height: 44px;
}

/* ── Themes ─────────────────────────────────────────────────── */
/* Blue is the default (already in :root above).               */
/* Override only the variables that change per theme.           */

:root {
    --teal-glow: rgba(0,163,193,0.35);
}

body[data-theme="red"] {
    --navy:      #1e0505;
    --teal:      #dc2626;
    --teal-dark: #b91c1c;
    --teal-50:   #fef2f2;
    --teal-100:  #fecaca;
    --teal-glow: rgba(220,38,38,0.35);
}

body[data-theme="green"] {
    --navy:      #052010;
    --teal:      #059669;
    --teal-dark: #047857;
    --teal-50:   #ecfdf5;
    --teal-100:  #a7f3d0;
    --teal-glow: rgba(5,150,105,0.35);
}

body[data-theme="dark"] {
    --navy:      #0a0a0f;
    --teal:      #7c3aed;
    --teal-dark: #6d28d9;
    --teal-50:   #1e1b2e;
    --teal-100:  #2d2750;
    --teal-glow: rgba(124,58,237,0.35);
    /* Page surfaces */
    --page-bg:   #0f1117;
    --surface:   #1a1b26;
    --surface-2: #1e2030;
    --surface-3: #232433;
    /* Text */
    --text-1:    #e2e8f0;
    --text-2:    #94a3b8;
    --text-3:    #64748b;
    /* Borders */
    --border:    #2d3748;
    --border-2:  #4a5568;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar { padding: 0 14px; }
    .navbar a, .navbar .dropbtn { padding: 0 10px !important; font-size: 0.8rem !important; }
    .dropdown-content { position: static; box-shadow: none; border-radius: 0; border: none; padding-left: 12px; }
    .submenu-content  { position: static; box-shadow: none; border: none; padding-left: 12px; border-left: 2px solid var(--teal-100); margin: 2px 0; }
    .page-wrap { padding: 20px 16px; }
    h1 { font-size: 1.3rem; }
}
