/* 
 * Authentication Modal & Form Styles for Num AI Studios
 * Customized for dark theme integration
 */

/* 
 * Modal Overlay
 * Dark background when auth forms are displayed
 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 
 * Authentication Form Container
 * Houses both login and register forms with smooth transitions
 */
.auth-container {
    background: linear-gradient(145deg, #0d1117 0%, #161b22 100%);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 1px rgba(139, 92, 246, 0.5);
    border: 1px solid rgba(139, 92, 246, 0.3);
    overflow: hidden;
    width: 100%;
    max-width: 450px;
    position: relative;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: rgba(31, 41, 55, 0.8);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #9ca3af;
    transition: all 0.3s ease;
    z-index: 10;
}

.close-btn:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    color: #a855f7;
}

.form-wrapper {
    position: relative;
    width: 100%;
}

.auth-form {
    padding: 3rem;
    display: none;
}

.auth-form.active {
    display: block;
    animation: formFadeIn 0.5s ease;
}

@keyframes formFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-title {
    font-size: 2rem;
    font-weight: bold;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    text-align: center;
}

.form-subtitle {
    color: #9ca3af;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

/* 
 * Form Input Styles
 * Provides clean, modern input fields with focus states
 */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: #d1d5db;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 2px solid #374151;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
    background: rgba(31, 41, 55, 0.5);
    color: #f3f4f6;
}

.form-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.2);
    background: rgba(31, 41, 55, 0.8);
}

.form-input::placeholder {
    color: #6b7280;
}

/* 
 * Submit Button Styles
 * Primary action button with gradient background
 */
.submit-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.6);
}

.submit-btn:active {
    transform: translateY(0);
}

/* 
 * Divider for separating email/password from social login
 */
.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: #6b7280;
    font-size: 0.9rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #374151;
}

.divider span {
    padding: 0 1rem;
}

/* 
 * Google Sign-In Button Wrapper
 * Ensures proper styling for Google's auto-generated button
 */
.g_id_signin {
    width: 100% !important;
}

.g_id_signin > div {
    width: 100% !important;
}

.g_id_signin iframe {
    width: 100% !important;
}

/* 
 * Tab Navigation for switching between Login/Register
 */
.nav-buttons {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: rgba(31, 41, 55, 0.3);
    border-radius: 16px 16px 0 0;
}

.nav-btn {
    flex: 1;
    padding: 0.8rem 1.5rem;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
}

.nav-btn.active {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
}

.nav-btn:hover:not(.active) {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
    color: white;
}

/* 
 * Notification System
 */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    z-index: 1001;
    max-width: 350px;
    animation: slideIn 0.3s ease;
    display: none;
}

.notification.success {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.15);
}

.notification.error {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.15);
}

.notification.info {
    border-color: rgba(59, 130, 246, 0.5);
    background: rgba(59, 130, 246, 0.15);
}

.notification-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.notification-message {
    flex: 1;
    font-size: 0.9rem;
}

.notification-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-close:hover {
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 
 * Loading Spinner and States
 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-content {
    background: linear-gradient(145deg, #0d1117 0%, #161b22 100%);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(139, 92, 246, 0.3);
    border-top: 4px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-text {
    color: white;
    font-size: 1rem;
    font-weight: 500;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button Loading States */
.submit-btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.submit-btn.loading::after {
    content: '';
    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: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Form Loading States */
.auth-form.loading {
    opacity: 0.7;
    pointer-events: none;
}

.auth-form.loading .form-input {
    background: rgba(31, 41, 55, 0.3);
    cursor: not-allowed;
}

/* 
 * Profile Modal Styles
 */
.profile-container {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    backdrop-filter: blur(20px);
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    padding: 2.5rem;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

html.dark .profile-container {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%) !important;
    border: 2px solid rgba(139, 92, 246, 0.5) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

.gradient-text {
    background: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

html.dark .profile-field {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.profile-field:last-child {
    border-bottom: none;
}

.profile-field label {
    color: #6b7280;
    font-weight: 500;
    font-size: 0.875rem;
}

html.dark .profile-field label {
    color: #9ca3af !important;
}

.profile-field span {
    color: #111827;
    font-weight: 600;
}

html.dark .profile-field span {
    color: #f3f4f6 !important;
}

/* 
 * Top-Up Modal Styles
 */
.topup-container {
    background: linear-gradient(135deg, #ffffff 0%, #f9fafb 100%);
    backdrop-filter: blur(20px);
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    padding: 2.5rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
}

html.dark .topup-container {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%) !important;
    border: 2px solid rgba(139, 92, 246, 0.5) !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5) !important;
}

.topup-content h2 {
    color: #111827;
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 700;
}

html.dark .topup-content h2 {
    color: #f3f4f6 !important;
}

.topup-content p {
    color: #6b7280;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 1rem;
}

html.dark .topup-content p {
    color: #9ca3af !important;
}

.credit-packages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.package {
    background: linear-gradient(135deg, #f0f9ff 0%, #eff6ff 100%);
    border: 2px solid #93c5fd;
    border-radius: 16px;
    padding: 1.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    color: #1e40af;
}

@media (prefers-color-scheme: dark) {
    .package {
        background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%) !important;
        border: 2px solid rgba(139, 92, 246, 0.6) !important;
        color: #93c5fd !important;
    }
}

html.dark .package {
    background: linear-gradient(135deg, #1e3a8a 0%, #1e293b 100%) !important;
    border: 2px solid rgba(139, 92, 246, 0.6) !important;
    color: #93c5fd !important;
}

.package:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.25);
}

@media (prefers-color-scheme: light) {
    .package:hover {
        background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
        border-color: #3b82f6;
    }
}

@media (prefers-color-scheme: dark) {
    .package:hover {
        background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
        border-color: #60a5fa;
        box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4);
    }
}

html.dark .package:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%) !important;
    border-color: #60a5fa !important;
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.4) !important;
}

.package.selected {
    border-color: #3b82f6;
}

@media (prefers-color-scheme: light) {
    .package.selected {
        background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%);
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    }
}

@media (prefers-color-scheme: dark) {
    .package.selected {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    }
}

html.dark .package.selected {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5) !important;
}

.package-credits {
    color: inherit;
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

@media (prefers-color-scheme: dark) {
    .package-credits {
        color: white !important;
    }
}

html.dark .package-credits {
    color: white !important;
}

.package-price {
    color: #1e40af;
    font-weight: 800;
    font-size: 1.5rem;
    transition: color 0.3s ease;
}

@media (prefers-color-scheme: dark) {
    .package-price {
        color: #93c5fd;
    }
}

html.dark .package-price {
    color: #93c5fd !important;
}

.package:hover .package-price {
    color: #ffffff;
}

@media (prefers-color-scheme: dark) {
    .package:hover .package-price {
        color: #ffffff;
    }
}

.package-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.purchase-btn {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.purchase-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

.purchase-btn:active {
    transform: translateY(0);
}

.purchase-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
}

/* 
 * Responsive Design
 */
@media (max-width: 768px) {
    .auth-form {
        padding: 2rem 1.5rem;
    }

    .form-title {
        font-size: 1.6rem;
    }

    .credit-packages {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .topup-container,
    .profile-container {
        padding: 1.5rem;
    }

    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .auth-container {
        border-radius: 15px;
    }

    .auth-form {
        padding: 1.5rem 1rem;
    }

    .form-title {
        font-size: 1.4rem;
    }
}
