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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #1a1a2e;
    line-height: 1.6;
}

/* ─── Floating Glass Navbar ─── */
.navbar {
    position: fixed;
    top: 2px;
    left: 20px;
    right: 20px;
    z-index: 1000;
    background: rgba(18, 18, 38, 0.62);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    padding: 0 6px 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    border-radius: 16px;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.18),
        inset 0 1px 0 rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.07);
}

.navbar-brand {
    color: #c9a84c;
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.navbar-brand .brand-cross { font-size: 1.2rem; opacity: 0.9; }

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    justify-content: flex-end;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 1px;
    list-style: none;
}

.nav-links a {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-links a:hover {
    color: rgba(255,255,255,0.95);
    background: rgba(255,255,255,0.08);
}

/* ─── Admin Dropdown ─── */
.nav-dropdown { position: relative; }

.nav-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    color: rgba(255,255,255,0.55);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-dropdown-btn:hover,
.nav-dropdown.open .nav-dropdown-btn {
    color: rgba(255,255,255,0.95);
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.15);
}

.nav-dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    opacity: 0.6;
}

.nav-dropdown.open .nav-dropdown-arrow { transform: rotate(180deg); }

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: rgba(22, 22, 44, 0.88);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    z-index: 200;
    min-width: 220px;
    overflow: hidden;
    animation: glassDropIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-dropdown.open .nav-dropdown-menu { display: block; }

@keyframes glassDropIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.15s;
}

.nav-dropdown-item:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
}

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

.nav-dropdown-divider {
    height: 1px;
    background: rgba(255,255,255,0.06);
    margin: 4px 0;
}

.nav-online-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    display: inline-block;
    margin-left: 5px;
    animation: nav-pulse 2s infinite;
}

@keyframes nav-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

/* ─── Nav Right (user pill) ─── */
.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 8px;
    padding: 4px 5px 4px 12px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    flex-shrink: 0;
}

.nav-user-name {
    color: #c9a84c;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.nav-user-name:hover { color: #e0c56a; }

.nav-login-btn {
    padding: 7px 18px;
    background: #c9a84c;
    color: #1a1a2e;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    transition: all 0.25s;
}

.nav-login-btn:hover {
    background: #d4b85c;
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.25);
}

.nav-logout-btn {
    padding: 5px 10px;
    background: transparent;
    color: rgba(255,255,255,0.3);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 8px;
    font-size: 0.78rem;
    transition: all 0.2s;
    text-decoration: none;
    cursor: pointer;
}

.nav-logout-btn:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
}

