/* ============================================
   WizGist Global Styles
   ============================================ */

/* Reset */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background var(--transition-base), color var(--transition-base);
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { opacity: 0.85; }

img { max-width: 100%; height: auto; }

button {
    font-family: var(--font-main);
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
    font-size: var(--font-size-sm);
}

input, textarea, select {
    font-family: var(--font-main);
    font-size: var(--font-size-base);
    outline: none;
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { opacity: 0.8; }

/* ============ Selection ============ */
::selection {
    background: var(--wiz-primary);
    color: white;
}

/* ============ Utilities ============ */
.hidden { display: none !important; }
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); border: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relative { position: relative; }

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: var(--font-size-sm);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--wiz-primary);
    color: white;
}
.btn-primary:hover {
    background: var(--wiz-primary-dark);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-ghost {
    color: var(--text-secondary);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--wiz-danger);
    color: white;
}

.btn-sm {
    padding: var(--space-1) var(--space-3);
    font-size: var(--font-size-xs);
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-base);
    border-radius: var(--radius-lg);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-lg);
}

/* ============ Animations ============ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes dotBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

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

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 0 5px var(--wiz-primary-glow); }
    50% { box-shadow: 0 0 20px var(--wiz-primary-glow), 0 0 40px rgba(124,58,237,0.1); }
}

.animate-fade-in { animation: fadeIn 0.3s ease forwards; }
.animate-fade-in-up { animation: fadeInUp 0.4s ease forwards; }
.animate-slide-left { animation: slideInLeft 0.3s ease forwards; }
.animate-pulse { animation: pulse 1.5s infinite; }

/* ============ Toast Notifications ============ */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    font-size: var(--font-size-sm);
    animation: slideInRight 0.3s ease forwards;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.toast.success { border-left: 3px solid var(--wiz-success); }
.toast.error { border-left: 3px solid var(--wiz-danger); }
.toast.warning { border-left: 3px solid var(--wiz-warning); }
.toast.info { border-left: 3px solid var(--wiz-primary); }

/* ============ Modal ============ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-overlay);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-modal);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    animation: fadeInUp 0.3s ease;
    overflow: hidden;
}

.modal-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: var(--font-size-lg);
    font-weight: 600;
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ============ Ad Containers ============ */
.ad-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
    min-height: 50px;
}

.ad-container.ad-top {
    width: 100%;
    min-height: 90px;
}

.ad-container.ad-sidebar {
    width: 300px;
    min-height: 250px;
    margin-top: var(--space-4);
}

.ad-container.ad-right {
    width: 300px;
    min-height: 600px;
}

.ad-container.ad-mobile-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    border-radius: 0;
    min-height: 50px;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 100%;
        --header-height: 56px;
    }
}