/**
 * Login/Signup Page Styles
 * Professional, modern design following industry best practices
 */

/* ============================================
   BASE LAYOUT
   ============================================ */

* {
    box-sizing: border-box;
}

body.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    margin: 0;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow: hidden;
}

[data-theme="dark"] body.login-page {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* Animated background pattern */
body.login-page::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
    animation: backgroundMove 20s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

[data-theme="dark"] body.login-page::before {
    background: 
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%);
}

@keyframes backgroundMove {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }
    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

/* Subtle grid pattern overlay */
body.login-page::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: 0;
    pointer-events: none;
    opacity: 0.5;
}

[data-theme="dark"] body.login-page::after {
    opacity: 0.3;
}

/* ============================================
   AUTH CONTAINER
   ============================================ */

.auth-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    overflow: visible;
    padding: 2rem;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

[data-theme="dark"] .auth-box {
    background: rgba(30, 30, 46, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-box:hover {
    transform: translateY(-1px);
    box-shadow: 
        0 25px 70px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.25) inset;
}

[data-theme="dark"] .auth-box:hover {
    box-shadow: 
        0 25px 70px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

/* ============================================
   HEADER & LOGO
   ============================================ */

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.logo {
    margin-bottom: 1rem;
    animation: fadeInDown 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo img {
    max-width: 160px;
    height: auto;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
    transition: transform 0.3s ease;
}

.logo img:hover {
    transform: scale(1.05);
}

[data-theme="dark"] .logo img {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   TABS
   ============================================ */

.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 1.25rem;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    position: relative;
}

[data-theme="dark"] .tabs {
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    text-transform: none;
    letter-spacing: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    border-radius: 8px;
    flex: 1;
    z-index: 1;
}

.tab-btn:hover {
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .tab-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.tab-btn.active {
    color: #fff;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

[data-theme="dark"] .tab-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* ============================================
   FORMS
   ============================================ */

.auth-form {
    display: none;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.auth-form.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   FORM GROUPS & INPUTS
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-of-type {
    margin-bottom: 0.75rem;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    padding: 0 0.875rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    margin-bottom: 0;
    height: 48px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .input-group {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.input-group:hover {
    border-color: rgba(102, 126, 234, 0.4);
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.1);
}

[data-theme="dark"] .input-group:hover {
    border-color: rgba(99, 102, 241, 0.5);
    background-color: rgba(255, 255, 255, 0.08);
}

.input-group:focus-within {
    border-color: #667eea;
    background-color: #fff;
    box-shadow: 
        0 0 0 3px rgba(102, 126, 234, 0.12),
        0 2px 8px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

[data-theme="dark"] .input-group:focus-within {
    border-color: #6366f1;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 0 0 3px rgba(99, 102, 241, 0.2),
        0 2px 8px rgba(99, 102, 241, 0.25);
}

.input-group i {
    color: #6b7280;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 0.5rem;
}

[data-theme="dark"] .input-group i {
    color: #9ca3af;
}

.input-group:focus-within i {
    color: #667eea;
    transform: scale(1.05);
}

[data-theme="dark"] .input-group:focus-within i {
    color: #6366f1;
}

.input-group input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 0.9375rem;
    color: #111827;
    background: none;
    padding: 0;
    width: 100%;
    height: 100%;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    font-weight: 400;
}

[data-theme="dark"] .input-group input {
    color: #f9fafb;
}

.input-group input::placeholder {
    color: transparent;
}

.input-group .toggle-password {
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.25rem;
    border-radius: 6px;
    margin-left: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    width: 28px;
    background: none;
    border: none;
    outline: none;
    flex-shrink: 0;
}

.input-group .toggle-password:hover {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
}

[data-theme="dark"] .input-group .toggle-password:hover {
    background-color: rgba(99, 102, 241, 0.15);
}

.input-group .toggle-password i {
    font-size: 1rem;
    width: auto;
    margin: 0;
}

/* Input label (floating) */
.input-group label {
    position: absolute;
    left: 3.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    font-size: 0.9375rem;
    background: transparent;
    padding: 0 0.25rem;
    font-weight: 400;
    z-index: 1;
}

[data-theme="dark"] .input-group label {
    color: #9ca3af;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: -0.5rem;
    left: 0.875rem;
    font-size: 0.6875rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    padding: 0 0.375rem;
    border-radius: 4px;
    font-weight: 600;
    transform: translateY(0);
}

[data-theme="dark"] .input-group input:focus + label,
[data-theme="dark"] .input-group input:not(:placeholder-shown) + label {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Input validation states */
.input-group.valid {
    border-color: #10b981;
    background-color: rgba(16, 185, 129, 0.05);
}

[data-theme="dark"] .input-group.valid {
    background-color: rgba(16, 185, 129, 0.1);
}

.input-group.valid i {
    color: #10b981;
}

.input-group.invalid {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

[data-theme="dark"] .input-group.invalid {
    background-color: rgba(239, 68, 68, 0.1);
}

.input-group.invalid i {
    color: #ef4444;
}

/* Error animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.input-group.error {
    animation: shake 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
    border-color: #ef4444;
}

/* ============================================
   FORM OPTIONS
   ============================================ */

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.875rem 0 1rem 0;
    font-size: 0.8125rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #6b7280;
    cursor: pointer;
    user-select: none;
}

[data-theme="dark"] .remember-me {
    color: #9ca3af;
}

.remember-me input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #667eea;
}

.forgot-password {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s ease;
    font-weight: 500;
}

[data-theme="dark"] .forgot-password {
    color: #6366f1;
}

.forgot-password:hover {
    color: #5568d3;
    text-decoration: underline;
}

[data-theme="dark"] .forgot-password:hover {
    color: #4f46e5;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    text-decoration: none;
    line-height: 1.5;
    box-sizing: border-box;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.35),
        0 0 0 0 rgba(102, 126, 234, 0.5);
    font-weight: 600;
    letter-spacing: 0.2px;
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    box-shadow: 
        0 4px 12px rgba(99, 102, 241, 0.45),
        0 0 0 0 rgba(99, 102, 241, 0.6);
}

.btn-primary::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 ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d8f 100%);
    box-shadow: 
        0 6px 16px rgba(102, 126, 234, 0.45),
        0 0 0 3px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-primary:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    box-shadow: 
        0 6px 16px rgba(99, 102, 241, 0.55),
        0 0 0 3px rgba(99, 102, 241, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 6px rgba(102, 126, 234, 0.35),
        0 0 0 2px rgba(102, 126, 234, 0.15);
}

.btn-block {
    width: 100%;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    height: 44px;
    border-radius: 10px;
    font-weight: 600;
}

/* ============================================
   SOCIAL LOGIN
   ============================================ */

.social-login {
    margin-top: 1rem;
    text-align: center;
    padding: 0;
}

.social-login p {
    color: #6b7280;
    margin-bottom: 0.875rem;
    position: relative;
    font-size: 0.8125rem;
}

[data-theme="dark"] .social-login p {
    color: #9ca3af;
}

.social-login p::before,
.social-login p::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .social-login p::before,
[data-theme="dark"] .social-login p::after {
    background: rgba(255, 255, 255, 0.1);
}

.social-login p::before {
    left: 0;
}

.social-login p::after {
    right: 0;
}

.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    width: 100%;
    padding: 0.625rem 1rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 10px;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    height: 44px;
}

[data-theme="dark"] .google-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
    color: #f9fafb;
}

.google-btn:hover {
    background: #fff;
    border-color: rgba(102, 126, 234, 0.3);
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.08),
        0 0 0 2px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

[data-theme="dark"] .google-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(99, 102, 241, 0.4);
}

.google-btn img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ============================================
   PASSWORD REQUIREMENTS
   ============================================ */

.password-requirements {
    margin: 0.5rem 0 0 0;
    padding: 0.75rem;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .password-requirements {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.password-requirements small {
    display: block;
    color: #6b7280;
    font-size: 0.75rem;
    margin: 0.25rem 0;
    transition: color 0.2s ease;
}

[data-theme="dark"] .password-requirements small {
    color: #9ca3af;
}

.password-requirements small.requirement {
    position: relative;
    padding-left: 1.25rem;
}

.password-requirements small.requirement::before {
    content: '○';
    position: absolute;
    left: 0;
    color: #9ca3af;
}

.password-requirements small.requirement.met {
    color: #10b981;
}

.password-requirements small.requirement.met::before {
    content: '✓';
    color: #10b981;
}

/* ============================================
   ALERTS
   ============================================ */

.alert-container {
    margin-bottom: 1rem;
    width: 100%;
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    border: 1px solid;
    animation: slideInDown 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.12);
}

[data-theme="dark"] .alert-danger {
    background-color: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.2);
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #059669;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.12);
}

[data-theme="dark"] .alert-success {
    background-color: rgba(16, 185, 129, 0.2);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}

.alert i {
    font-size: 0.9375rem;
    flex-shrink: 0;
}

.alert-link {
    color: inherit;
    text-decoration: underline;
    font-weight: 500;
    opacity: 0.9;
}

.alert-link:hover {
    opacity: 1;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    body.login-page {
        padding: 1rem;
        align-items: flex-start;
        padding-top: 1.5rem;
        overflow-y: auto;
    }

    .auth-container {
        max-width: 100%;
    }

    .auth-box {
        padding: 1.5rem 1.25rem;
        border-radius: 16px;
    }

    .logo {
        margin-bottom: 0.875rem;
    }

    .logo img {
        max-width: 140px;
    }

    .tabs {
        margin-bottom: 1rem;
    }

    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
    }

    .form-group {
        margin-bottom: 0.875rem;
    }

    .input-group {
        padding: 0 0.75rem;
        height: 44px;
    }

    .input-group input {
        font-size: 0.875rem;
    }

    .input-group i {
        font-size: 0.9375rem;
        width: 18px;
    }

    .input-group label {
        font-size: 0.875rem;
        left: 3rem;
    }

    .input-group input:focus + label,
    .input-group input:not(:placeholder-shown) + label {
        font-size: 0.625rem;
        left: 0.75rem;
    }

    .form-options {
        margin: 0.75rem 0 0.875rem 0;
        font-size: 0.75rem;
    }

    .btn-block {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
        height: 42px;
    }

    .social-login {
        margin-top: 0.875rem;
    }

    .social-login p {
        margin-bottom: 0.75rem;
        font-size: 0.75rem;
    }

    .google-btn {
        padding: 0.625rem 1rem;
        height: 42px;
        font-size: 0.8125rem;
    }
}

@media (max-width: 480px) {
    body.login-page {
        padding: 0.75rem;
        padding-top: 1rem;
    }

    .auth-box {
        padding: 1.25rem 1rem;
        border-radius: 14px;
    }

    .logo img {
        max-width: 120px;
    }

    .tabs {
        margin-bottom: 0.875rem;
    }

    .form-group {
        margin-bottom: 0.75rem;
    }

    .input-group {
        height: 42px;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.625rem;
        margin: 0.625rem 0 0.75rem 0;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */

.auth-form.active {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
