/* =========================
   RESET
========================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* =========================
   ROOT VARIABLES
========================= */

:root {
    --primary: #0f172a;
    --primary-soft: #1e293b;
    --secondary: #2563eb;
    --secondary-dark: #1d4ed8;
    --background: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 14px;
}

/* =========================
   BODY
========================= */

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
}

/* =========================
   HEADER
========================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--primary);
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.18);
}

.navbar {
    max-width: 1280px;
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

/* LEFT */
.nav-left {
    display: flex;
    align-items: center;
    gap: 26px;
}

.brand {
    color: #ffffff;
    text-decoration: none;
    font-size: 24px;
    font-weight: 700;
    white-space: nowrap;
}

/* =========================
   NAV MENU
========================= */

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.nav-menu > a,
.dropbtn,
.logout-link {
    color: #e2e8f0;
    background: transparent;
    border: none;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    transition: 0.25s ease;
}

.nav-menu > a:hover,
.dropbtn:hover,
.logout-link:hover,
.active-link {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

/* =========================
   DROPDOWN
========================= */

.dropdown {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 230px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    z-index: 2000;
}

.dropdown-content a {
    display: block;
    padding: 12px 14px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background: var(--surface-2);
    color: var(--secondary);
}

.dropdown:hover .dropdown-content,
.dropdown:focus-within .dropdown-content {
    display: block;
}

/* =========================
   RIGHT NAV
========================= */

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ICON BUTTONS */
.icon-btn {
    position: relative;
    font-size: 18px;
    text-decoration: none;
    color: #e2e8f0;
    padding: 8px;
    border-radius: 10px;
    transition: 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.08);
}

/* NOTIFICATION BADGE */
.icon-btn .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* ONLINE DOT */
.icon-btn .badge.online {
    background: white;
    width: 10px;
    height: 10px;
    top: 6px;
    right: 6px;
}

/* USER INFO */
.role-badge,
.user-badge {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    white-space: nowrap;
}

/* LOGOUT */
.logout-link {
    color: #f87171;
    font-size: 13px;
    text-decoration: none;
    padding: 8px 10px;
    border-radius: 8px;
}

.logout-link:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* =========================
   DASHBOARD
========================= */

.dashboard {
    max-width: 1280px;
    margin: 30px auto;
    padding: 0 20px 24px;
}

/* PAGE TITLE */
.page-title h1,
.page-title h2 {
    font-size: 34px;
    color: var(--primary);
    margin-bottom: 6px;
}

.page-title p {
    color: var(--muted);
}

/* =========================
   CARDS
========================= */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: 0.25s ease;
}

.card:hover {
    transform: translateY(-4px);
}

.card h3 {
    color: var(--primary);
    margin-bottom: 10px;
}

.card p {
    color: var(--muted);
}

.card-stat {
    margin-top: 10px;
    font-size: 28px;
    font-weight: 700;
    color: var(--secondary);
}

/* =========================
   BUTTONS
========================= */

.btn {
    display: inline-block;
    background: var(--secondary);
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 600;
    text-decoration: none;
    transition: 0.25s ease;
}

.btn:hover {
    background: var(--secondary-dark);
}

/* =========================
   FORMS
========================= */

.form-page {
    max-width: 780px;
    margin: 30px auto;
    padding: 30px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* =========================
   TABLES
========================= */

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

/* =========================
   ALERTS
========================= */

.alert {
    padding: 12px;
    border-radius: 10px;
}

.alert.error {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.success {
    background: var(--success-bg);
    color: var(--success-text);
}

/* =========================
   LOGIN
========================= */

.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a, #1d4ed8);
}

.login-container {
    background: var(--surface);
    padding: 32px;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
}

/* =========================
   RESPONSIVE
========================= */

@media (max-width: 1150px) {
    .navbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .nav-menu {
        flex-wrap: wrap;
    }
}

@media (max-width: 700px) {
    .page-title h1 {
        font-size: 26px;
    }
}