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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    scroll-behavior: smooth;
}

::selection {
    background: var(--button-color);
    color: white;
}

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

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

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

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

@keyframes bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

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

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--surface-color) 25%, var(--surface-elevated) 50%, var(--surface-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }
.skeleton-text.long { width: 100%; }

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 12px;
}

/* Loading */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    flex-direction: column;
    gap: 12px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: var(--radius-full);
    animation: spin 0.8s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

.loading-dots {
    display: flex;
    gap: 6px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary-color);
    border-radius: var(--radius-full);
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--hint-color);
    animation: fadeIn 0.5s ease;
}

.empty-state p {
    font-size: 15px;
    line-height: 1.5;
}

.empty-state-icon {
    font-size: 56px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-illustration {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    opacity: 0.4;
}

.empty-illustration svg {
    width: 100%;
    height: 100%;
}

/* Icon system */
.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
.icon-2xl { width: 48px; height: 48px; }

/* Lucide icons - before initialization */
i[data-lucide] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Lucide icons - after initialization (becomes SVG) */
svg.lucide {
    display: inline-block;
    vertical-align: middle;
}

/* Icon sizes for SVGs */
svg.icon-xs { width: 12px; height: 12px; }
svg.icon-sm { width: 16px; height: 16px; }
svg.icon-md { width: 20px; height: 20px; }
svg.icon-lg { width: 24px; height: 24px; }
svg.icon-xl { width: 32px; height: 32px; }
svg.icon-2xl { width: 48px; height: 48px; }

/* Ensure SVGs inherit color */
svg.lucide {
    stroke: currentColor;
    fill: none;
}

/* Section title */
.section-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 2px solid var(--border-color);
    position: relative;
    color: var(--text-color);
}

/* Character count */
.char-count {
    text-align: right;
    font-size: 13px;
    color: var(--hint-color);
    margin-bottom: 12px;
}

/* HTMX */
.htmx-request .spinner {
    display: block;
}
