:root {
    --color-void: #f8fafc;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-secondary: #64748b;
    --color-primary: #0f172a;
    --color-accent: #3b82f6;
    --color-error: #ef4444;
    --color-success: #10b981;
    --font-main: 'Inter', ui-sans-serif, system-ui, sans-serif;
    
    --bg-input: rgba(0, 0, 0, 0.02);
    --bg-hover: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
    --color-void: #09090b;
    --color-surface: #18181b;
    --color-border: #3f3f46;
    --color-secondary: #a1a1aa;
    --color-primary: #ffffff;
    
    --bg-input: rgba(255, 255, 255, 0.02);
    --bg-hover: rgba(255, 255, 255, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-void);
    color: var(--color-primary);
    font-family: var(--font-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    line-height: 1.5;
    overflow-wrap: break-word;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.auth-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.auth-header {
    margin-bottom: 24px;
    text-align: center;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.022em;
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--color-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: var(--color-secondary);
}

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--color-border);
    color: var(--color-primary);
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 1px var(--color-accent);
}

.btn {
    display: block;
    width: 100%;
    background-color: var(--color-accent);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.15s;
}

.btn:hover {
    background-color: #2563eb;
}

.btn-ghost {
    background-color: transparent;
    color: var(--color-secondary);
}

.btn-ghost:hover {
    background-color: var(--bg-hover);
    color: var(--color-primary);
}

.alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 13px;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

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

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--color-secondary);
}

.auth-footer a {
    color: var(--color-accent);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .auth-container { padding: 12px; }
    .auth-card { padding: 20px; }
    
    /* Prevent iOS auto-zoom on inputs */
    .form-control, input, select, textarea {
        font-size: 16px !important;
    }
}

/* Button Loading State */
.btn.is-loading,
button.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none !important;
    cursor: wait !important;
}

.btn.is-loading::after,
button.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-top: -8px;
    margin-left: -8px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: btnSpin 0.65s linear infinite;
    -webkit-animation: btnSpin 0.65s linear infinite;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}
@-webkit-keyframes btnSpin {
    to { -webkit-transform: rotate(360deg); }
}

/* Universal In-Page Confirmation Modal */
.app-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.app-modal-overlay.active {
    display: flex;
}

.app-modal-dialog {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 24px;
    max-width: 440px;
    width: calc(100% - 32px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
    animation: modalPopIn 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-modal-title {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 17px;
    font-weight: 600;
    color: var(--color-primary);
}

.app-modal-message {
    color: var(--color-secondary);
    font-size: 14px;
    line-height: 1.55;
    margin-bottom: 24px;
}

.app-modal-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Universal Website Toast Notifications */
.website-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 380px;
    width: calc(100% - 48px);
    pointer-events: none;
}

.website-toast {
    pointer-events: auto;
    background: var(--color-surface);
    color: var(--color-primary);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    font-size: 13.5px;
    line-height: 1.5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.website-toast.toast-success {
    border-color: rgba(16, 185, 129, 0.4);
}

.website-toast.toast-error {
    border-color: rgba(239, 68, 68, 0.4);
}

.website-toast.toast-info {
    border-color: rgba(59, 130, 246, 0.4);
}

.website-toast-close {
    background: none;
    border: none;
    color: var(--color-secondary);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.website-toast-close:hover {
    opacity: 1;
    color: var(--color-primary);
}

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

/* Global Page Loader Overlay & GPU-Accelerated Dots */
.app-loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    will-change: opacity;
}

[data-theme="dark"] .app-loader-overlay {
    background: rgba(9, 9, 11, 0.82);
}

.app-loader-overlay.active {
    display: flex;
    opacity: 1;
}

.app-loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 24px 32px;
    background: var(--color-surface, #ffffff);
    border: 1px solid var(--color-border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
    text-align: center;
    min-width: 220px;
    max-width: 90vw;
}

[data-theme="dark"] .app-loader-card {
    background: var(--color-surface, #18181b);
    border-color: var(--color-border, #27272a);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.app-loader-dots {
    position: relative;
    width: 80px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-loader-dot {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translateZ(0);
}

.app-loader-dot.dot-mint {
    background: #25d8a7;
    animation: loaderOscillateMint 1.333s cubic-bezier(0.167, 0.167, 0.833, 0.833) infinite;
    -webkit-animation: loaderOscillateMint 1.333s cubic-bezier(0.167, 0.167, 0.833, 0.833) infinite;
}

.app-loader-dot.dot-cyan {
    background: #1ea8fa;
    animation: loaderOscillateCyan 1.333s cubic-bezier(0.167, 0.167, 0.833, 0.833) infinite;
    -webkit-animation: loaderOscillateCyan 1.333s cubic-bezier(0.167, 0.167, 0.833, 0.833) infinite;
}

@keyframes loaderOscillateMint {
    0%, 100% {
        transform: translate3d(-24px, 0, 0);
        -webkit-transform: translate3d(-24px, 0, 0);
    }
    50% {
        transform: translate3d(24px, 0, 0);
        -webkit-transform: translate3d(24px, 0, 0);
    }
}
@-webkit-keyframes loaderOscillateMint {
    0%, 100% {
        -webkit-transform: translate3d(-24px, 0, 0);
    }
    50% {
        -webkit-transform: translate3d(24px, 0, 0);
    }
}

@keyframes loaderOscillateCyan {
    0%, 100% {
        transform: translate3d(24px, 0, 0);
        -webkit-transform: translate3d(24px, 0, 0);
    }
    50% {
        transform: translate3d(-24px, 0, 0);
        -webkit-transform: translate3d(-24px, 0, 0);
    }
}
@-webkit-keyframes loaderOscillateCyan {
    0%, 100% {
        -webkit-transform: translate3d(24px, 0, 0);
    }
    50% {
        -webkit-transform: translate3d(-24px, 0, 0);
    }
}

.app-loader-text {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--color-primary, #0f172a);
    letter-spacing: -0.01em;
}

[data-theme="dark"] .app-loader-text {
    color: var(--color-primary, #ededed);
}
