/**
 * Auth Modal Styles
 * Retro arcade theme matching the Flight Animation app
 */

/* Modal Open State */
body.auth-modal-open {
    overflow: hidden;
}

/* Overlay */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.auth-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal */
.auth-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(135deg, #0a0a12 0%, #12121e 100%);
    border: 2px solid #00ff88;
    border-radius: 8px;
    box-shadow: 
        0 0 30px rgba(0, 255, 136, 0.3),
        inset 0 0 60px rgba(0, 255, 136, 0.05);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    padding: 0;
}

.auth-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* Close button */
.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s, background 0.2s;
    z-index: 10;
}

.auth-modal-close:hover {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
}

/* Tabs */
.auth-modal-tabs {
    display: flex;
    border-bottom: 2px solid #222;
    padding: 0;
}

.auth-tab {
    flex: 1;
    padding: 16px;
    background: transparent;
    border: none;
    color: #666;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    position: relative;
}

.auth-tab:hover {
    color: #aaa;
    background: rgba(255, 255, 255, 0.03);
}

.auth-tab.active {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.05);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #00ff88;
}

/* Panels */
.auth-panel {
    display: none;
    padding: 24px;
}

.auth-panel.active {
    display: block;
}

/* Form fields */
.auth-field {
    margin-bottom: 20px;
}

.auth-field label {
    display: block;
    color: #00ff88;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.auth-field input[type="email"],
.auth-field input[type="password"],
.auth-field input[type="text"] {
    width: 100%;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid #333;
    border-radius: 4px;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-field input:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 0 2px rgba(0, 255, 136, 0.2);
}

.auth-field input::placeholder {
    color: #555;
}

.auth-hint {
    display: block;
    color: #666;
    font-size: 11px;
    margin-top: 6px;
}

/* Checkbox */
.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #00ff88;
    cursor: pointer;
}

.auth-checkbox label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    color: #aaa;
    margin-bottom: 0;
}

/* Error / Success messages */
.auth-error {
    color: #ff4444;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 16px;
    min-height: 18px;
    padding: 10px 12px;
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-error:empty {
    display: none;
}

.auth-success {
    color: #00ff88;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 16px;
    min-height: 18px;
    padding: 10px 12px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-success:empty {
    display: none;
}

/* Rate limit error special styling */
.auth-error.rate-limited {
    color: #ffaa00;
    background: rgba(255, 170, 0, 0.1);
    border-color: rgba(255, 170, 0, 0.3);
}

/* Loading spinner */
.auth-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes auth-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button loading state */
.auth-submit.loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.auth-submit.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 3px solid transparent;
    border-top-color: #000;
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
}

.auth-submit.secondary.loading::after {
    border-top-color: #00ff88;
}

/* Submit button */
.auth-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #00ff88 0%, #00cc6a 100%);
    border: none;
    border-radius: 4px;
    color: #000;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s;
}

.auth-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.4);
}

.auth-submit:active:not(:disabled) {
    transform: translateY(0);
}

.auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-submit.secondary {
    background: transparent;
    border: 2px solid #00ff88;
    color: #00ff88;
}

.auth-submit.secondary:hover:not(:disabled) {
    background: rgba(0, 255, 136, 0.1);
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #333;
}

.auth-divider span {
    padding: 0 16px;
    color: #555;
    font-size: 12px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
}

/* OAuth Provider buttons */
.auth-providers {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-provider-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    border-radius: 4px;
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
}

.auth-provider-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #555;
}

.auth-provider-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-provider-google:hover {
    border-color: #4285f4;
}

.auth-provider-github:hover {
    border-color: #fff;
}

/* Links */
.auth-links {
    margin-top: 20px;
    text-align: center;
}

.auth-links a {
    color: #00ff88;
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: #44ffaa;
    text-decoration: underline;
}

/* Verification success icon */
.auth-success-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

.auth-panel h3 {
    color: #00ff88;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    text-align: center;
    margin-bottom: 12px;
}

.auth-message {
    color: #aaa;
    font-size: 14px;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Auth status indicator (for header) */
.auth-header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-header-btn {
    background: transparent;
    border: 2px solid #00ff88;
    color: #00ff88;
    padding: 8px 16px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s, transform 0.15s;
}

.auth-header-btn:hover {
    background: rgba(0, 255, 136, 0.15);
    transform: translateY(-1px);
}

.auth-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    font-size: 12px;
}

.auth-status:not(.authenticated) .auth-user-email,
.auth-status:not(.authenticated) [data-auth-logout] {
    display: none;
}

.auth-status.authenticated [data-auth-login] {
    display: none;
}

.auth-user-email {
    color: #00ff88;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .auth-modal {
        width: 95%;
        max-height: 85vh;
    }
    
    .auth-tab {
        font-size: 10px;
        padding: 14px 10px;
    }
    
    .auth-panel {
        padding: 20px 16px;
    }
}

/* Export button auth indicators */
.export-auth-locked {
    position: relative;
    opacity: 0.7;
    cursor: not-allowed !important;
}

.export-auth-locked::before {
    content: '🔒';
    margin-right: 6px;
    font-size: 12px;
}

/* Credits Display */
.credits-container {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
}

.credits-container.hidden {
    display: none;
}

.credits-label {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.5px;
}

