/* ===========================
   Reset and Base Styles
   =========================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette */
    --primary-color: #0078d4;
    --primary-hover: #106ebe;
    --secondary-color: #2b88d8;
    --success-color: #107c10;
    --error-color: #d13438;
    --text-primary: #323130;
    --text-secondary: #605e5c;
    --border-color: #e1dfdd;
    --background-light: #faf9f8;
    --background-white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    
    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ===========================
   Login Container
   =========================== */
.login-container {
    width: 100%;
    max-width: 440px;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-box {
    background: var(--background-white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg), 0 16px 64px rgba(0, 0, 0, 0.2);
    padding: 48px 40px;
}

/* ===========================
   Login Header
   =========================== */
.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
}

/* ===========================
   Login Form
   =========================== */
.login-form {
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 24px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.1);
}

.form-group input::placeholder {
    color: #a19f9d;
}

.form-group input[type="password"] {
    padding-right: 48px;
}

/* Toggle Password Button */
.toggle-password {
    position: absolute;
    right: 12px;
    bottom: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.toggle-password:hover {
    opacity: 1;
}

/* Error Message */
.error-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fef6f6;
    border: 1px solid #f1aeb5;
    border-radius: 8px;
    color: var(--error-color);
    font-size: 14px;
    margin-bottom: 20px;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.error-icon {
    font-size: 18px;
}

/* Form Options */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Login Button */
.login-button {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 120, 212, 0.3);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Login Spinner */
.login-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===========================
   Login Footer
   =========================== */
.login-footer {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.login-footer a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: opacity var(--transition-fast);
}

.login-footer a:hover {
    opacity: 0.7;
}

.footer-logo {
    height: 30px;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 480px) {
    .login-box {
        padding: 36px 24px;
    }

    .login-header h1 {
        font-size: 24px;
    }

    .login-logo {
        width: 64px;
        height: 64px;
    }
}

/* ===========================
   Accessibility
   =========================== */
.login-button:focus,
.form-group input:focus,
.toggle-password:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Microsoft Button Styling */
.microsoft-button {
    background: #2f2f2f !important;
    border: 1px solid #8c8c8c;
}

.microsoft-button:hover {
    background: #3f3f3f !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
