/* ===========================
   CSS VARIABLES & RESET
   =========================== */
:root {
    /* Color Scheme - As Required */
    --primary: #2563EB;
    --background: #F8FAFC;
    --text: #0F172A;
    --success: #22C55E;
    --error: #EF4444;
    
    /* Additional Utility Colors */
    --primary-hover: #1D4ED8;
    --primary-light: #DBEAFE;
    --border: #E2E8F0;
    --white: #FFFFFF;
    --gray-100: #F1F5F9;
    --gray-200: #E2E8F0;
    --gray-300: #CBD5E1;
    --gray-400: #94A3B8;
    --gray-500: #64748B;
    --gray-600: #475569;
    
    /* Typography */
    --font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

/* ===========================
   BACKGROUND DECORATION
   =========================== */
.background-decoration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.05;
    animation: float 20s infinite ease-in-out;
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: var(--primary);
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.circle-2 {
    width: 300px;
    height: 300px;
    background: var(--success);
    bottom: -80px;
    right: -80px;
    animation-delay: 5s;
}

.circle-3 {
    width: 250px;
    height: 250px;
    background: var(--primary);
    top: 50%;
    right: 10%;
    animation-delay: 10s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    33% {
        transform: translateY(-30px) rotate(5deg);
    }
    66% {
        transform: translateY(30px) rotate(-5deg);
    }
}

/* ===========================
   LOGIN CONTAINER & CARD
   =========================== */
.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    padding: var(--spacing-md);
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-xl);
    transition: var(--transition);
}

.login-card:hover {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

/* ===========================
   BRAND HEADER
   =========================== */
.brand-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.brand-logo {
    display: inline-flex;
    margin-bottom: var(--spacing-sm);
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.brand-name {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--spacing-xs);
    letter-spacing: -0.5px;
}

.brand-tagline {
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ===========================
   WELCOME SECTION
   =========================== */
.welcome-section {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.welcome-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: var(--spacing-xs);
}

.welcome-subtitle {
    font-size: 0.9375rem;
    color: var(--gray-500);
}

/* ===========================
   LOGIN FORM
   =========================== */
.login-form {
    margin-bottom: var(--spacing-md);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--spacing-xs);
}

/* Input Wrapper */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--gray-400);
    pointer-events: none;
    transition: var(--transition-fast);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 3rem;
    font-size: 0.9375rem;
    font-family: var(--font-family);
    color: var(--text);
    background: var(--gray-100);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input:focus {
    background: var(--white);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-input:focus + .input-icon {
    color: var(--primary);
}

/* Password Input with Toggle */
.password-input {
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0.25rem;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover {
    color: var(--primary);
}

.toggle-password:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Error Messages */
.error-message {
    display: block;
    font-size: 0.8125rem;
    color: var(--error);
    margin-top: var(--spacing-xs);
    font-weight: 500;
    min-height: 1.25rem;
    animation: shakeError 0.3s ease-out;
}

@keyframes shakeError {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.form-input.error {
    border-color: var(--error);
    background: #FEF2F2;
}

.form-input.error:focus {
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

/* ===========================
   FORM OPTIONS
   =========================== */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

/* Custom Checkbox */
.checkbox-container {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.checkbox-container input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkbox-checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--gray-100);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    margin-right: var(--spacing-xs);
    transition: var(--transition);
    position: relative;
}

.checkbox-checkmark::after {
    content: '';
    position: absolute;
    width: 5px;
    height: 9px;
    border: solid var(--white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transition: var(--transition);
}

.checkbox-container input:checked ~ .checkbox-checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-container input:checked ~ .checkbox-checkmark::after {
    transform: rotate(45deg) scale(1);
}

.checkbox-container:hover .checkbox-checkmark {
    border-color: var(--primary);
}

.checkbox-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    font-weight: 500;
}

/* Forgot Password Link */
.forgot-password-link {
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition-fast);
}

.forgot-password-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ===========================
   LOGIN BUTTON
   =========================== */
.login-button {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-family);
    color: var(--white);
    background: var(--primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}

.login-button:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    background: var(--gray-300);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.button-icon {
    transition: var(--transition);
}

.login-button:hover .button-icon {
    transform: translateX(4px);
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-sm);
    color: var(--gray-500);
    font-size: 0.875rem;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===========================
   DIVIDER
   =========================== */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: var(--spacing-lg) 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider-text {
    padding: 0 var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--gray-500);
    font-weight: 500;
}

/* ===========================
   SOCIAL LOGIN
   =========================== */
.social-login {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.social-button {
    padding: 0.875rem 1rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: var(--font-family);
    color: var(--text);
    background: var(--white);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs);
    transition: var(--transition);
}

.social-button:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.social-button:active {
    transform: translateY(0);
}

/* ===========================
   SIGNUP SECTION
   =========================== */
.signup-section {
    text-align: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border);
}

.signup-text {
    font-size: 0.9375rem;
    color: var(--gray-600);
}

.signup-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition-fast);
}

.signup-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ===========================
   FOOTER
   =========================== */
.login-footer {
    text-align: center;
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md) 0;
}

.login-footer p {
    font-size: 0.8125rem;
    color: var(--gray-500);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.login-footer a:hover {
    text-decoration: underline;
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */
@media (max-width: 640px) {
    .login-container {
        padding: var(--spacing-sm);
    }
    
    .login-card {
        padding: var(--spacing-lg);
    }
    
    .brand-name {
        font-size: 1.75rem;
    }
    
    .welcome-title {
        font-size: 1.5rem;
    }
    
    .social-login {
        grid-template-columns: 1fr;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    .circle-1,
    .circle-2,
    .circle-3 {
        display: none;
    }
}

/* ===========================
   ACCESSIBILITY
   =========================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}