/* =====================================================
   AUTHENTICATION UI STYLES
   Location: /public/auth-styles.css
   ===================================================== */

/* Auth Overlay */
.auth-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Auth Modal */
.auth-modal {
    background: var(--color-bg-secondary, #1a1a2e);
    border-radius: 16px;
    width: 90%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-modal-header h2 {
    margin: 0;
    font-size: clamp(20px, 5vw, 24px);
    font-weight: 600;
    color: var(--color-text-primary, #fff);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--color-text-secondary, #999);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 50%;
}

.auth-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    transform: rotate(90deg);
}

.auth-modal-body {
    padding: 24px;
}

/* Auth Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-form-group label {
    font-size: clamp(13px, 3.5vw, 14px);
    font-weight: 500;
    color: var(--color-text-primary, #fff);
}

.auth-form-group input {
    padding: clamp(10px, 3vw, 12px) clamp(12px, 4vw, 16px);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--color-text-primary, #fff);
    font-size: clamp(14px, 3.75vw, 15px);
    transition: all 0.2s;
}

.auth-form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.auth-hint {
    font-size: clamp(11px, 3vw, 12px);
    color: var(--color-text-tertiary, #666);
}

.auth-form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
    flex-wrap: wrap;
    gap: 8px;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(12px, 3.5vw, 14px);
    color: var(--color-text-secondary, #999);
    cursor: pointer;
}

.auth-checkbox input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.auth-link {
    font-size: clamp(12px, 3.5vw, 14px);
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s;
    white-space: nowrap;
}

.auth-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.auth-error {
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 14px;
    display: none;
}

.auth-error:not(:empty) {
    display: block;
}

.auth-success {
    padding: 12px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    color: #22c55e;
    font-size: 14px;
    display: none;
}

.auth-success:not(:empty) {
    display: block;
}

/* Auth Buttons */
.auth-btn {
    padding: clamp(12px, 3.5vw, 14px) clamp(20px, 6vw, 24px);
    border: none;
    border-radius: 8px;
    font-size: clamp(14px, 3.75vw, 15px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.auth-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.auth-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

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

.auth-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary, #fff);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-text {
    transition: opacity 0.2s;
}

.btn-loader {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.auth-divider {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.auth-divider span {
    background: var(--color-bg-secondary, #1a1a2e);
    padding: 0 16px;
    position: relative;
    font-size: 14px;
    color: var(--color-text-tertiary, #666);
}

/* Message Box */
.auth-message-box {
    text-align: center;
    padding: 20px;
}

.auth-icon-success {
    font-size: 64px;
    margin-bottom: 16px;
    animation: scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.auth-message-box h3 {
    margin: 0 0 12px;
    font-size: 22px;
    color: var(--color-text-primary, #fff);
}

.auth-message-box p {
    margin: 0 0 20px;
    color: var(--color-text-secondary, #999);
    line-height: 1.5;
}

.auth-resend-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.auth-resend-section p {
    margin-bottom: 12px;
    font-size: 14px;
}

/* User Profile */
.auth-trigger-btn {
    position: fixed;
    top: calc(20px + env(safe-area-inset-top, 0px));
    right: 20px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.auth-trigger-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

#user-profile-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px 8px 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    color: var(--color-text-primary, #fff);
    cursor: pointer;
    transition: all 0.2s;
}

.user-profile-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

.profile-menu {
    position: absolute;
    top: 56px;
    right: 0;
    min-width: 280px;
    background: var(--color-bg-secondary, #1a1a2e);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

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

.profile-menu-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
    align-items: center;
}

.profile-menu-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #667eea;
}

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

.profile-menu-info > div:first-child {
    font-weight: 600;
    color: var(--color-text-primary, #fff);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu-info > div:last-child {
    font-size: 13px;
    color: var(--color-text-tertiary, #666);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu-items {
    padding: 8px;
}

.profile-menu-items button {
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--color-text-primary, #fff);
    text-align: left;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.profile-menu-items button:hover {
    background: rgba(255, 255, 255, 0.05);
}

.profile-menu-items button span {
    font-size: 18px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .auth-modal {
        width: 95%;
        max-width: none;
        margin: 0 10px;
        max-height: 85vh;
    }

    .auth-modal-header {
        padding: 18px 16px 12px;
    }

    .auth-modal-body {
        padding: 18px 16px;
    }

    .auth-trigger-btn,
    #user-profile-container {
        top: 12px;
        right: 12px;
    }
    
    .auth-form {
        gap: 14px;
    }
    
    .auth-form-group {
        gap: 6px;
    }
    
    .auth-divider {
        margin: 16px 0;
    }
    
    /* Ensure text is readable on small screens */
    .auth-message-box h3 {
        font-size: clamp(18px, 5.5vw, 22px);
    }
    
    .auth-message-box p {
        font-size: clamp(13px, 4vw, 15px);
    }
}

/* Very small mobile screens */
@media (max-width: 375px) {
    .auth-modal {
        width: 96%;
        margin: 0 8px;
    }
    
    .auth-modal-header {
        padding: 16px 12px 10px;
    }
    
    .auth-modal-body {
        padding: 16px 12px;
    }
    
    .auth-form {
        gap: 12px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .auth-modal {
        background: #1a1a2e;
    }
    
    .auth-form-group input {
        background: rgba(255, 255, 255, 0.05);
        border-color: rgba(255, 255, 255, 0.1);
        color: #fff;
    }
}

.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-bg-primary, #0f0f23);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.auth-form {
    width: 100%;
    max-width: 440px;
    padding: 2rem;
    background: var(--color-bg-secondary, #1a1a2e);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    width: 120px;
    height: auto;
    margin-bottom: 1.5rem;
}

.auth-header h1 {
    margin: 0 0 0.5rem 0;
    font-size: 28px;
    font-weight: 600;
    color: var(--color-text-primary, #fff);
}

.auth-header p {
    margin: 0;
    font-size: 15px;
    color: var(--color-text-secondary, #999);
}

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

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--color-text-tertiary, #666);
}

.auth-footer-text {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary, #999);
}

.auth-link {
    color: #667eea;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

.auth-error {
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
    color: #ef4444;
    font-size: 14px;
    margin-top: 1rem;
}

.auth-success {
    padding: 1rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 8px;
    color: #22c55e;
    font-size: 14px;
    margin-top: 1rem;
}

/* Make sure inputs work on mobile */
.form-input, 
input.form-input, 
textarea.form-input {
    pointer-events: auto !important;
    user-select: auto !important;
    -webkit-user-select: auto !important;
    touch-action: manipulation !important;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .auth-form {
        width: 95%;
        padding: 1.5rem;
    }
    
    .auth-header h1 {
        font-size: 24px;
    }
}