/* ─── Role colors ─── */
.role-superadmin { background: #dc2626; color: #fff; }
.role-professor { background: #2563eb; color: #fff; }
.role-institute_admin { background: #7c3aed; color: #fff; }
.role-student { background: #059669; color: #fff; }
.role-reader { background: #6b7280; color: #fff; }

/* ─── Role selector ─── */
.role-selector { position: relative; }

.role-selector-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: opacity 0.2s;
}

.role-selector-btn:hover { opacity: 0.85; }
.role-selector-btn .arrow { font-size: 9px; transition: transform 0.2s; }
.role-selector.open .role-selector-btn .arrow { transform: rotate(180deg); }

.role-selector-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(22, 22, 44, 0.92);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
    z-index: 200;
    min-width: 200px;
    overflow: hidden;
    animation: glassDropIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.role-selector.open .role-selector-dropdown { display: block; }

.role-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
    transition: all 0.15s;
}

.role-option:hover { background: rgba(255,255,255,0.07); color: #fff; }
.role-option.active { background: rgba(201, 168, 76, 0.1); font-weight: 600; color: #fff; }
.role-option .role-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.role-option .check { margin-left: auto; color: #c9a84c; font-weight: 700; }

/* ─── Language Switcher ─── */
.lang-switcher {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 2px;
}

.lang-btn {
    padding: 3px 8px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    background: transparent;
    color: rgba(255,255,255,0.3);
    transition: all 0.2s;
}

.lang-btn.active {
    background: rgba(201, 168, 76, 0.2);
    color: #c9a84c;
}

.lang-btn:hover:not(.active) { color: rgba(255,255,255,0.6); }

/* ─── Hamburger ─── */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: rgba(255,255,255,0.5);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger:hover span { background: #c9a84c; }

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ─── Modal ─── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

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

.modal {
    background: #fff;
    border-radius: 16px;
    width: 420px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    position: relative;
}

.modal-header {
    background: #1a1a2e;
    color: #c9a84c;
    padding: 25px 30px;
    border-radius: 16px 16px 0 0;
    text-align: center;
}

.modal-header h2 { font-size: 1.3rem; margin: 0; }

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover { color: #c9a84c; }
.modal-body { padding: 30px; }

/* Multi-step Auth (Google style) */
.auth-step { display: none; }
.auth-step.active { display: block; }

.auth-email-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.auth-email-display span {
    font-size: 0.92rem;
    color: #1a1a2e;
    font-weight: 600;
}

.auth-change-email {
    background: transparent;
    border: none;
    color: #c9a84c;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.auth-change-email:hover {
    background: rgba(201, 168, 76, 0.1);
    color: #a88940;
}

.divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #bbb;
    font-size: 0.85rem;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #ddd;
}

.divider span { padding: 0 15px; }

/* Auth Form */
.auth-form .field { margin-bottom: 16px; }

.auth-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 5px;
}

.auth-form input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.auth-form input:focus { outline: none; border-color: #c9a84c; }

.auth-submit {
    width: 100%;
    padding: 12px;
    background: #1a1a2e;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 5px;
}

.auth-submit:hover { background: #2a2a4e; }

.auth-message {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 15px;
    display: none;
}

.auth-message.error { display: block; background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.auth-message.success { display: block; background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

/* Toast */
.toast {
    position: fixed;
    top: 76px;
    right: 24px;
    z-index: 3000;
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    backdrop-filter: blur(12px);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show { transform: translateX(0); }
.toast.success { background: rgba(21, 128, 61, 0.9); color: #fff; }

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .hamburger { display: flex; }

    .navbar {
        top: 8px;
        left: 10px;
        right: 10px;
        height: 48px;
        border-radius: 14px;
        padding: 0 6px 0 16px;
    }

    .nav-menu {
        position: fixed;
        top: 64px;
        left: 10px;
        right: 10px;
        background: rgba(18, 18, 38, 0.92);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        border-radius: 14px;
        border: 1px solid rgba(255,255,255,0.07);
        box-shadow: 0 12px 40px rgba(0,0,0,0.25);
        flex-direction: column;
        padding: 12px;
        gap: 4px;
        transform: translateY(-120%) scale(0.95);
        opacity: 0;
        transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .nav-menu.open {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    .nav-links {
        flex-direction: column;
        gap: 2px;
        width: 100%;
    }

    .nav-links a {
        display: block;
        padding: 12px 14px;
        font-size: 0.92rem;
        border-radius: 10px;
        color: rgba(255,255,255,0.65);
    }

    .nav-links a:hover {
        background: rgba(255,255,255,0.07);
        color: #fff;
    }

    .nav-dropdown { width: 100%; }

    .nav-dropdown-btn {
        width: 100%;
        padding: 12px 14px;
        font-size: 0.92rem;
        border-radius: 10px;
        justify-content: space-between;
        border-color: rgba(255,255,255,0.04);
    }

    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 10px;
        margin-top: 4px;
        background: rgba(255,255,255,0.04);
        backdrop-filter: none;
        animation: none;
    }

    .nav-dropdown-item {
        color: rgba(255,255,255,0.6);
        padding: 10px 20px;
        border-radius: 8px;
    }

    .nav-dropdown-item:hover {
        background: rgba(255,255,255,0.06);
        color: #fff;
    }

    .nav-dropdown-divider {
        background: rgba(255,255,255,0.05);
    }

    .nav-right {
        margin: 8px 0 0;
        padding: 10px 8px 6px;
        background: rgba(255,255,255,0.03);
        border-radius: 10px;
        justify-content: center;
        flex-wrap: wrap;
    }
}

/* ─── Language visibility ─── */
[data-lang-ka] { display: none !important; }

/* EN active (default) */
.nav-links a[data-lang-en] { display: block !important; }
a.cta-btn[data-lang-en] { display: inline-block !important; }

/* KA active */
html[lang="ka"] [data-lang-en] { display: none !important; }
html[lang="ka"] [data-lang-ka] { display: block !important; }
html[lang="ka"] span[data-lang-ka] { display: inline !important; }
html[lang="ka"] a.cta-btn[data-lang-ka] { display: inline-block !important; }
html[lang="ka"] .nav-links a[data-lang-ka] { display: block !important; }
html[lang="ka"] .address-line[data-lang-ka] { display: flex !important; }
html[lang="ka"] button[data-lang-ka] { display: inline-block !important; }
html[lang="ka"] a.nav-logout-btn[data-lang-ka] { display: inline-block !important; }
html[lang="ka"] .role-option span[data-lang-ka] { display: inline !important; }
html[lang="ka"] .role-selector-btn span[data-lang-ka] { display: inline !important; }
html[lang="ka"] th[data-lang-ka] { display: table-cell !important; }
html[lang="ka"] td[data-lang-ka] { display: table-cell !important; }
html[lang="ka"] p[data-lang-ka] { display: block !important; }
html[lang="ka"] h2[data-lang-ka] { display: block !important; }
html[lang="ka"] a[data-lang-ka] { display: inline-block !important; }
html[lang="ka"] label[data-lang-ka] { display: block !important; }
html[lang="ka"] div[data-lang-ka] { display: block !important; }
html[lang="ka"] .label[data-lang-ka] { display: block !important; }
