:root {
    --primary: #FF5C00;
    --primary-glow: rgba(255, 92, 0, 0.2);
    --secondary: #0F172A;
    --bg-warm: #FFFBF5;
    --glass: rgba(255, 255, 255, 0.85);
    --border: rgba(255, 255, 255, 0.5);
    --transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    font-family: 'Inter', 'Prompt', sans-serif;
    background: var(--bg-warm);
    color: var(--secondary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Luxury Background Elements */
.login-page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* Stack vertically */
    align-items: center;
    justify-content: center; /* Center the card */
    padding: 20px 20px 5px 20px; /* Minimal padding at bottom */
    background: radial-gradient(circle at 10% 20%, rgba(255, 92, 0, 0.05) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(255, 92, 0, 0.05) 0%, transparent 40%);
}

.ambient-orb {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 92, 0, 0.08) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    filter: blur(80px);
    animation: floating 20s infinite alternate ease-in-out;
}

.orb-1 { top: -100px; right: -100px; }
.orb-2 { bottom: -100px; left: -100px; animation-delay: -5s; }

@keyframes floating {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.1); }
}

.grid-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(15, 23, 42, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: -1;
}

#particleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Card Design */
.login-container {
    width: 100%;
    max-width: 800px;
    padding: 10px;
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 40px); /* Fill screen minus page padding */
}
.login-card {
    margin-top: auto; /* Push to middle */
    margin-bottom: auto; /* Push to middle */
}

.login-card {
    background: var(--glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    padding: 60px;
    border-radius: 40px;
    border: 1px solid var(--border);
    box-shadow: 
        0 40px 100px rgba(15, 23, 42, 0.08),
        inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    opacity: 0;
    transform: translateY(30px) scale(0.98);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-card.active {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.brand-logo::before {
    content: '';
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 3px;
}

.logo-text {
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--secondary);
}

.login-header h1 {
    font-size: clamp(1.1rem, 5.5vw, 2.85rem); /* Adjusted min size to ensure it fits single line */
    font-weight: 800;
    color: var(--secondary);
    letter-spacing: -1px;
    margin-bottom: 15px;
    line-height: 1.2;
    white-space: nowrap; /* Force single line as requested */
}

.login-header p {
    color: #64748B;
    font-size: clamp(0.95rem, 3vw, 1.15rem);
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

/* Form Elements */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 12px;
    text-align: center;
    letter-spacing: 0.3px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input:not([type="submit"]):not([type="button"]) {
    width: 100%;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 20px;
    font-size: 1rem;
    color: var(--secondary);
    text-align: center;
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    background: #FFFFFF;
    box-shadow: 0 10px 25px var(--primary-glow);
    transform: translateY(-2px);
}

input.input-error {
    border-color: #EF4444 !important;
    background: #FEF2F2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

input.input-success {
    border-color: #10B981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

/* Toggle Password Button */
.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.toggle-password:hover {
    color: var(--primary);
}

.toggle-password:focus {
    outline: none;
}

/* ... existing button styles ... */

.btn-signin {
    width: 100%;
    padding: 16px 20px;
    background: var(--primary); /* Solid Blue */
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
    box-shadow: 0 12px 28px var(--primary-glow);
    margin-top: 15px;
    letter-spacing: 1px;
    text-transform: uppercase;
    animation: bluePulse 3s infinite alternate; /* Fading effect back and forth */
}

@keyframes bluePulse {
    0% {
        background: #2563EB; /* Normal Blue */
        box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
    }
    100% {
        background: #1E40AF; /* Darker Blue */
        box-shadow: 0 15px 35px rgba(37, 99, 235, 0.6);
    }
}

/* Forgot Password System */
.forgot-wrapper {
    margin-top: 25px;
    text-align: center;
}

.forgot-link {
    color: #64748B;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.forgot-link:hover {
    color: var(--primary);
}

.forgot-form-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease, margin-top 0.4s ease;
    opacity: 0;
    margin-top: 0;
    text-align: center;
}

.forgot-form-container.active {
    max-height: 200px;
    opacity: 1;
    margin-top: 20px;
}

.forgot-instruction {
    font-size: 0.85rem;
    color: #64748B;
    margin-bottom: 15px;
}

.btn-reset {
    width: 100%;
    padding: 14px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--secondary);
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s;
}

.btn-reset:hover {
    background: rgba(15, 23, 42, 0.1);
    color: var(--primary);
}

/* Popup System */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s ease;
}

.popup-overlay.active {
    display: flex;
    opacity: 1;
}

.popup-card {
    background: white;
    padding: 40px;
    border-radius: 32px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 30px 60px rgba(0,0,0,0.2);
}

.popup-overlay.active .popup-card {
    transform: scale(1);
}

.popup-icon {
    width: 80px;
    height: 80px;
    background: rgba(34, 197, 94, 0.1);
    color: #22C55E;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px;
}

.popup-icon svg { width: 40px; height: 40px; }

.popup-card h2 {
    font-size: 1.5rem;
    color: var(--secondary);
    margin-bottom: 15px;
    font-weight: 800;
}

.popup-card p {
    color: #64748B;
    line-height: 1.6;
    margin-bottom: 30px;
}

/* Error Variation */
.error-overlay .popup-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.btn-close-popup {
    background: #F1F5F9;
    color: #475569;
    border: none;
    padding: 12px 30px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-close-popup:hover {
    background: #E2E8F0;
    color: var(--secondary);
}

.popup-loader {
    width: 100%;
    height: 4px;
    background: #F1F5F9;
    border-radius: 2px;
    margin-top: 20px;
    overflow: hidden;
}

.loader-bar {
    height: 100%;
    background: var(--primary);
    width: 0;
    animation: loading 1.5s infinite ease-in-out;
}

@keyframes loading {
    0% { width: 0; transform: translateX(0); }
    50% { width: 50%; }
    100% { width: 0; transform: translateX(400px); }
}

@media (max-width: 480px) {
    .login-card {
        padding: clamp(30px, 8vw, 40px) clamp(15px, 5vw, 25px);
        border-radius: 30px;
    }
    .login-header {
        margin-bottom: 25px;
    }
    .login-header h1 {
        margin-bottom: 8px;
        font-size: 1.5rem;
        white-space: normal; /* Allow wrap on very small screens */
    }
    .login-container {
        padding: 10px;
    }
}

.login-footer {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.login-footer p {
    margin: 5px 0;
    color: #94A3B8;
    font-size: 0.85rem;
}

.login-footer a {
    color: #64748B;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.login-footer a:hover {
    color: var(--primary);
}
