/* ====================================================================
   AURUM EAGLE - AUTHENTICATION SYSTEM CSS
   Integrated with Light/Dark Theme Support
   Version: 2.0
   ==================================================================== */

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

.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

body.dark-theme .auth-modal {
    background: rgba(0, 0, 0, 0.7);
}

.auth-modal.active {
    display: flex;
}

.auth-content {
    background: var(--bg-primary, #FFFFFF);
    border-radius: 1rem;
    width: 90%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.3s ease;
    border: 1px solid var(--border-color, #E5E7EB);
}

body.dark-theme .auth-content {
    background: #1F2937;
    border-color: #374151;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 
                0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   MODAL HEADER
   ======================================== */

.auth-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #E5E7EB);
}

body.dark-theme .auth-header {
    border-bottom-color: #374151;
}

.auth-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #1F2937);
}

body.dark-theme .auth-header h3 {
    color: #E5E7EB;
}

.auth-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    color: var(--text-secondary, #6B7280);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.dark-theme .auth-close {
    color: #9CA3AF;
}

.auth-close:hover {
    background: var(--bg-secondary, #F9FAFB);
    color: var(--text-primary, #1F2937);
}

body.dark-theme .auth-close:hover {
    background: #111827;
    color: #E5E7EB;
}

/* ========================================
   AUTH TABS
   ======================================== */

.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color, #E5E7EB);
    background: var(--bg-secondary, #F9FAFB);
}

body.dark-theme .auth-tabs {
    background: #111827;
    border-bottom-color: #374151;
}

.auth-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary, #6B7280);
    transition: all 0.2s;
    position: relative;
}

body.dark-theme .auth-tab {
    color: #9CA3AF;
}

.auth-tab:hover {
    color: var(--text-primary, #1F2937);
    background: var(--bg-tertiary, #F3F4F6);
}

body.dark-theme .auth-tab:hover {
    color: #E5E7EB;
    background: #0F172A;
}

.auth-tab.active {
    color: var(--aurum-copper, #B58948);
    background: var(--bg-primary, #FFFFFF);
}

body.dark-theme .auth-tab.active {
    background: #1F2937;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--aurum-copper, #B58948);
}

/* ========================================
   AUTH BODY & FORMS
   ======================================== */

.auth-body {
    padding: 1.5rem;
    max-height: calc(90vh - 180px);
    overflow-y: auto;
}

/* Custom scrollbar for dark theme */
body.dark-theme .auth-body::-webkit-scrollbar {
    width: 8px;
}

body.dark-theme .auth-body::-webkit-scrollbar-track {
    background: #111827;
}

body.dark-theme .auth-body::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
}

body.dark-theme .auth-body::-webkit-scrollbar-thumb:hover {
    background: #4B5563;
}

.auth-form-container {
    display: none;
}

.auth-form-container.active {
    display: block;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* ========================================
   FORM GROUPS & INPUTS
   ======================================== */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
}

body.dark-theme .form-group label {
    color: #E5E7EB;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color, #E5E7EB);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background: var(--bg-primary, #FFFFFF);
    color: var(--text-primary, #1F2937);
    transition: all 0.2s;
    box-sizing: border-box;
}

body.dark-theme .form-group input,
body.dark-theme .form-group textarea {
    background: #0F172A;
    border-color: #374151;
    color: #E5E7EB;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--aurum-copper, #B58948);
    box-shadow: 0 0 0 3px rgba(181, 137, 72, 0.1);
}

body.dark-theme .form-group input:focus,
body.dark-theme .form-group textarea:focus {
    box-shadow: 0 0 0 3px rgba(181, 137, 72, 0.2);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary, #9CA3AF);
}

body.dark-theme .form-group input::placeholder,
body.dark-theme .form-group textarea::placeholder {
    color: #6B7280;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-secondary, #6B7280);
    margin-top: 0.25rem;
}

body.dark-theme .form-hint {
    color: #9CA3AF;
}

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

.password-input-wrapper {
    position: relative;
    width: 100%;
}

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

.password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary, #6B7280);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

body.dark-theme .password-toggle {
    color: #9CA3AF;
}

.password-toggle:hover {
    color: var(--text-primary, #1F2937);
}

body.dark-theme .password-toggle:hover {
    color: #E5E7EB;
}

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

.password-strength {
    display: none;
    margin-top: 0.5rem;
}

.password-strength.visible {
    display: block;
}

.strength-bar {
    height: 4px;
    background: var(--border-color, #E5E7EB);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

body.dark-theme .strength-bar {
    background: #374151;
}

.strength-bar-fill {
    height: 100%;
    width: 0;
    transition: all 0.3s;
    border-radius: 2px;
}

.strength-bar-fill.weak {
    width: 33%;
    background: #DC2626;
}

.strength-bar-fill.medium {
    width: 66%;
    background: #F59E0B;
}

.strength-bar-fill.strong {
    width: 100%;
    background: #10B981;
}

.strength-text {
    font-size: 0.75rem;
    font-weight: 600;
}

.strength-text.weak {
    color: #DC2626;
}

.strength-text.medium {
    color: #F59E0B;
}

.strength-text.strong {
    color: #10B981;
}

body.dark-theme .strength-text.strong {
    color: #6EE7B7;
}

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

.password-requirements {
    background: var(--bg-secondary, #F9FAFB);
    padding: 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color, #E5E7EB);
}

body.dark-theme .password-requirements {
    background: #111827;
    border-color: #374151;
}

.requirements-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
    margin: 0 0 0.5rem 0;
}

body.dark-theme .requirements-title {
    color: #E5E7EB;
}

.requirements-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.requirement {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #6B7280);
    transition: color 0.2s;
}

body.dark-theme .requirement {
    color: #9CA3AF;
}

.requirement svg {
    flex-shrink: 0;
    opacity: 0.3;
    transition: opacity 0.2s;
}

.requirement.met {
    color: #10B981;
}

body.dark-theme .requirement.met {
    color: #6EE7B7;
}

.requirement.met svg {
    opacity: 1;
}

/* ========================================
   FORM ACTIONS & CONTROLS
   ======================================== */

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #6B7280);
    cursor: pointer;
    user-select: none;
}

body.dark-theme .remember-me {
    color: #9CA3AF;
}

.remember-me input[type="checkbox"] {
    width: auto;
    cursor: pointer;
    accent-color: var(--aurum-copper, #B58948);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #6B7280);
}

body.dark-theme .form-checkbox {
    color: #9CA3AF;
}

.form-checkbox input[type="checkbox"] {
    width: auto;
    cursor: pointer;
    accent-color: var(--aurum-copper, #B58948);
}

/* ========================================
   LINKS
   ======================================== */

.forgot-password {
    font-size: 0.875rem;
    color: var(--aurum-copper, #B58948);
    text-decoration: none;
    transition: opacity 0.2s;
    cursor: pointer;
}

.forgot-password:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.forgot-password-text {
    font-size: 0.875rem;
    color: var(--text-secondary, #6B7280);
    margin-bottom: 1rem;
    line-height: 1.5;
}

body.dark-theme .forgot-password-text {
    color: #9CA3AF;
}

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

.auth-submit-btn,
.address-submit-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: var(--aurum-copper, #B58948);
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-submit-btn:hover,
.address-submit-btn:hover {
    background: var(--aurum-copper-light, #C9A05A);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(181, 137, 72, 0.3);
}

.auth-submit-btn:active,
.address-submit-btn:active {
    transform: translateY(0);
}

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

.auth-submit-btn:disabled:hover,
.address-submit-btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.auth-back-btn,
.address-skip-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: transparent;
    color: var(--text-primary, #1F2937);
    border: 1px solid var(--border-color, #E5E7EB);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.5rem;
}

body.dark-theme .auth-back-btn,
body.dark-theme .address-skip-btn {
    color: #E5E7EB;
    border-color: #374151;
}

.auth-back-btn:hover,
.address-skip-btn:hover {
    background: var(--bg-secondary, #F9FAFB);
    border-color: var(--aurum-copper, #B58948);
}

body.dark-theme .auth-back-btn:hover,
body.dark-theme .address-skip-btn:hover {
    background: #111827;
}

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

.auth-error,
.auth-success,
.whitelist-error {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    display: none;
    line-height: 1.5;
}

.auth-error.visible,
.auth-success.visible,
.whitelist-error.visible {
    display: block;
}

.auth-error,
.whitelist-error {
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

body.dark-theme .auth-error,
body.dark-theme .whitelist-error {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
    border-color: rgba(239, 68, 68, 0.3);
}

.auth-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

body.dark-theme .auth-success {
    background: rgba(16, 185, 129, 0.15);
    color: #6EE7B7;
    border-color: rgba(16, 185, 129, 0.3);
}

.auth-success code {
    background: rgba(16, 185, 129, 0.2);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: monospace;
}

body.dark-theme .auth-success code {
    background: rgba(16, 185, 129, 0.3);
}

/* ========================================
   USER MENU DROPDOWN
   ======================================== */

.user-menu {
    position: fixed;
    background: var(--bg-primary, #FFFFFF);
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color, #E5E7EB);
    min-width: 280px;
    z-index: 10000;
    animation: modalSlideIn 0.2s ease;
    display: none;
}

body.dark-theme .user-menu {
    background: #1F2937;
    border-color: #374151;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 
                0 4px 6px -2px rgba(0, 0, 0, 0.3);
}

.user-menu.active {
    display: block;
}

.user-menu-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color, #E5E7EB);
}

body.dark-theme .user-menu-header {
    border-bottom-color: #374151;
}

.user-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--aurum-copper, #B58948) 0%, var(--aurum-copper-light, #C9A05A) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-theme .user-name {
    color: #E5E7EB;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-secondary, #6B7280);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-theme .user-email {
    color: #9CA3AF;
}

.user-menu-divider {
    height: 1px;
    background: var(--border-color, #E5E7EB);
}

body.dark-theme .user-menu-divider {
    background: #374151;
}

.user-menu-items {
    padding: 0.5rem;
}

.user-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary, #1F2937);
    transition: all 0.2s;
    text-align: left;
}

body.dark-theme .user-menu-item {
    color: #E5E7EB;
}

.user-menu-item:hover {
    background: var(--bg-secondary, #F9FAFB);
}

body.dark-theme .user-menu-item:hover {
    background: #111827;
}

.user-menu-item.logout {
    color: #DC2626;
}

body.dark-theme .user-menu-item.logout {
    color: #FCA5A5;
}

.user-menu-item.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

body.dark-theme .user-menu-item.logout:hover {
    background: rgba(239, 68, 68, 0.15);
}

.user-menu-item svg {
    flex-shrink: 0;
}

/* ========================================
   ADDRESS MODAL
   ======================================== */

.address-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

body.dark-theme .address-modal {
    background: rgba(0, 0, 0, 0.7);
}

.address-modal.active {
    display: flex;
}

.address-content {
    background: var(--bg-primary, #FFFFFF);
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 
                0 10px 10px -5px rgba(0, 0, 0, 0.04);
    animation: modalSlideIn 0.3s ease;
    border: 1px solid var(--border-color, #E5E7EB);
}

body.dark-theme .address-content {
    background: #1F2937;
    border-color: #374151;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 
                0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

.address-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color, #E5E7EB);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

body.dark-theme .address-header {
    border-bottom-color: #374151;
}

.address-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary, #1F2937);
}

body.dark-theme .address-header h3 {
    color: #E5E7EB;
}

.address-body {
    padding: 1.5rem;
    max-height: calc(90vh - 120px);
    overflow-y: auto;
}

body.dark-theme .address-body::-webkit-scrollbar {
    width: 8px;
}

body.dark-theme .address-body::-webkit-scrollbar-track {
    background: #111827;
}

body.dark-theme .address-body::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
}

.address-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    color: #D97706;
}

body.dark-theme .address-warning {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.3);
    color: #FCD34D;
}

.address-warning strong {
    display: block;
    margin-bottom: 0.25rem;
}

.address-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-section h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #1F2937);
}

body.dark-theme .form-section h4 {
    color: #E5E7EB;
}

.address-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

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

@media (max-width: 640px) {
    .auth-content,
    .address-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .auth-body,
    .address-body {
        padding: 1rem;
        max-height: calc(95vh - 160px);
    }
    
    .auth-header,
    .address-header {
        padding: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .user-menu {
        min-width: 260px;
        right: 10px !important;
    }
    
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ========================================
   LOADING STATE
   ======================================== */

.loading {
    opacity: 0.6;
    cursor: not-allowed !important;
    pointer-events: none;
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   ANIMATIONS FOR NOTIFICATIONS
   ======================================== */

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.auth-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 10001;
    animation: slideInRight 0.3s ease;
}

.auth-notification.auth-notification-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

body.dark-theme .auth-notification.auth-notification-success {
    background: rgba(16, 185, 129, 0.15);
    color: #6EE7B7;
    border-color: rgba(16, 185, 129, 0.3);
}

.auth-notification.auth-notification-error {
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

body.dark-theme .auth-notification.auth-notification-error {
    background: rgba(239, 68, 68, 0.15);
    color: #FCA5A5;
    border-color: rgba(239, 68, 68, 0.3);
}

.auth-notification.auth-notification-info {
    background: var(--bg-secondary, #F9FAFB);
    color: var(--text-primary, #1F2937);
    border: 1px solid var(--border-color, #E5E7EB);
}

body.dark-theme .auth-notification.auth-notification-info {
    background: #111827;
    color: #E5E7EB;
    border-color: #374151;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .auth-modal,
    .address-modal,
    .user-menu {
        display: none !important;
    }
}
