/* ==========================================================================
   PEAKHELM - HIGH-END PROFESSIONAL DARK + GREEN LOGIN
   ========================================================================== */

@font-face {
    font-family: 'Geist';
    font-style: normal;
    font-weight: 100 900; /* Supports weights 300 to 900 of the variable font */
    font-display: swap;
    src: url('../fonts/geist-sans-variable.woff2') format('woff2');
}

:root {
    --font-sans: 'Geist', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --color-bg: #040604; /* Luxurious Deep Forest-Charcoal Black (Green undertone) */
    --color-card: rgba(8, 11, 8, 0.65); /* Transparent Pine-Black with premium opacity */
    --color-border: rgba(255, 255, 255, 0.07);
    --color-border-hover: rgba(255, 255, 255, 0.16);
    --color-text-primary: #f9fafb; /* Zinc 50 */
    --color-text-secondary: #9ca3af; /* Zinc 400 */
    --color-text-muted: #4b5563; /* Zinc 600 */
    
    --color-primary: #20be5a; /* Custom Emerald-Green */
    --color-primary-hover: #2ee673; /* Custom Emerald-Green Lighter */
    --color-primary-glow: rgba(32, 190, 90, 0.15);
    
    --color-error: #f43f5e; /* Rose 500 */
    --color-error-bg: rgba(244, 63, 94, 0.05);
    --color-error-border: rgba(244, 63, 94, 0.15);
    
    --color-warn: #f59e0b; /* Amber 500 */
    --color-warn-bg: rgba(245, 158, 11, 0.05);
    --color-warn-border: rgba(245, 158, 11, 0.15);
}

/* Reset & Global styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    min-height: 100vh;
    font-family: var(--font-sans);
    overflow-x: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Elegant Grid & Radial Spotlight Backgrounds */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 1;
    background-size: 32px 32px;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    pointer-events: none;
}

.bg-glow {
    position: fixed;
    inset: 0;
    z-index: 2;
    background: radial-gradient(circle at 50% 50%, rgba(32, 190, 90, 0.05) 0%, transparent 65%);
    pointer-events: none;
}

/* Centered Layout Wrapper */
.login-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 440px;
    padding: 2.5rem 1.5rem;
}

/* Header Brand Section */
.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    filter: drop-shadow(0 0 24px rgba(32, 190, 90, 0.25));
    margin-bottom: 1.5rem;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.login-logo:hover {
    transform: scale(1.06) rotate(3deg);
}

.login-title {
    font-size: 1.625rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    color: #ffffff;
    line-height: 1.2;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    margin-top: 0.375rem;
    font-weight: 400;
}

/* Elegant Login Card */
.login-card {
    width: 100%;
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 2.5rem 2.25rem;
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
}

.login-card:focus-within {
    border-color: rgba(16, 185, 129, 0.2);
    box-shadow: 
        0 30px 60px -12px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(16, 185, 129, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Form Fields */
.login-field {
    margin-bottom: 1.25rem;
}

.login-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.login-input-wrapper {
    position: relative;
}

/* Sleek Minimal Inputs */
.login-input {
    width: 100%;
    height: 42px;
    padding: 0 1rem;
    background: rgba(4, 6, 4, 0.6);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

#password {
    padding-right: 2.75rem;
}

/* Prevent browser from forcing bright yellow/blue background on autofill (maintaining premium dark theme) */
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover, 
.login-input:-webkit-autofill:focus, 
.login-input:-webkit-autofill:active {
    -webkit-background-clip: text;
    -webkit-text-fill-color: var(--color-text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
    box-shadow: inset 0 0 0 50px rgba(4, 6, 4, 0.95) !important;
}

/* Hide native Chrome/Blink autofill buttons/keys to prevent overlapping and clashing with 1Password icon */
.login-input::-webkit-credentials-auto-fill-button,
.login-input::-webkit-contacts-auto-fill-button {
    position: absolute;
    right: 0;
    display: none !important;
    visibility: hidden !important;
    pointer-events: none;
}

.login-input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.8;
}

.login-input:hover {
    border-color: var(--color-border-hover);
    background: rgba(4, 6, 4, 0.8);
}

.login-input:focus {
    border-color: var(--color-primary);
    background: rgba(4, 6, 4, 0.9);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.login-input-wrapper:focus-within .login-field-icon {
    color: var(--color-primary);
}

/* Password Visibility Toggler */
.login-toggle-pw {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    min-height: unset !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    border-radius: 6px;
    cursor: pointer;
    border: 0;
    background: transparent;
    transition: color 0.2s ease, background-color 0.2s ease;
    z-index: 3;
}

.login-toggle-pw:hover {
    color: var(--color-text-primary);
    background: rgba(255, 255, 255, 0.06);
}

/* Submit Button with High-End Emerald Styling */
.login-submit {
    width: 100%;
    height: 42px;
    margin-top: 1.5rem;
    background: var(--color-primary);
    color: #022c13; /* Deep emerald contrast text */
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    border: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.1);
}

.login-submit:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.2);
}

.login-submit:active {
    transform: scale(0.985);
}

.login-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.login-submit .spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(2, 44, 19, 0.2);
    border-top-color: #022c13;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: none;
}

.login-submit.is-loading .spinner {
    display: inline-block;
}

.login-submit.is-loading .label,
.login-submit.is-loading i,
.login-submit.is-loading svg {
    display: none !important;
}

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

/* Alerts and Notifications */
.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.8125rem;
    margin-bottom: 1.25rem;
    border: 1px solid;
    line-height: 1.4;
}

.login-alert--error {
    background: var(--color-error-bg);
    border-color: var(--color-error-border);
    color: #fca5a5;
}

.login-alert--warn {
    background: var(--color-warn-bg);
    border-color: var(--color-warn-border);
    color: #fde047;
}

.login-alert i {
    font-size: 1.125rem;
    flex-shrink: 0;
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake-error {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: loginFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Caps Lock warning styled premium */
.caps-warning {
    display: none;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-warn);
    margin-top: 0.5rem;
    padding-left: 0.25rem;
    animation: loginFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}


/* Premium System Status & Infrastructure Metrics widget */
.system-status {
    width: 100%;
    margin-top: 1.5rem;
    background: rgba(9, 9, 11, 0.4);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
}

.status-header-text {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--color-primary);
}

.status-pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-primary);
    box-shadow: 0 0 8px var(--color-primary);
    animation: statusPulse 2s infinite;
}

@keyframes statusPulse {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
    70% { transform: scale(1); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-label {
    color: var(--color-text-secondary);
}

.status-value {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--color-text-primary);
    font-weight: 500;
}

.status-grid-compact {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem 1rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.status-cell {
    display: flex;
    justify-content: space-between;
    font-size: 0.6875rem;
}

.status-cell-label {
    color: var(--color-text-muted);
}

.status-cell-value {
    color: var(--color-text-secondary);
}

/* Card Footer */
.login-card-footer {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 1.25rem;
}

.login-card-footer svg {
    color: var(--color-primary);
    opacity: 0.8;
}

/* ==========================================================================
   RESPONSIVE DESIGN (MOBILE & TABLET)
   ========================================================================== */
@media (max-width: 480px) {
    .login-container {
        padding: 1.5rem 1rem;
    }
    
    .login-card {
        padding: 1.75rem 1.25rem;
        border-radius: 12px;
    }
    
    .login-input {
        font-size: 16px; /* Prevents auto-zoom in mobile Safari */
        height: 40px;
    }
    
    .login-submit {
        height: 40px;
    }
}
