/* Auth Page Styles */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.auth-page .main-content {
    display: none;
}

.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

/* Tabs */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
}

.auth-tab {
    flex: 1;
    padding: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.auth-tab:hover {
    color: #1a1a2e;
}

.auth-tab.active {
    color: #667eea;
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 3px 3px 0 0;
}

/* Form */
.auth-form {
    padding: 2rem;
}

.auth-form h2 {
    margin: 0 0 0.5rem 0;
    color: #1a1a2e;
    font-size: 1.5rem;
}

.auth-subtitle {
    color: #64748b;
    margin: 0 0 1.5rem 0;
    font-size: 0.9rem;
}

.auth-form .form-group {
    margin-bottom: 1.25rem;
}

.auth-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.auth-form input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

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

.auth-form input::placeholder {
    color: #94a3b8;
}

/* Auth Button */
.auth-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 0.5rem;
}

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

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

.auth-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* Error Message */
.error-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin: 0.5rem 0;
    padding: 0.75rem;
    background: #fef2f2;
    border-radius: 8px;
    display: none;
}

.error-message.visible {
    display: block;
}

/* Success Message */
.success-message {
    color: #16a34a;
    font-size: 0.875rem;
    margin: 0.5rem 0;
    padding: 0.75rem;
    background: #f0fdf4;
    border-radius: 8px;
    display: none;
}

.success-message.visible {
    display: block;
}

