/* Authentication Pages Stylesheet
 * Consolidated styles for login, 2FA, password change, and encryption key import pages
 * Uses brand colors from brand-colors.css
 */

/* ===========================================
   Base Styles
   =========================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #dadada;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ===========================================
   Container Styles
   =========================================== */

.auth-container,
.login-container,
.container-2fa {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    padding: 40px;
}

.container-2fa {
    max-width: 520px;
}

/* ===========================================
   Logo Section
   =========================================== */

.auth-logo,
.logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo img,
.logo img {
    max-height: 60px;
    margin-bottom: 20px;
}

.auth-logo h1,
.logo h1 {
    color: #374151;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-logo p,
.logo p {
    color: #6b7280;
    font-size: 14px;
}

/* ===========================================
   Page Header
   =========================================== */

.page-header {
    text-align: center;
    margin-bottom: 30px;
}

.page-header h2 {
    color: #1f2937;
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.page-header p {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
}

/* ===========================================
   Alert Styles
   =========================================== */

.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 2rem;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid;
}

.alert-info {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #E3F2FD;
    color: #1565C0;
    border-color: #BBDEFB;
}

.alert-info i {
    margin-top: 2px;
}

.alert-success {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}

.alert-warning {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #92400e;
}

.alert-danger,
.error-message {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

/* ===========================================
   Content Sections
   =========================================== */

.content-section {
    margin-bottom: 24px;
}

.section-title {
    color: #374151;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
}

.section-text {
    color: #6b7280;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

/* ===========================================
   QR Code and Codes Box
   =========================================== */

.qr-box,
.codes-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    margin: 16px 0;
}

.qr-box img {
    max-width: 250px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    padding: 12px;
    background: white;
}

.codes-box {
    padding: 20px;
}

.codes-box pre {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.8;
    color: #1f2937;
    margin: 0;
    white-space: pre-wrap;
    overflow-x: auto;
}

/* ===========================================
   Form Styles
   =========================================== */

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

label {
    display: block;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 500;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 15px;
    transition: all 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.code-input {
    text-align: center;
    font-family: 'Courier New', monospace;
    font-size: 18px;
    letter-spacing: 0.3em;
}

.monospace-input {
    font-family: monospace;
}

.form-text,
.helper-text {
    font-size: 13px;
    color: #6b7280;
    margin-top: 8px;
    display: block;
}

.invalid-feedback {
    color: #dc3545;
    font-size: 13px;
    margin-top: 6px;
    display: block;
}

/* ===========================================
   Button Styles - Using Brand Colors
   =========================================== */

.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn:active {
    transform: translateY(0);
}

/* Primary Button - Indigo Purple */
.btn-primary,
.btn-login {
    background: #667eea;
    color: white;
}

.btn-primary:hover,
.btn-login:hover {
    background: #5568d3;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

.btn-primary:disabled:hover {
    background: #6c757d;
    box-shadow: none;
}

/* Secondary Button - Gray */
.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Success Button - Green */
.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Warning Button - Grey (deprecated, use secondary instead) */
.btn-warning {
    background: #6b7280;
    color: white;
}

.btn-warning:hover {
    background: #4b5563;
}

/* Copied Button State */
.btn-copied {
    background: #10b981 !important;
}

/* ===========================================
   Button Groups
   =========================================== */

.button-group {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.button-group .btn {
    width: auto;
    flex: 1;
    min-width: 150px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 2rem;
}

.form-actions .btn {
    width: auto;
    padding: 10px 20px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ===========================================
   Checkbox and Label Styles
   =========================================== */

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 400;
    margin-bottom: 16px;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: auto;
}

/* ===========================================
   Password Requirements
   =========================================== */

.password-requirements {
    margin-top: 12px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e9ecef;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
    transition: color 0.2s ease-in-out;
}

.requirement-icon {
    font-size: 14px;
    min-width: 14px;
    transition: color 0.2s ease-in-out;
}

.requirement.valid {
    color: #28a745;
}

.requirement.invalid {
    color: #dc3545;
}

.requirement .fa-spinner {
    color: #ffc107;
}

/* ===========================================
   Password Change Card (EasyAdmin context)
   =========================================== */

.password-change-wrapper {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.password-change-card {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* ===========================================
   CSV Upload Styles
   =========================================== */

.csv-upload-box {
    border: 2px dashed var(--brand-secondary, #004B87);
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px 0;
}

.csv-upload-box:hover,
.csv-upload-box.dragover {
    background: #e3f2fd;
    border-color: var(--brand-primary, #F18A00);
}

.csv-upload-box i {
    font-size: 48px;
    color: var(--brand-secondary, #004B87);
    margin-bottom: 15px;
}

.csv-upload-box .upload-text {
    font-size: 16px;
    color: #495057;
    margin-bottom: 10px;
}

.csv-upload-box .upload-hint {
    font-size: 14px;
    color: #6c757d;
}

.csv-upload-box input[type="file"] {
    display: none;
}

/* ===========================================
   Footer
   =========================================== */

.footer {
    margin-top: 24px;
    text-align: center;
    color: #6b7280;
    font-size: 13px;
}

.footer a {
    color: #667eea;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* ===========================================
   Back Link
   =========================================== */

.back-link {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.back-link a {
    color: #6b7280;
    font-size: 13px;
    text-decoration: none;
}

.back-link a:hover {
    color: #667eea;
    text-decoration: underline;
}

/* ===========================================
   Dark Mode Support
   =========================================== */

[data-bs-theme="dark"] .password-change-card {
    background: #2d3748;
}

[data-bs-theme="dark"] .form-group label {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-control {
    background: #1a202c;
    border-color: #4a5568;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .form-control:focus {
    border-color: #63b3ed;
}

[data-bs-theme="dark"] .form-text,
[data-bs-theme="dark"] .helper-text {
    color: #a0aec0;
}

[data-bs-theme="dark"] .alert-info {
    background: #1e3a5f;
    color: #90cdf4;
    border-color: #2c5282;
}

[data-bs-theme="dark"] .password-requirements {
    background: #1a202c;
    border-color: #4a5568;
}

[data-bs-theme="dark"] .requirement {
    color: #a0aec0;
}

[data-bs-theme="dark"] .requirement.valid {
    color: #48bb78;
}

[data-bs-theme="dark"] .requirement.invalid {
    color: #f56565;
}

[data-bs-theme="dark"] .requirement .fa-spinner {
    color: #fbbf24;
}

/* ===========================================
   CSV File Upload Styles (for encryption key import)
   =========================================== */

.csv-file-upload-wrapper {
    position: relative;
}

.csv-file-upload-box {
    padding: 2rem;
    border: 2px dashed #dee2e6;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.csv-file-upload-box:hover {
    border-color: #667eea;
    background-color: #e7f3ff;
}

.csv-file-upload-box.csv-drag-over {
    border-color: #667eea;
    background-color: #dbeafe;
    border-style: solid;
}

.csv-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.csv-file-name-display {
    display: none;
    margin-top: 2rem;
    color: #667eea;
    font-weight: 600;
}

.csv-file-name-display.csv-show {
    display: block;
}

.csv-file-upload-box.csv-file-selected {
    border-color: #198754;
    background-color: #d1e7dd;
}

/* ===========================================
   Responsive Design
   =========================================== */

@media (max-width: 768px) {
    .password-change-wrapper {
        padding: 15px;
    }

    .password-change-card {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn,
    .button-group .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .auth-container,
    .login-container,
    .container-2fa {
        padding: 30px 24px;
    }

    .auth-logo h1,
    .logo h1 {
        font-size: 24px;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group .btn {
        width: 100%;
    }
}