.credits-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    padding: 4px 8px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #ffd700;
    border-radius: 4px;
    color: #ffd700;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 
        0 0 10px rgba(255, 215, 0, 0.3),
        inset 0 0 10px rgba(255, 215, 0, 0.1);
    animation: creditsPulse 2s ease-in-out infinite;
}

@keyframes creditsPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.3), inset 0 0 10px rgba(255, 215, 0, 0.1); }
    50% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.5), inset 0 0 15px rgba(255, 215, 0, 0.2); }
}

/* Legal Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, #0a0a12 0%, #12121e 100%);
    border: 2px solid #00ff88;
    border-radius: 8px;
    box-shadow: 
        0 0 30px rgba(0, 255, 136, 0.3),
        inset 0 0 60px rgba(0, 255, 136, 0.05);
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-content.legal-modal-content .modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #222;
}

.modal-content.legal-modal-content .modal-header h2 {
    margin: 0 0 8px 0;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    color: #00ff88;
    letter-spacing: 1px;
}

.modal-content.legal-modal-content .modal-header p {
    margin: 0;
    color: #888;
    font-size: 13px;
}

.legal-tabs {
    display: flex;
    border-bottom: 1px solid #222;
}

.legal-tab {
    flex: 1;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: #666;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.legal-tab:hover {
    background: rgba(0, 255, 136, 0.05);
    color: #00ff88;
}

.legal-tab.active {
    color: #00ff88;
    background: rgba(0, 255, 136, 0.1);
    border-bottom: 2px solid #00ff88;
}

.legal-document-container {
    flex: 1;
    overflow-y: auto;
    min-height: 150px;
    max-height: 35vh;
    padding: 16px 20px;
    background: #0d0d15;
}

/* Scoped to modal context - hidden until tab is active */
.legal-document-container .legal-document {
    display: none;
    color: #ccc;
    font-size: 13px;
    line-height: 1.7;
}

.legal-document-container .legal-document.active {
    display: block;
}

.legal-document h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    color: #00ff88;
    margin: 0 0 16px 0;
}

.legal-document h2 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 14px;
    color: #00ff88;
    margin: 24px 0 12px 0;
}

.legal-document h3 {
    font-size: 13px;
    color: #aaa;
    margin: 16px 0 8px 0;
}

.legal-document p {
    margin: 8px 0;
}

.legal-document ul, .legal-document ol {
    margin: 8px 0;
    padding-left: 24px;
}

.legal-document li {
    margin: 4px 0;
}

.legal-checkboxes {
    padding: 16px 24px;
    border-top: 1px solid #222;
    background: rgba(0, 255, 136, 0.02);
}

.checkbox-container {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
    cursor: pointer;
    color: #ccc;
    font-size: 13px;
}

.checkbox-container:last-child {
    margin-bottom: 0;
}

.checkbox-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    margin-top: 2px;
    accent-color: #00ff88;
    cursor: pointer;
}

.version-badge {
    display: inline-block;
    padding: 2px 6px;
    font-size: 10px;
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid #00ff88;
    border-radius: 3px;
    color: #00ff88;
    margin-left: 4px;
}

.legal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #222;
}

.legal-actions .btn {
    padding: 12px 24px;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    letter-spacing: 1px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary {
    background: transparent;
    border: 2px solid #666;
    color: #888;
}

.btn-secondary:hover {
    border-color: #888;
    color: #ccc;
}

.btn-primary {
    background: linear-gradient(135deg, #00cc6a 0%, #00ff88 100%);
    border: none;
    color: #000;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #00ff88 0%, #00ffaa 100%);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

#legal-error {
    padding: 12px 24px;
    background: rgba(255, 68, 68, 0.1);
    border-top: 1px solid rgba(255, 68, 68, 0.3);
    color: #ff4444;
    font-size: 12px;
}

.loading-spinner {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 13px;
}

/* Modal open state */
body.modal-open {
    overflow: hidden;
}

/* Mobile adjustments for legal modal */
@media (max-width: 600px) {
    .modal-content.legal-modal-content {
        max-width: 100%;
        max-height: 100vh;
        height: auto;
        border-radius: 0;
    }
    
    .legal-document-container {
        max-height: 40vh;
        min-height: 120px;
    }
    
    .legal-checkboxes {
        padding: 12px 16px;
    }
    
    .legal-actions {
        flex-direction: column;
        padding: 12px 16px;
    }
    
    .legal-actions .btn {
        width: 100%;
    }
    
    .credits-container {
        margin-right: 8px;
    }
    
    .credits-badge {
        font-size: 9px;
        padding: 3px 6px;
    }
}

/* Admin Controls */
.admin-controls {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 1000;
}

.admin-btn {
    background: linear-gradient(135deg, #3a1a1a 0%, #1a0a0a 100%);
    border: 1px solid #ff4444;
    color: #ff6666;
    padding: 8px 16px;
    font-size: 11px;
    font-family: 'Space Grotesk', sans-serif;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(255, 68, 68, 0.2);
}

.admin-btn:hover {
    background: linear-gradient(135deg, #4a2a2a 0%, #2a1a1a 100%);
    box-shadow: 0 4px 16px rgba(255, 68, 68, 0.4);
    transform: translateY(-1px);
}

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