﻿/* Login Page Styles - Modern Clean Design */

/* CSS Variables for easy theming */
:root {
    --primary-green: #10B981;
    --primary-green-hover: #059669;
    --primary-green-disabled: rgba(16, 185, 129, 0.3);
    --primary-blue: #3B82F6;
    --primary-blue-hover: #2563EB;
    --error-red: #EF4444;
    --error-red-light: #FEE2E2;
    --border-gray: #D1D5DB;
    --input-bg: #F3F4F6;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --focus-ring: #3B82F6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --spacing-unit: 8px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --input-bg: #374151;
        --text-primary: #F9FAFB;
        --text-secondary: #D1D5DB;
        --border-gray: #4B5563;
    }
}

/* Reset and base styles for login page */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #F9FAFB 0%, #E5E7EB 100%);
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Sticky Header */
.login-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: 64px;
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-gray);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    padding: 0 calc(var(--spacing-unit) * 3);
}

.login-header-content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.login-header-left {
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit) * 2);
}

.login-logo {
    height: 28px;
    width: auto;
}

.login-product-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.login-header-right {
    display: flex;
    gap: calc(var(--spacing-unit) * 3);
}

.login-header-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.login-header-link:hover {
    color: var(--primary-blue);
}

/* Main Content Area */
.login-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--spacing-unit) * 4);
}

/* Content without header - full viewport height */
.login-content-no-header {
    min-height: 100vh;
}

/* Login Card */
.login-card {
    width: 100%;
    max-width: 480px;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: calc(var(--spacing-unit) * 4);
    border: none;
}

.login-card-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 calc(var(--spacing-unit) * 4) 0;
    text-align: center;
}

/* Form Groups */
.login-form-group {
    margin-bottom: calc(var(--spacing-unit) * 3);
}

.login-form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #1F2937;
    margin-bottom: calc(var(--spacing-unit));
}

/* Input Container with Adornments */
.login-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.login-form-input {
    width: 100%;
    height: 48px;
    padding: 0 calc(var(--spacing-unit) * 2);
    padding-right: calc(var(--spacing-unit) * 6); /* Space for adornments */
    font-size: 16px;
    font-family: inherit;
    color: #1F2937;
    background: #F3F4F6;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    transition: all 0.2s ease;
    outline: none;
}

.login-form-input::placeholder {
    color: #9CA3AF;
}

.login-form-input:focus {
    background: #FFFFFF;
    border-color: #10B981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.login-form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Input States */
.login-form-input.is-invalid {
    border-color: var(--error-red);
    background: var(--error-red-light);
}

.login-form-input.is-invalid:focus {
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
    border-color: var(--error-red);
}

.login-form-input[aria-invalid="true"] {
    border-color: var(--error-red);
}

/* Input Adornments */
.login-input-adornment {
    position: absolute;
    right: calc(var(--spacing-unit) * 2);
    display: flex;
    align-items: center;
    gap: calc(var(--spacing-unit));
}

.login-error-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--error-red);
    animation: pulse-error 2s infinite;
}

@keyframes pulse-error {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.login-toggle-password {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s ease;
    outline: none;
}

.login-toggle-password:hover {
    color: var(--text-primary);
}

.login-toggle-password:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

.login-toggle-password svg {
    width: 20px;
    height: 20px;
}

/* Validation/Helper Text */
.login-helper-text {
    font-size: 13px;
    margin-top: calc(var(--spacing-unit));
    display: block;
}

.login-helper-text.error {
    color: var(--error-red);
}

.login-helper-text.info {
    color: var(--text-secondary);
}

/* Error Alert */
.login-alert {
    padding: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 3);
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.login-alert.error {
    background: var(--error-red-light);
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.login-alert-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.login-alert-close:hover {
    opacity: 1;
}

/* Primary Submit Button */
.login-btn-submit {
    width: 100%;
    height: 48px;
    padding: 0 calc(var(--spacing-unit) * 3);
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: #FFFFFF;
    background: var(--primary-green);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    margin-top: calc(var(--spacing-unit) * 2);
}

.login-btn-submit:hover:not(:disabled) {
    background: var(--primary-green-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.login-btn-submit:active:not(:disabled) {
    transform: translateY(0);
}

.login-btn-submit:focus {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.login-btn-submit:disabled {
    background: var(--primary-green-disabled);
    cursor: not-allowed;
    transform: none;
}

/* Forgot Password Link */
.login-forgot-password {
    display: block;
    text-align: center;
    margin-top: calc(var(--spacing-unit) * 3);
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.login-forgot-password:hover {
    color: var(--primary-blue-hover);
    text-decoration: underline;
}

.login-forgot-password:focus {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Responsive Design */
@media (max-width: 640px) {
    .login-header {
        padding: 0 calc(var(--spacing-unit) * 2);
    }

    .login-header-right {
        display: none;
    }

    .login-content {
        padding: calc(var(--spacing-unit) * 2);
    }

    .login-card {
        padding: calc(var(--spacing-unit) * 3);
        border-radius: 0;
        box-shadow: none;
        max-width: none;
    }

    .login-card-title {
        font-size: 20px;
    }

    .login-form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .login-product-name {
        font-size: 14px;
    }

    .login-logo {
        height: 24px;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
    .login-card {
        max-width: 420px;
    }
}

/* Large screens */
@media (min-width: 1025px) {
    .login-card {
        max-width: 520px;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: more) {
    .login-form-input {
        border-width: 2px;
    }

    .login-btn-submit {
        border: 2px solid transparent;
    }

    .login-form-input:focus {
        border-color: #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .login-btn-submit:hover:not(:disabled) {
        transform: none;
    }
}

/* Loading State */
.login-btn-submit.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.login-btn-submit.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #FFFFFF;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Print Styles */
@media print {
    .login-header,
    .login-forgot-password {
        display: none;
    }

    .login-page {
        background: white;
    }

    .login-card {
        box-shadow: none;
    }
}

/* Modal Styles */
.login-modal {
    border-radius: 12px;
    border: none;
    box-shadow: var(--shadow-lg);
}

.login-modal-header {
    border-bottom: 1px solid #E5E7EB;
    padding: 24px;
}

.login-modal-header .modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.login-modal-body {
    padding: 24px;
}

.login-modal-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.login-modal-footer {
    border-top: 1px solid #E5E7EB;
    padding: 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Secondary Button */
.login-btn-secondary {
    height: 48px;
    padding: 0 24px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: #374151;
    background: #FFFFFF;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
}

.login-btn-secondary:hover:not(:disabled) {
    background: #F9FAFB;
    border-color: #9CA3AF;
}

.login-btn-secondary:focus {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.login-btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Success Alert */
.login-alert.success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}

/* Button with spinner */
.login-btn-submit .btn-text,
.login-btn-submit .btn-spinner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.login-btn-submit .btn-spinner {
    display: none;
}

.spinner {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Modal responsive adjustments */
@media (max-width: 640px) {
    .login-modal-header,
    .login-modal-body,
    .login-modal-footer {
        padding: 16px;
    }

    .login-modal-footer {
        flex-direction: column;
    }

    .login-btn-secondary,
    .login-modal-footer .login-btn-submit {
        width: 100%;
    }
}