/* Forgot Password Link */
.forgot-password-link {
    color: var(--primary, #667eea);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.forgot-password-link:hover {
    color: var(--secondary, #764ba2);
    text-decoration: underline;
}

.back-link {
    color: var(--gray-600, #718096);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}

.back-link:hover {
    color: var(--primary, #667eea);
}

/* Success message styling */
.success-message {
    color: #166534;
    font-size: 0.875rem;
    text-align: center;
    margin: 0.5rem 0;
    padding: 0.75rem;
    background: #dcfce7;
    border: 1px solid #86efac;
    border-radius: 8px;
    display: none;
}

/* User Info Bar - Premium Design */
.user-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    overflow: hidden;
}

.user-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg,
        rgba(255,255,255,0) 0%,
        rgba(255,255,255,0.1) 50%,
        rgba(255,255,255,0) 100%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.user-bar .user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
    z-index: 1;
}

.user-bar .user-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-bar .user-avatar svg {
    width: 22px;
    height: 22px;
    color: white;
}

.user-bar .user-details {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.user-bar .user-greeting {
    font-size: 0.7rem;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.user-bar .user-name {
    font-size: 1rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-bar .logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.user-bar .logout-btn svg {
    width: 16px;
    height: 16px;
}

.user-bar .logout-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.user-bar .logout-btn:active {
    transform: translateY(0);
}

/* Body offset for fixed navigation */
body {
    padding-top: 65px;
    margin: 0;
    overflow-x: hidden;
}

/* Body offset when user bar is also visible */
body.user-logged-in {
    padding-top: 123px; /* 58px user bar + 65px nav */
}

/* iOS safe area support */
@supports (padding-top: env(safe-area-inset-top)) {
    body {
        padding-top: calc(65px + env(safe-area-inset-top));
    }

    body.user-logged-in {
        padding-top: calc(123px + env(safe-area-inset-top));
    }
}

/* Responsive */
@media (max-width: 480px) {
    body {
        padding-top: 55px;
    }

    body.user-logged-in {
        padding-top: 107px; /* 52px user bar + 55px nav */
    }

    .user-bar {
        padding: 0.6rem 1rem;
        width: 100%;
    }

    .user-bar .user-avatar {
        width: 36px;
        height: 36px;
    }

    .user-bar .user-avatar svg {
        width: 18px;
        height: 18px;
    }

    .user-bar .user-greeting {
        font-size: 0.65rem;
    }

    .user-bar .user-name {
        font-size: 0.9rem;
    }

    .user-bar .logout-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }

    .user-bar .logout-btn span {
        display: none;
    }
}

/* Loading spinner */
.auth-btn.loading span {
    opacity: 0;
}

.auth-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Premium Popup Styles */
.premium-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    animation: fadeIn 0.4s ease;
}

.premium-popup {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 340px;
    padding: 0;
    text-align: center;
    position: relative;
    animation: popupSlideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 25px 80px -12px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: visible;
}

@keyframes popupSlideUp {
    from {
        opacity: 0;
        transform: translateY(60px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup-close-x {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 28px;
    height: 28px;
    border: none;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    font-size: 1.2rem;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    line-height: 1;
    z-index: 10;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.popup-close-x:hover {
    background: #fff;
    color: #1a1a2e;
    transform: rotate(90deg);
}

.premium-popup-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    padding: 2rem 1.5rem 2rem;
    position: relative;
    overflow: visible;
    border-radius: 20px 20px 0 0;
}

.premium-popup-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(10%, 10%); }
}

.qr-preview-mini {
    width: 70px;
    height: 70px;
    background: white;
    border-radius: 12px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.qr-preview-mini canvas {
    width: 55px !important;
    height: 55px !important;
}

.success-badge {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    border: 3px solid white;
    animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

@keyframes successPop {
    from {
        transform: translateX(-50%) scale(0);
    }
    to {
        transform: translateX(-50%) scale(1);
    }
}

.success-badge svg {
    width: 16px;
    height: 16px;
    color: white;
}

.premium-popup h2 {
    font-size: 1.2rem;
    color: #1a1a2e;
    margin: 1.25rem 0 0.25rem;
    font-weight: 700;
    padding: 0 1.5rem;
}

.popup-subtitle {
    color: #64748b;
    margin: 0 0 1rem;
    font-size: 0.85rem;
    padding: 0 1.5rem;
}

.premium-features {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin: 0 1rem 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 12px;
}

.feature {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.65rem;
    color: #475569;
    font-weight: 500;
}

.feature-icon {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.feature-icon svg {
    width: 16px;
    height: 16px;
    color: #667eea;
}

.popup-actions {
    padding: 0 1.25rem 1rem;
}

.premium-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.premium-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

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

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s ease;
}

.primary-btn:hover::before {
    left: 100%;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

.separator {
    display: flex;
    align-items: center;
    margin: 0.6rem 0;
    color: #94a3b8;
    font-size: 0.75rem;
}

.separator::before,
.separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.separator span {
    padding: 0 0.75rem;
}

.secondary-btn {
    background: #f8fafc;
    color: #475569;
    border: 2px solid #e2e8f0;
}

.secondary-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-2px);
}

.secondary-btn svg {
    color: #667eea;
}

.popup-footer {
    padding: 0.75rem 1rem;
    margin: 0;
    color: #94a3b8;
    font-size: 0.7rem;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

@media (max-width: 480px) {
    .premium-popup {
        border-radius: 20px;
        margin: 0.5rem;
    }

    .premium-features {
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .feature {
        font-size: 0.7rem;
    }

    .feature-icon {
        width: 35px;
        height: 35px;
    }

    .popup-actions {
        padding: 0 1.5rem 1rem;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.3s ease;
}

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

.modal-content.premium-modal {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border-radius: 24px;
    width: 100%;
    max-width: 380px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: modalSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.35),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

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

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-close:hover {
    background: #e2e8f0;
    color: #1a1a2e;
    transform: rotate(90deg);
}

/* Premium Auth Tabs */
.premium-modal .auth-tabs {
    display: flex;
    margin: 0;
    background: #f1f5f9;
    padding: 0.35rem;
    border-radius: 16px;
    margin: 1rem 1.25rem 0;
}

.premium-modal .auth-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s ease;
}

.premium-modal .auth-tab svg {
    width: 18px;
    height: 18px;
}

.premium-modal .auth-tab.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.premium-modal .auth-tab:not(.active):hover {
    color: #475569;
}

/* Form Header */
.form-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.form-header h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 0.25rem;
}

.form-header p {
    font-size: 0.85rem;
    color: #64748b;
    margin: 0;
}

/* Premium Form */
.premium-modal .auth-form {
    padding: 1.25rem 1.25rem 1.5rem;
}

.premium-modal .form-group {
    margin-bottom: 0.875rem;
}

/* Input with Icon */
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper svg {
    position: absolute;
    left: 1rem;
    width: 18px;
    height: 18px;
    color: #94a3b8;
    transition: color 0.3s ease;
    pointer-events: none;
}

.input-icon-wrapper input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    background: white;
}

.input-icon-wrapper input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.input-icon-wrapper input:focus + svg,
.input-icon-wrapper:focus-within svg {
    color: #667eea;
}

.input-icon-wrapper input::placeholder {
    color: #94a3b8;
}

/* Submit Button */
.auth-submit-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-top: 0.5rem;
}

.auth-submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.5s ease;
}

.auth-submit-btn:hover::before {
    left: 100%;
}

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

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

.auth-submit-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.auth-submit-btn:hover svg {
    transform: translateX(4px);
}

/* Footer Text */
.auth-footer-text {
    text-align: center;
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 1rem 0 0;
}

/* Error Message Premium */
.premium-modal .error-message {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 480px) {
    .auth-container {
        padding: 1rem;
    }

    .auth-box {
        border-radius: 12px;
    }

    .auth-form {
        padding: 1.5rem;
    }

    .auth-form h2 {
        font-size: 1.25rem;
    }

    .modal-content {
        border-radius: 16px;
        max-height: 95vh;
    }

    .modal-header {
        padding: 1.5rem 1.5rem 1rem;
    }

    .modal-header h2 {
        font-size: 1.25rem;
    }

    .modal-content .auth-form {
        padding: 1rem 1.5rem 1.5rem;
    }
}
