/* ========================================
   PoPo Store - Login Page Styles
   Modern Dark Theme with Glassmorphism
======================================== */

/* CSS Variables */
:root {
    --bg-primary: #0a0a0f;
    --bg-card: rgba(22, 22, 31, 0.8);
    --accent-primary: #ff6b35;
    --accent-secondary: #f7c94b;
    --accent-gradient: linear-gradient(135deg, #ff6b35 0%, #f7c94b 100%);
    --text-primary: #ffffff;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-glow: 0 0 40px rgba(255, 107, 53, 0.15);
    --radius-md: 12px;
    --radius-xl: 24px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Body */
body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* ========================================
   Animated Background Effects
======================================== */

.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 107, 53, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(167, 85, 247, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(79, 172, 254, 0.08) 0%, transparent 60%);
    animation: gradientMove 15s ease-in-out infinite;
    pointer-events: none;
    will-change: transform;
}

@keyframes gradientMove {
    0%, 100% { transform: scale(1) rotate(0deg); }
    33% { transform: scale(1.1) rotate(5deg); }
    66% { transform: scale(0.95) rotate(-5deg); }
}

/* Particle Canvas */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Floating Orbs */
.orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.4;
    animation: orbFloat 20s ease-in-out infinite;
    pointer-events: none;
    will-change: transform;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, #ff6b35, #ff8c5a);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, #a855f7, #c084fc);
    bottom: -80px;
    right: -80px;
    animation-delay: -5s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    top: 50%;
    right: 10%;
    animation-delay: -10s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 30px) scale(1.02); }
}

/* ========================================
   Login Container - Glassmorphism
======================================== */

.login-container {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: 
        0 25px 50px -12px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    padding: 50px 40px;
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 10;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: containerReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
}

@keyframes containerReveal {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Glowing Border Effect */
.login-container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--accent-gradient);
    border-radius: calc(var(--radius-xl) + 2px);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.login-container:hover::before {
    opacity: 0.3;
}

/* ========================================
   Header / Brand
======================================== */

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.brand-logo {
    width: 90px;
    height: 90px;
    margin: 0 auto 20px;
    background: var(--accent-gradient);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
    box-shadow: 
        0 20px 40px -10px rgba(255, 107, 53, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: logoFloat 6s ease-in-out infinite, logoReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
    opacity: 0;
    transform: scale(0.5);
    position: relative;
    overflow: hidden;
}

.brand-logo::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        rgba(255, 255, 255, 0.3) 0%,
        rgba(255, 255, 255, 0.1) 40%,
        transparent 50%
    );
    animation: logoShine 3s ease-in-out infinite;
}

