/* =====================================
   LOGIN PAGE STYLES
   Marleo-Handarbeit
   Mobile-First, Accessible, Modern UX
   ===================================== */

/* =====================================
   CSS VARIABLES
   ===================================== */
:root {
    --login-primary: #e91e8c;
    --login-primary-dark: #c4177a;
    --login-primary-light: #ff4da6;
    --login-secondary: #3399ff;
    --login-gradient: linear-gradient(135deg, #e91e8c 0%, #764ba2 50%, #3399ff 100%);
    --login-glass-bg: rgba(255, 255, 255, 0.95);
    --login-glass-border: rgba(200, 200, 220, 0.4);
    --login-text: #333333;
    --login-text-muted: #666666;
    --login-error: #ff6b9d;
    --login-success: #7fffd4;
    --login-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
}

/* =====================================
   BASE STYLES (Mobile-First)
   ===================================== */
body.login-page {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin: 0;
    position: relative;
    overflow-x: hidden;
    background: linear-gradient(135deg, #fdf2f8 0%, #f5f3ff 50%, #eff6ff 100%);
}

/* =====================================
   ANIMATED BACKGROUND
   ===================================== */
body.login-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(233, 30, 140, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(51, 153, 255, 0.06) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(118, 75, 162, 0.15) 0%, transparent 50%);
    z-index: -2;
    animation: bgPulse 15s ease-in-out infinite;
}

@keyframes bgPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* Animated Circles */
.circle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.6;
    animation: floatCircle 20s infinite ease-in-out;
}

.circle:nth-child(1) {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(233, 30, 140, 0.15) 0%, transparent 70%);
    top: -150px;
    right: -100px;
    filter: blur(60px);
    animation-delay: 0s;
}

.circle:nth-child(2) {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(51, 153, 255, 0.12) 0%, transparent 70%);
    bottom: -200px;
    left: -150px;
    filter: blur(80px);
    animation-delay: -5s;
}

.circle:nth-child(3) {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.15) 0%, transparent 70%);
    top: 30%;
    left: 10%;
    filter: blur(50px);
    animation-delay: -10s;
}

.circle:nth-child(4) {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(233, 30, 140, 0.1) 0%, transparent 70%);
    bottom: 20%;
    right: 15%;
    filter: blur(70px);
    animation-delay: -3s;
}

.circle:nth-child(5) {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(51, 153, 255, 0.12) 0%, transparent 70%);
    top: 60%;
    right: 30%;
    filter: blur(55px);
    animation-delay: -8s;
}

.circle:nth-child(6) {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.12) 0%, transparent 70%);
    top: 15%;
    left: 40%;
    filter: blur(65px);
    animation-delay: -12s;
}

@keyframes floatCircle {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(30px, -40px) scale(1.1);
    }
    50% {
        transform: translate(-20px, 20px) scale(0.95);
    }
    75% {
        transform: translate(15px, 30px) scale(1.05);
    }
}

/* =====================================
   GLASS CONTAINER
   ===================================== */
.glass-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    background: var(--login-glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 24px;
    border: 1.5px solid var(--login-glass-border);
    box-shadow: var(--login-shadow);
    overflow: hidden;
    animation: containerSlideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes containerSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Animated gradient border */
.glass-container::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, rgba(233, 30, 140, 0.25) 0%, rgba(118, 75, 162, 0.15) 50%, rgba(51, 153, 255, 0.25) 100%);
    background-size: 300% 300%;
    border-radius: 26px;
    z-index: -1;
    opacity: 0.4;
    animation: gradientBorder 6s ease infinite;
}

@keyframes gradientBorder {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* =====================================
   LOGIN HEADER
   ===================================== */
.login-header {
    text-align: center;
    padding: 2rem 1.5rem 1.5rem;
    background: rgba(255, 255, 255, 1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--login-text);
    margin: 0 0 0.5rem 0;
    background: linear-gradient(135deg, rgba(233, 30, 140, 0.25) 0%, rgba(118, 75, 162, 0.15) 50%, rgba(51, 153, 255, 0.25) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: textGradient 4s ease infinite;
}

@keyframes textGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.login-header p {
    font-size: 0.95rem;
    color: var(--login-text-muted);
    margin: 0;
    font-weight: 300;
}

/* =====================================
   FORM STYLES
   ===================================== */
.glass-container form {
    padding: 2.5rem 2.5rem;
}

/* =====================================
   INPUT GROUPS
   ===================================== */
.input-group {
    margin-bottom: 1.25rem;
    position: relative;
}

.input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--login-text);
    margin-bottom: 0.5rem;
    letter-spacing: 0.3px;
}

.input-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1rem; /* 16px prevents iOS zoom */
    font-family: inherit;
    color: var(--login-text);
    background: rgba(255, 255, 255, 0.9);
    border: 1.5px solid var(--login-glass-border);
    border-radius: 12px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-appearance: none;
    appearance: none;
}

.input-group input::placeholder {
    color: #999999;
}

/* Focus States - Accessible */
.input-group input:focus {
    border-color: var(--login-primary);
    background: rgba(255, 255, 255, 1);
    box-shadow: 
        0 0 0 3px rgba(233, 30, 140, 0.08),
        0 4px 12px rgba(233, 30, 140, 0.15);
    transform: translateY(-1px);
}

