/* === Reset === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* === Variables (V3 heritage) === */
:root {
    --dark-green: #02303a;
    --lt-dark-green: #005b6b;
    --teal: #00a2bf;
    --teal-dark: #006378;
    --teal-darkest: #004551;
    --table-header: #002f36;
    --gold: rgba(221, 155, 0, 1);
    --error: rgba(140, 0, 87, 1);

    --bg-card: rgba(2, 48, 58, 0.85);
    --bg-nav: rgba(2, 48, 58, 0.95);
    --border: rgba(0, 91, 107, 0.4);
    --border-focus: rgba(4, 123, 155, 1);

    --text-primary: #e4e6ed;
    --text-secondary: #8badb8;
    --text-muted: #5c8a96;

    --nav-width: 240px;
    --font-family: 'Nunito', sans-serif;
}

/* === Base === */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@200;400;600;700;800&display=swap');

html, body {
    height: 100%;
    font-family: var(--font-family);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    overflow: hidden;
}

body {
    background: url('/assets/images/blue_checkered_background.jpg') no-repeat center center fixed;
    background-size: cover;
}

/* =========================================
   PRELOADER MASK
   ========================================= */
.main-mask {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(2, 48, 58, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mask-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(0, 162, 191, 0.2);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================================
   LOGIN SCREEN (V3 exact match)
   ========================================= */
#login-screen {
    position: relative;
    z-index: 1;
    height: 100vh;
}

/* Outer positioning — centered horizontally, sits at bottom 30% */
.login-container {
    position: absolute;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    max-width: 550px;
    width: 95%;
    overflow: visible;
}

/* Logo — large, behind the form card, overlapping upper-left */
.login-logo {
    position: absolute;
    top: -150px;
    left: -68px;
    width: 300px;
    height: 290px;
    z-index: 1;
    opacity: 0.8;
    pointer-events: none;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

/* Form card — sits above logo */
.login-card {
    position: relative;
    z-index: 2;
    width: 100%;
    background: rgba(201, 215, 224, 0.9);
    border-radius: 8px;
    box-shadow: 0px 1px 6px 1px rgba(0, 0, 0, 0.85);
}

.login-card-inner {
    padding: 15px;
    width: calc(100% - 30px);
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: inset -1px -2px 6px 1px rgba(0, 0, 0, 0.85);
}

/* Header */
.login-title {
    font-size: 30px;
    font-weight: 900;
    color: #000;
    text-align: left;
    margin-bottom: 10px;
}

/* Error message — hidden until .active */
.login-error {
    color: var(--error);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0;
    min-height: 0;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}

.login-error.active {
    min-height: 1.2rem;
    max-height: 3rem;
    opacity: 1;
    margin-bottom: 8px;
}

/* Fields container — side by side on desktop */
.login-fields {
    display: flex;
    justify-content: space-around;
}

/* Individual field */
.login-field {
    flex: 1 1 30%;
    max-width: 200px;
    width: 100%;
    text-align: left;
}

.login-field label {
    display: block;
    border: 1.5px solid rgba(0, 69, 81, 0.291);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 0 5px;
    font-size: 16px;
    font-weight: bold;
    color: #000;
    width: calc(100% - 33px);
    margin-bottom: -2px;
}

.login-field input {
    width: calc(100% - 12px);
    padding: 2px 6px;
    font-family: var(--font-family);
    font-size: 15px;
    color: #000;
    background: #fff;
    border: 1px solid #004551;
    border-radius: 6px;
    outline: none;
    box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.45);
    transition: all 0.3s ease-in-out;
}

.login-field input:focus {
    box-shadow: inset 0 0 5px rgba(4, 123, 155, 1);
}

/* Footer / button area */
.login-footer {
    text-align: center;
    margin-top: 10px;
}

.login-btn {
    padding: 3px 10px;
    width: 100px;
    font-family: var(--font-family);
    font-size: 20px;
    font-weight: 600;
    color: var(--gold);
    background: linear-gradient(to bottom, #00a2bf 0%, #006378 50%, #004551 100%);
    border: 1px solid #002a31;
    border-radius: 9px;
    box-shadow: 0px 1px 4px 0px rgba(0, 0, 0, 0.85);
    cursor: pointer;
    margin: 10px auto;
    display: inline-block;
    transition: transform 0.1s, box-shadow 0.2s;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 162, 191, 0.35);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* =========================================
   APP LAYOUT (post-login)
   ========================================= */
#app {
    position: relative;
    z-index: 1;
    height: 100vh;
}

#nav-bar {
    width: var(--nav-width);
    min-width: var(--nav-width);
    background: var(--bg-nav);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.nav-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--teal);
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.nav-item {
    display: block;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: rgba(0, 91, 107, 0.3);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--teal);
    color: #fff;
}

#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

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

.btn-primary:hover {
    background: var(--lt-dark-green);
}

/* === Responsive === */
@media (max-width: 900px) {
    .login-container {
        width: 80%;
        padding: 0 20px;
    }

    .login-fields {
        flex-direction: column;
        gap: 16px;
    }

    .login-field {
        max-width: 100%;
    }

    #nav-bar {
        display: none;
    }
}
