/* ========================================
   LayerShield - Login Styles
   ======================================== */

:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-card: #18181b;
    --bg-input: #0f0f11;
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --text-primary: #fafafa;
    --text-secondary: #71717a;
    --text-muted: #52525b;
    --accent: #e4e4e7;
    --accent-glow: rgba(228, 228, 231, 0.15);
    --accent-primary: #e4e4e7;
    --accent-secondary: #a1a1aa;
}

/* ========================================
   Preloader
   ======================================== */

.preloader {
    position: fixed;
    inset: 0;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hide {
    opacity: 0;
    visibility: hidden;
}

.preloader-content {
    text-align: center;
    animation: preloaderFadeIn 0.5s ease-out;
}

@keyframes preloaderFadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.preloader-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 24px;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 24px;
    animation: preloaderPulse 1.5s ease-in-out infinite;
}

@keyframes preloaderPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.preloader-bar {
    width: 180px;
    height: 3px;
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
    overflow: hidden;
    margin: 0 auto;
}

.preloader-progress {
    height: 100%;
    width: 30%;
    background: var(--text-primary);
    border-radius: 3px;
    animation: preloaderLoad 1.2s ease-in-out infinite;
}

@keyframes preloaderLoad {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(200%); }
    100% { transform: translateX(400%); }
}

/* ========================================
   Base Reset
   ======================================== */

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

html, body {
    height: 100%;
}

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

/* ========================================
   Background Effects
   ======================================== */

/* Subtle grid pattern */
body::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

/* Ambient glow */
.glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(200px);
    opacity: 0.4;
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
}

.glow-1 {
    background: radial-gradient(circle, rgba(100,100,120,0.3) 0%, transparent 70%);
    top: -200px;
    left: -200px;
}

.glow-2 {
    background: radial-gradient(circle, rgba(80,80,100,0.2) 0%, transparent 70%);
    bottom: -250px;
    right: -200px;
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ========================================
   Layout
   ======================================== */

.login-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 0 24px;
    z-index: 10;
}

/* ========================================
   Brand / Header
   ======================================== */

.brand {
    text-align: center;
    margin-bottom: 48px;
    animation: fadeUp 0.8s ease-out;
}

.brand h1 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 32px;
    font-weight: 500;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.brand p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ========================================
   Login Card
   ======================================== */

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 40px 36px;
    backdrop-filter: blur(20px);
    box-shadow: 
        0 4px 24px rgba(0,0,0,0.3),
        0 1px 2px rgba(0,0,0,0.2),
        inset 0 1px 0 rgba(255,255,255,0.03);
    animation: fadeUp 0.8s ease-out 0.1s both;
}

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

/* ========================================
   Form Elements
   ======================================== */

.form-group {
    margin-bottom: 12px;
    animation: fadeUp 0.6s ease-out 0.2s both;
}

.form-group:nth-child(2) {
    animation-delay: 0.3s;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    transition: color 0.3s ease;
    pointer-events: none;
}

.form-input {
    width: 100%;
    height: 52px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 0 16px 0 48px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:hover {
    border-color: var(--border-hover);
    background: rgba(15, 15, 17, 0.8);
}

.form-input:focus {
    border-color: rgba(255,255,255,0.2);
    background: var(--bg-input);
    box-shadow: 
        0 0 0 3px var(--accent-glow),
        0 0 20px rgba(228, 228, 231, 0.05);
}

.form-input:focus + .input-icon,
.form-input:focus ~ .input-icon {
    color: var(--text-secondary);
}

.form-input.valid {
    border-color: #22c55e;
}

.form-input.error {
    border-color: #ef4444;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

.form-error {
    display: block;
    font-size: 12px;
    color: #ef4444;
    margin-top: 6px;
    min-height: 18px;
}

/* ========================================
   Login Error Message
   ======================================== */

.login-error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    padding: 11px 16px;
    font-size: 13px;
    color: #ef4444;
    margin-bottom: 16px;
    text-align: center;
    animation: fadeUp 0.4s ease-out;
}

/* ========================================
   Submit Button
   ======================================== */

.submit-btn {
    width: 100%;
    height: 52px;
    background: var(--text-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 12px;
    position: relative;
    overflow: hidden;
    animation: fadeUp 0.6s ease-out 0.4s both;
}

.submit-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 24px rgba(0,0,0,0.4),
        0 0 0 1px rgba(255,255,255,0.1);
}

.submit-btn:hover::before {
    opacity: 1;
}

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

.submit-btn span {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.submit-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.submit-btn:hover svg {
    transform: translateX(3px);
}

/* ========================================
   Footer Links
   ======================================== */

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 28px;
    animation: fadeUp 0.6s ease-out 0.5s both;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: var(--text-secondary);
}

/* ========================================
   Version Badge
   ======================================== */

.version {
    position: fixed;
    bottom: 24px;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    animation: fadeUp 0.6s ease-out 0.6s both;
}

/* ========================================
   Utilities
   ======================================== */

::selection {
    background: rgba(228, 228, 231, 0.2);
    color: var(--text-primary);
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 480px) {
    .login-card {
        padding: 32px 24px;
        border-radius: 16px;
    }

    .brand h1 {
        font-size: 26px;
    }
}