/* --- Login & Auth Modal Specific Styles --- */

.login-modal-wrapper {
    position: relative;
    width: 90%;
    max-width: 440px;
    /* transition wrapper for entry animations */
    animation: slideInBottom 0.3s ease forwards;
}

.login-modal-wrapper .login-modal-card {
    width: 100%;
    max-width: none;
    max-height: 88vh;
    padding: 2.5rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow-y: auto;
    /* Allow scroll if form is too tall */
}

/* Elegant Custom Scrollbar (Global For All Modals) */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: transparent;
    margin: 16px 0;
}

.modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.external-close-btn {
    position: absolute;
    top: 0;
    right: -3rem;
    z-index: 1001;
    font-size: 1.8rem;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    padding: 0.2rem;
}

.external-close-btn:hover {
    color: var(--text-primary);
    transform: scale(1.1);
}

.login-header {
    text-align: center;
    margin-bottom: 0.8rem;
    position: relative;
}

.login-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-bottom: 0;
}

/* Tabs */
.login-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 0.25rem;
    margin-bottom: 1rem;
}

.login-tab {
    flex: 1;
    padding: 0.6rem 0;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-tab:hover:not(.active) {
    color: var(--text-primary);
}

.login-tab.active {
    color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.login-tab[data-tab="signin"].active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.85), rgba(37, 99, 235, 0.95));
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.login-tab[data-tab="signup"].active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.85), rgba(5, 150, 105, 0.95));
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
}

/* Forms */
.login-body {
    position: relative;
    overflow: hidden;
    /* For slide transitions */
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#authForm {
    min-height: 340px;
}

#authForm .auth-submit-btn {
    margin-top: auto;
}

/* Stagger Animation for Form Elements */
.stagger-anim>* {
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUpStagger 0.4s ease forwards;
}

.stagger-anim>*:nth-child(1) {
    animation-delay: 0.05s;
}

.stagger-anim>*:nth-child(2) {
    animation-delay: 0.1s;
}

.stagger-anim>*:nth-child(3) {
    animation-delay: 0.15s;
}

.stagger-anim>*:nth-child(4) {
    animation-delay: 0.2s;
}

.stagger-anim>*:nth-child(5) {
    animation-delay: 0.25s;
}

.stagger-anim>*:nth-child(6) {
    animation-delay: 0.3s;
}

@keyframes fadeInUpStagger {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Haptic slide transition classes */
.slide-left-out {
    transform: translateX(-20px);
    opacity: 0;
    position: absolute;
    width: 100%;
    pointer-events: none;
}

.slide-right-out {
    transform: translateX(20px);
    opacity: 0;
    position: absolute;
    width: 100%;
    pointer-events: none;
}

.slide-in-from-right {
    animation: slideInRight 0.3s ease forwards;
}

.slide-in-from-left {
    animation: slideInLeft 0.3s ease forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Form Groups */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-group input:not([type="checkbox"]) {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    font-size: 0.8rem;
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.05);
    /* Ambient Glow */
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

/* Autofill Fix for Dark UI */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #1e293b inset;
    -webkit-text-fill-color: var(--text-primary);
    transition: background-color 5000s ease-in-out 0s;
}

.password-group {
    position: relative;
}

.password-input-wrapper {
    position: relative;
}

.toggle-password-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
    transition: color 0.2s;
}

.toggle-password-btn:hover {
    color: var(--text-primary);
}

.caps-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto;
}

