/**
 * Authentication UI Styles
 * Styles for login, registration, and session management components
 */

/* ============================================================================
   MODAL BASE
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-large {
    max-width: 700px;
}

.modal-small {
    max-width: 400px;
}

/* Close button */
.close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}

.close:hover {
    color: #333;
}

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.2s;
}

.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="text"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-group input[type="email"]::placeholder,
.form-group input[type="password"]::placeholder,
.form-group input[type="text"]::placeholder {
    color: #999;
}

/* ============================================================================
   PASSWORD INPUT WITH TOGGLE
   ============================================================================ */

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    transition: opacity 0.2s;
}

.toggle-password:hover {
    opacity: 0.7;
}

/* ============================================================================
   PASSWORD STRENGTH INDICATOR
   ============================================================================ */

.password-strength {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.strength-bar {
    height: 4px;
    flex: 1;
    border-radius: 2px;
    transition: all 0.3s;
    background: #ddd;
}

.strength-weak {
    width: 33%;
    background: #dc3545;
}

.strength-medium {
    width: 66%;
    background: #ffc107;
}

.strength-strong {
    width: 100%;
    background: #28a745;
}

/* ============================================================================
   PASSWORD REQUIREMENTS LIST
   ============================================================================ */

.password-requirements {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
}

.password-requirements li {
    padding: 0.25rem 0;
    color: #666;
    transition: color 0.2s;
}

.password-requirements li[style*="color: rgb(40, 167, 69)"] {
    color: #28a745 !important;
}

/* ============================================================================
   CHECKBOX & RADIO BUTTONS
   ============================================================================ */

.form-group.checkbox {
    display: flex;
    align-items: center;
}

.form-group.checkbox input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-group.checkbox label {
    margin-bottom: 0;
    cursor: pointer;
    font-weight: normal;
}

/* Checkbox Grid */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.checkbox-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    color: #555;
    cursor: pointer;
    margin-bottom: 0;
}

.checkbox-grid input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.btn-primary {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-primary:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.65;
}

.btn-full-width {
    width: 100%;
    margin-top: 1rem;
}

.btn-secondary {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #0056b3;
}

/* ============================================================================
   ERROR & SUCCESS MESSAGES
   ============================================================================ */

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid #f5c6cb;
    display: none;
    animation: slideIn 0.3s;
}

.error-message.show {
    display: block;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border: 1px solid #c3e6cb;
}

/* Notification Toasts */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    animation: slideIn 0.3s;
    font-weight: 500;
    max-width: 400px;
}

.notification.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.notification.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.notification.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.notification.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ============================================================================
   FORM FOOTER
   ============================================================================ */

.form-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
}

.form-footer p {
    margin: 0.5rem 0;
}

.form-footer a {
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.form-footer a:hover {
    text-decoration: underline;
    color: #0056b3;
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.text-muted {
    color: #6c757d;
    font-size: 0.875rem;
}

.text-center {
    text-align: center;
}

/* ============================================================================
   FIELDSETS (for grouped form sections)
   ============================================================================ */

fieldset {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

fieldset legend {
    font-weight: 600;
    padding: 0 0.5rem;
    color: #333;
}

/* ============================================================================
   RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
    }

    .notification {
        left: 10px;
        right: 10px;
        max-width: calc(100% - 20px);
    }
}

@media (max-width: 480px) {
    .modal-content {
        max-height: none;
        height: auto;
    }

    .form-group input,
    .form-group select {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .close {
        font-size: 24px;
    }

    .btn-primary {
        padding: 0.9rem 1.2rem;
        font-size: 0.95rem;
    }
}

/* ============================================================================
   DARK MODE SUPPORT (Optional)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
    .modal-content {
        background: #2d2d2d;
        color: #e0e0e0;
    }

    .form-group label {
        color: #e0e0e0;
    }

    .form-group input,
    .form-group select {
        background: #3d3d3d;
        color: #e0e0e0;
        border-color: #555;
    }

    .form-group input:focus,
    .form-group select:focus {
        border-color: #4fa3ff;
    }

    .form-group input::placeholder {
        color: #888;
    }

    .error-message {
        background: #4a2c2c;
        color: #ff9999;
        border-color: #664444;
    }

    .success-message {
        background: #2c4a2c;
        color: #99ff99;
    }

    .notification.success {
        background: #2c4a2c;
        color: #99ff99;
        border-color: #445544;
    }

    .btn-primary {
        background: #0056b3;
    }

    .btn-primary:hover {
        background: #003d7a;
    }

    .form-footer a {
        color: #4fa3ff;
    }

    fieldset {
        border-color: #555;
    }

    fieldset legend {
        color: #e0e0e0;
    }
}

/* ============================================================================
   ACCESSIBILITY
   ============================================================================ */

/* Focus visible for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .modal-content,
    .notification,
    .btn-primary,
    .toggle-password,
    .form-group input,
    .strength-bar {
        animation: none !important;
        transition: none !important;
    }
}
