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

:root {
    --transition-speed: 0.3s;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 20px;
}

[data-theme="dark"] {
    --bg-primary: #1a1b2e;
    --bg-secondary: #232546;
    --bg-tertiary: #2a2d52;
    --bg-hover: #323568;
    --bg-active: #3d4178;
    --text-primary: #e8e8f0;
    --text-secondary: #9a9bb4;
    --text-muted: #6b6d87;
    --accent: #6c5ce7;
    --accent-hover: #7c6ff0;
    --accent-light: rgba(108, 92, 231, 0.15);
    --accent-glow: rgba(108, 92, 231, 0.3);
    --success: #00b894;
    --danger: #e17055;
    --warning: #fdcb6e;
    --border-color: rgba(255,255,255,0.08);
    --shadow: 0 8px 32px rgba(0,0,0,0.3);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
    --message-self: #6c5ce7;
    --message-other: #2a2d52;
    --scrollbar-thumb: #3d4178;
    --scrollbar-track: transparent;
    --overlay: rgba(0,0,0,0.6);
    --toast-bg: #232546;
    --input-bg: #1e1f3a;
}

[data-theme="light"] {
    --bg-primary: #f5f6fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f1f5;
    --bg-hover: #e8e9ef;
    --bg-active: #dddff0;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --text-muted: #b2bec3;
    --accent: #6c5ce7;
    --accent-hover: #5a4bd1;
    --accent-light: rgba(108, 92, 231, 0.08);
    --accent-glow: rgba(108, 92, 231, 0.15);
    --success: #00b894;
    --danger: #e17055;
    --warning: #fdcb6e;
    --border-color: rgba(0,0,0,0.08);
    --shadow: 0 8px 32px rgba(0,0,0,0.08);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --message-self: #6c5ce7;
    --message-other: #ffffff;
    --scrollbar-thumb: #d1d5e0;
    --scrollbar-track: transparent;
    --overlay: rgba(0,0,0,0.3);
    --toast-bg: #ffffff;
    --input-bg: #f0f1f5;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow: hidden;
    transition: background var(--transition-speed), color var(--transition-speed);
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; color: inherit; }
input, textarea { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.hidden { display: none !important; }

.fade-in {
    animation: fadeIn 0.3s ease;
}

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

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

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

@keyframes wave {
    0%, 100% { transform: scaleY(0.4); }
    50% { transform: scaleY(1); }
}

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

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--toast-bg);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    border-left: 3px solid var(--accent);
    min-width: 200px;
    backdrop-filter: blur(10px);
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast i { font-size: 18px; }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