/* Password Strength */
.password-strength {
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-bar.weak {
    width: 33%;
    background-color: #ef4444;
}

.strength-bar.fair {
    width: 66%;
    background-color: #f59e0b;
}

.strength-bar.strong {
    width: 100%;
    background-color: #10b981;
}

.password-hint-text {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    transition: color 0.3s;
}

.password-hint-text.valid {
    color: #10b981;
}

/* Input with Counter */
.input-with-counter {
    position: relative;
}

.char-counter {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.75rem;
    color: var(--text-secondary);
    pointer-events: none;
}

/* Options & Checkbox */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(15, 23, 42, 0.5);
    cursor: pointer;
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:hover {
    border-color: rgba(255, 255, 255, 0.4);
}

.checkbox-label input[type="checkbox"]:checked {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkbox-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    width: 4px;
    height: 8px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
    transform: rotate(45deg) translate(-1px, -1px);
}

.text-link,
.text-link-btn {
    background: none;
    border: none;
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.2s, text-shadow 0.2s;
}

.text-link:hover,
.text-link-btn:hover {
    color: #818cf8;
    text-shadow: 0 0 8px rgba(129, 140, 248, 0.4);
}

/* Primary Button */
.auth-submit-btn {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #4f46e5 100%);
    color: #ffffff;
    border: none;
    padding: 0.65rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
    position: relative;
    overflow: hidden;
}

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

.auth-submit-btn:disabled,
.auth-submit-btn.disabled-look {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Button Success state */
.auth-submit-btn.success-state {
    background: #10b981;
    color: #fff;
}

/* Error Message */
.auth-error-msg {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
    margin-bottom: 1rem;
    position: relative;
    z-index: 10;
}

.auth-error-msg.hidden {
    display: none;
}

.auth-success-msg {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
}

/* Shaking Animation for errors */
.shake {
    animation: shakeAnim 0.4s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shakeAnim {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Alternative Methods */
.login-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-subtle);
}

.login-divider span {
    padding: 0 1rem;
}

.alt-login-methods {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.social-login-btn,
.guest-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-default);
    padding: 0.75rem;
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.social-login-btn img {
    height: 1.2rem;
}

.social-login-btn:hover,
.guest-login-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Sync Top Progress Bar */
.top-sync-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #34d399 0%, #60a5fa 100%);
    width: 0%;
    transition: width 0.35s ease, opacity 0.3s ease, background 0.25s ease;
    border-radius: 4px 4px 0 0;
    z-index: 100;
    opacity: 0;
}

.top-sync-progress-bar.active {
    opacity: 1;
}

.top-sync-progress-bar.syncing {
    background: linear-gradient(90deg, #38bdf8 0%, #34d399 100%);
}

.top-sync-progress-bar.complete {
    background: linear-gradient(90deg, #34d399 0%, #22c55e 100%);
}

.top-sync-progress-bar.error {
    background: linear-gradient(90deg, #f97316 0%, #ef4444 100%);
}

.sync-status--syncing {
    color: #93c5fd;
}

.sync-status--ok {
    color: #6ee7b7;
}

.sync-status--error {
    color: #fca5a5;
}

/* Skeleton Loading Table */
.skeleton-row {
    position: relative;
    overflow: hidden;
}

.skeleton-row td {
    background: rgba(255, 255, 255, 0.02);
}

.skeleton-row::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.05) 50%,
            transparent 100%);
    animation: shimmer 1.5s infinite;
}

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

    100% {
        transform: translateX(100%);
    }
}

/* Header Gift Box Wrapper & Tooltip */
.gift-box-wrapper {
    display: inline-block;
    cursor: pointer;
    padding: 5px;
    position: relative;
}

.gift-box-wrapper:active {
    transform: scale(0.85) translateY(2px);
    transition: transform 0.1s ease;
}

/* Added pulse specifically for the wrapper */
.gift-box-wrapper:hover::before {
    content: attr(title);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    animation: fadeInTooltip 0.2s forwards 0.3s;
    pointer-events: none;
    z-index: 1000;
}

@keyframes fadeInTooltip {
    to {
        opacity: 1;
        bottom: -35px;
    }
}

/* Email Typo Suggestion */
.email-suggestion {
    font-size: 0.8rem;
    color: #60a5fa;
    margin-top: 4px;
    animation: fadeIn 0.3s ease;
    cursor: pointer;
}

.email-suggestion:hover {
    text-decoration: underline;
}

/* OTP Input */
.otp-input {
    text-align: center;
    letter-spacing: 0.5rem;
    font-family: monospace;
    font-size: 1.2rem;
}

.otp-input::placeholder {
    letter-spacing: normal;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
/* ?€?€ Sync Conflict Modal ?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€?€ */
.sync-conflict-card {
    max-width: 420px;
    text-align: center;
    padding: 2.5rem 2rem;
}
.sync-conflict-header {
    margin-bottom: 1.5rem;
}
.sync-conflict-header i {
    font-size: 3rem;
    color: #60a5fa;
    margin-bottom: 1rem;
    display: inline-block;
}
.sync-conflict-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.sync-conflict-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}
.sync-conflict-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.sync-conflict-btn {
    padding: 1.2rem;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: none;
}
.sync-conflict-btn.merge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    letter-spacing: 0.05em;
}
.sync-conflict-btn.overwrite {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}
.sync-conflict-btn-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}
.sync-conflict-btn.overwrite .sync-conflict-btn-title {
    font-weight: 600;
}
.sync-conflict-btn small {
    font-weight: normal;
    font-size: 0.75rem;
    opacity: 0.9;
    letter-spacing: 0;
}
.sync-conflict-btn.overwrite small {
    color: #94a3b8;
    opacity: 1;
}