/* Password Field with Toggle */
.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 3rem;
}

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--login-text-muted);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover,
.password-toggle:focus {
    color: var(--login-primary);
    outline: none;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

/* =====================================
   REMEMBER ME & FORGOT PASSWORD
   ===================================== */
.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--login-text-muted);
    transition: color 0.2s;
}

.remember-me:hover {
    color: var(--login-text);
}

.remember-me input[type=checkbox] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--login-primary);
}

.forgot-password {
    font-size: 0.875rem;
    color: var(--login-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.forgot-password:hover,
.forgot-password:focus {
    color: var(--login-primary-light);
    text-decoration: underline;
    outline: none;
}

/* =====================================
   LOGIN BUTTON
   ===================================== */
.login-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, rgba(233, 30, 140, 0.25) 0%, rgba(118, 75, 162, 0.15) 50%, rgba(51, 153, 255, 0.25) 100%);
    background-size: 200% 100%;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 20px rgba(233, 30, 140, 0.35);
}

/* Shine effect */
.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
    transition: left 0.5s;
}

.login-btn:hover {
    background-position: 100% 0;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(233, 30, 140, 0.45);
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:focus {
    outline: none;
    box-shadow: 
        0 0 0 3px rgba(233, 30, 140, 0.1),
        0 10px 30px rgba(233, 30, 140, 0.45);
}

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

/* Loading State */
.login-btn.loading {
    pointer-events: none;
    opacity: 0.85;
}

.login-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: btnSpinner 0.8s linear infinite;
    margin-left: 0.5rem;
}

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

/* =====================================
   MESSAGES
   ===================================== */
.error-message {
    background: rgba(220, 53, 69, 0.12);
    border: 1px solid rgba(255, 107, 157, 0.4);
    color: var(--login-error);
    padding: 0.875rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: shake 0.4s ease-in-out;
}

.error-message::before {
    content: '!';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(255, 107, 157, 0.3);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

.success-message {
    background: rgba(40, 167, 69, 0.12);
    border: 1px solid rgba(127, 255, 212, 0.4);
    color: var(--login-success);
    padding: 0.875rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.success-message::before {
    content: '\2713';
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(127, 255, 212, 0.3);
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* =====================================
   LINKS
   ===================================== */
.register-link {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.9rem;
    color: var(--login-text-muted);
}

.register-link a {
    color: var(--login-primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.register-link a:hover,
.register-link a:focus {
    color: var(--login-primary-light);
    text-decoration: underline;
    outline: none;
}

.back-to-shop {
    text-align: center;
    margin-top: 1rem;
}

.back-to-shop a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--login-text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.back-to-shop a:hover,
.back-to-shop a:focus {
    color: var(--login-text);
    outline: none;
}

/* =====================================
   TABLET STYLES (768px+)
   ===================================== */
@media (min-width: 768px) {
    body.login-page {
        padding: 2rem;
    }
    
    .glass-container {
        max-width: 450px;
        border-radius: 28px;
    }
    
    .login-header {
        padding: 2.5rem 2rem 1.75rem;
    }
    
    .login-header h2 {
        font-size: 2rem;
    }
    
    .glass-container form {
        padding: 2rem;
    }
    
    .input-group {
        margin-bottom: 1.5rem;
    }
    
    .input-group input {
        padding: 1rem 1.25rem;
    }
    
    .login-btn {
        padding: 1.125rem;
        font-size: 1.05rem;
    }
}

/* =====================================
   DESKTOP STYLES (1024px+)
   ===================================== */
@media (min-width: 1024px) {
    .glass-container {
        max-width: 480px;
    }
    
    /* Circles more visible on desktop */
    .circle {
        opacity: 0.4;
    }
}

/* =====================================
   ACCESSIBILITY
   ===================================== */
/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .circle {
        animation: none;
        opacity: 0.4;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .glass-container {
        background: rgba(0, 0, 0, 0.9);
        border-color: white;
    }
    
    .input-group input {
        background: rgba(0, 0, 0, 0.8);
        border-color: white;
    }
    
    .login-btn {
        background: var(--login-primary);
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--login-primary);
    outline-offset: 2px;
}

/* Skip to content (add to HTML if needed) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--login-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 8px 8px;
    z-index: 100;
    text-decoration: none;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

/* =====================================
   HIDE DEFAULT HEADER/FOOTER
   (for login page only)
   ===================================== */
body.login-page .header,
body.login-page .footer,
body.login-page .site-header,
body.login-page .site-footer,
body.login-page nav.main-nav {
    display: none !important;
}

/* Legal Links Footer */
.legal-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--login-glass-border, rgba(200, 200, 220, 0.3));
}

.legal-links a {
    color: var(--login-text-muted, #666666);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.3s ease;
}

.legal-links a:hover {
    color: var(--login-primary, #e91e63);
    text-decoration: underline;
}

@media (max-width: 480px) {
    .legal-links {
        flex-wrap: wrap;
        gap: 10px 15px;
    }
    
    .legal-links a {
        font-size: 11px;
    }
}
