/**
 * Custom Frontend Login Styles
 * 
 * Modern, responsive CSS for the custom login form.
 * Matches the Azure theme design and provides excellent user experience.
 */

/* ==========================================================================
   RESET AND BASE STYLES
   ========================================================================== */

.custom-login-container * {
    box-sizing: border-box;
}

.custom-login-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
}

/* ==========================================================================
   MAIN CONTAINER
   ========================================================================== */

.custom-login-container {
    max-width: 450px;
    margin: 40px auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid #e1e5e9;
}

/* ==========================================================================
   LOGIN FORM
   ========================================================================== */

.custom-login-form {
    width: 100%;
}

/* Header Styles */
.login-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f4f8;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a365d;
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
}

.login-subtitle {
    font-size: 16px;
    color: #64748b;
    margin: 0;
    font-weight: 400;
}

/* Message Styles */
.login-message {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid;
}

.login-message-success {
    background-color: #f0f9ff;
    border-left-color: #0ea5e9;
    color: #0c4a6e;
}

.login-message-error {
    background-color: #fef2f2;
    border-left-color: #ef4444;
    color: #991b1b;
}

.login-message-info {
    background-color: #f8fafc;
    border-left-color: #64748b;
    color: #475569;
}

.message-icon {
    font-size: 16px;
    margin-right: 8px;
    font-weight: bold;
}

.message-text {
    flex: 1;
}

/* Form Styles */
.login-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group-checkbox {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: 0.025em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 12px;
    font-size: 16px;
    color: #9ca3af;
    z-index: 2;
    pointer-events: none;
}

.form-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background-color: #fff;
    color: #111827;
    transition: all 0.2s ease;
    outline: none;
}

.form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
    font-size: 15px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #9ca3af;
    font-size: 16px;
    z-index: 2;
    transition: color 0.2s ease;
}

.password-toggle:hover {
    color: #6b7280;
}

.input-error {
    font-size: 12px;
    color: #ef4444;
    margin-top: 4px;
    font-weight: 500;
    min-height: 16px;
}

/* Checkbox Styles */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    user-select: none;
}

.form-checkbox {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    accent-color: #3b82f6;
    cursor: pointer;
}

.checkbox-text {
    font-weight: 500;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 48px;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #f8fafc;
    color: #64748b;
    border: 2px solid #e2e8f0;
    margin-top: 12px;
}

.btn-secondary:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Login Actions */
.login-actions {
    text-align: center;
    margin-top: 20px;
}

.login-actions .btn {
    width: auto;
    min-width: 120px;
    margin: 0 8px;
}

/* Footer Styles */
.login-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f4f8;
}

.login-help {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

.forgot-password-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-password-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Info Box */
.login-info {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #f0f4f8;
}

.info-box {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #3b82f6;
}

.info-box h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #1e293b;
    font-weight: 600;
}

.info-box ul {
    margin: 0;
    padding-left: 20px;
    list-style: none;
}

.info-box li {
    margin-bottom: 6px;
    font-size: 14px;
    color: #475569;
    position: relative;
}

.info-box li:before {
    content: '';
    position: absolute;
    left: -20px;
    top: 8px;
    width: 6px;
    height: 6px;
    background: #3b82f6;
    border-radius: 50%;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

@media (max-width: 768px) {
    .custom-login-container {
        margin: 20px;
        padding: 16px;
        border-radius: 8px;
    }

    .login-title {
        font-size: 24px;
    }

    .login-subtitle {
        font-size: 14px;
    }

    .form-input {
        font-size: 16px;
        /* Prevent zoom on iOS */
    }

    .btn {
        font-size: 16px;
        padding: 14px 24px;
    }

    .login-actions .btn {
        width: 100%;
        margin: 8px 0;
    }
}

@media (max-width: 480px) {
    .custom-login-container {
        margin: 10px;
        padding: 12px;
    }

    .login-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .login-title {
        font-size: 22px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    .btn {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

/* Focus styles for keyboard navigation */
.form-input:focus,
.btn:focus,
.form-checkbox:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .custom-login-container {
        border: 2px solid #000;
    }

    .form-input {
        border: 2px solid #000;
    }

    .btn-primary {
        background: #000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

    .form-input,
    .btn,
    .loading-spinner {
        transition: none;
        animation: none;
    }

    .loading-spinner {
        animation: none;
    }
}

/* ==========================================================================
   PAGE PROTECTION STYLES
   ========================================================================== */

.custom-login-protection-message {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.custom-login-protection-message .protection-icon {
    font-size: 48px;
    margin-bottom: 16px;
    display: block;
}

.custom-login-protection-message .protection-title {
    font-size: 20px;
    color: #1a365d;
    margin: 0 0 12px 0;
    font-weight: 700;
}

.custom-login-protection-message .protection-message {
    font-size: 16px;
    color: #64748b;
    margin: 0 0 24px 0;
    line-height: 1.6;
}

.custom-login-protection-message .protection-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.custom-login-protection-message .btn {
    display: inline-block;
    padding: 10px 20px;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.custom-login-protection-message .btn:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.custom-login-protection-message .btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
}

.custom-login-protection-message .btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

/* ==========================================================================
   DARK MODE SUPPORT
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .custom-login-container {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }

    .login-title {
        color: #f9fafb;
    }

    .login-subtitle {
        color: #d1d5db;
    }

    .form-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .form-input:focus {
        border-color: #60a5fa;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
    }

    .form-label {
        color: #e5e7eb;
    }

    .checkbox-text {
        color: #e5e7eb;
    }

    .login-help {
        color: #d1d5db;
    }

    .info-box {
        background: #374151;
        border-left-color: #60a5fa;
    }

    .info-box h4 {
        color: #f9fafb;
    }

    .info-box li {
        color: #d1d5db;
    }

    .custom-login-protection-message {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }

    .custom-login-protection-message .protection-title {
        color: #f9fafb;
    }

    .custom-login-protection-message .protection-message {
        color: #d1d5db;
    }
}