@keyframes logoReveal {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes logoShine {
    0%, 100% { transform: translate(-30%, -30%) rotate(0deg); }
    50% { transform: translate(30%, 30%) rotate(5deg); }
}

.login-header h1 {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2.8em;
    margin-bottom: 12px;
    font-weight: 800;
    letter-spacing: -1px;
    animation: textReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.3s forwards;
    opacity: 0;
    transform: translateY(20px);
}

.login-header p {
    color: var(--text-secondary);
    font-size: 1.1em;
    font-weight: 500;
    letter-spacing: 0.5px;
    animation: textReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes textReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Form Elements
======================================== */

.form-group {
    margin-bottom: 24px;
    animation: formReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

.form-group:nth-child(1) { animation-delay: 0.5s; }
.form-group:nth-child(2) { animation-delay: 0.6s; }

@keyframes formReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95em;
    letter-spacing: 0.3px;
    transition: color 0.3s ease;
}

.form-group label i {
    font-size: 14px;
    opacity: 0.7;
}

.input-wrapper {
    position: relative;
}

.form-group input {
    width: 100%;
    padding: 16px 20px;
    padding-right: 50px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(10, 10, 15, 0.6);
    color: var(--text-primary);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(10, 10, 15, 0.8);
    box-shadow: 
        0 0 0 4px rgba(255, 107, 53, 0.15),
        0 4px 20px rgba(255, 107, 53, 0.1);
}

.form-group input:focus + .input-icon {
    color: var(--accent-primary);
    transform: scale(1.1);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

/* Focus visible for accessibility */
.form-group input:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.input-icon {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    transition: all 0.3s ease;
    pointer-events: none;
}

/* Password Toggle Button */
.password-toggle {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    transition: all 0.3s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--accent-primary);
    transform: translateY(-50%) scale(1.1);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ========================================
   Submit Button
======================================== */

.btn-login {
    width: 100%;
    padding: 18px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
    margin-top: 12px;
    box-shadow: 0 10px 30px -10px rgba(255, 107, 53, 0.5);
    position: relative;
    overflow: hidden;
    animation: buttonReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.7s forwards;
    opacity: 0;
    transform: translateY(20px);
    min-height: 56px;
}

@keyframes buttonReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    transition: left 0.5s ease;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px -15px rgba(255, 107, 53, 0.6);
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:active {
    transform: translateY(-1px);
    box-shadow: 0 10px 20px -10px rgba(255, 107, 53, 0.5);
}

.btn-login:focus-visible {
    outline: 2px solid var(--accent-secondary);
    outline-offset: 2px;
}

/* Ripple Effect */
.btn-login .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Loading State */
.btn-login.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn-login.loading .btn-text {
    opacity: 0;
}

.btn-login .spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
    animation: none;
}

.btn-login.loading .spinner {
    opacity: 1;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ========================================
   Error Message
======================================== */

.error-message {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    text-align: center;
    font-weight: 500;
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    animation: errorShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97), errorReveal 0.4s ease forwards;
    opacity: 0;
    transform: translateY(-10px);
}

/* Accessibility: role="alert" styling */
.error-message[role="alert"] {
    animation: errorShake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97), errorReveal 0.4s ease forwards;
}

@keyframes errorReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes errorShake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
}

/* ========================================
   Footer
======================================== */

.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    animation: textReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards;
    opacity: 0;
    transform: translateY(20px);
}

.login-footer p {
    color: var(--text-muted);
    font-size: 0.9em;
}

.login-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.login-footer a:hover {
    color: var(--accent-secondary);
    text-shadow: 0 0 20px rgba(255, 107, 53, 0.5);
}

.login-footer a:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ========================================
   Responsive Design
======================================== */

/* Tablet */
@media (max-width: 768px) {
    .login-container {
        padding: 40px 30px;
        max-width: 90%;
    }
    
    .brand-logo {
        width: 80px;
        height: 80px;
        font-size: 36px;
    }
    
    .login-header h1 {
        font-size: 2.4em;
    }
}

/* Mobile */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }
    
    .login-container {
        padding: 35px 25px;
        max-width: 100%;
        border-radius: 20px;
    }
    
    .login-header h1 {
        font-size: 2.2em;
    }
    
    .brand-logo {
        width: 75px;
        height: 75px;
        font-size: 32px;
        border-radius: 20px;
    }
    
    .login-header {
        margin-bottom: 32px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group input {
        padding: 14px 18px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn-login {
        padding: 16px;
    }
    
    .orb {
        opacity: 0.2;
    }
}

/* Small Mobile */
@media (max-width: 380px) {
    .login-container {
        padding: 30px 20px;
    }
    
    .login-header h1 {
        font-size: 2em;
    }
    
    .brand-logo {
        width: 65px;
        height: 65px;
        font-size: 28px;
    }
}

/* ========================================
   Accessibility - Reduced Motion
======================================== */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .orb {
        animation: none;
    }
    
    .bg-gradient {
        animation: none;
    }
    
    .brand-logo::after {
        animation: none;
    }
}

/* ========================================
   Focus Styles for Keyboard Navigation
======================================== */

*:focus {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Skip Link for Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-primary);
    color: white;
    padding: 8px 16px;
    z-index: 100;
    transition: top 0.3s;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    top: 0;
}
