/* ============================================
   Базовые CSS переменные и общие стили
   ============================================ */

:root {
    /* Цвета */
    --bg: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    
    /* Акцентные цвета */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #dbeafe;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Специальные цвета */
    --error-bg: #fee2e2;
    --error-fg: #b91c1c;
    
    /* Размеры */
    --radius-lg: 12px;
    --radius-md: 8px;
    --radius-sm: 6px;
    
    /* Тени */
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    
    /* Отступы */
    --gap: 1rem;
    --gap-sm: 0.5rem;
    --gap-lg: 1.5rem;
    
    /* Типографика */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 0.9375rem;
    --font-size-md: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.75rem;
}

/* ============================================
   Сброс стилей
   ============================================ */

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

/* ============================================
   Базовые стили
   ============================================ */

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

/* ============================================
   Типографика
   ============================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    color: var(--text);
    letter-spacing: -0.01em;
}

h1 {
    font-size: var(--font-size-2xl);
}

h2 {
    font-size: var(--font-size-xl);
}

h3 {
    font-size: var(--font-size-lg);
}

h4 {
    font-size: var(--font-size-md);
}

p {
    margin-bottom: 0.75rem;
    font-size: var(--font-size-base);
}

/* ============================================
   Кнопки
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0;
    white-space: nowrap;
    line-height: 1.5;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow);
}

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

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   Формы
   ============================================ */

input, textarea, select {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    padding: 0.625rem 0.875rem;
    font-size: var(--font-size-sm);
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: all 0.2s ease;
    line-height: 1.5;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input::placeholder, textarea::placeholder {
    color: var(--muted);
    opacity: 0.7;
}

label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 500;
    font-size: var(--font-size-sm);
    color: var(--text);
}

/* ============================================
   Карточки
   ============================================ */

.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: var(--gap);
}

/* ============================================
   Утилиты
   ============================================ */

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
}

.error-message {
    border-radius: var(--radius-md);
    padding: 0.75rem 0.875rem;
    background: var(--error-bg);
    color: var(--error-fg);
    font-weight: 500;
    font-size: var(--font-size-sm);
    border: 1px solid rgba(185, 28, 28, 0.2);
    margin-bottom: var(--gap);
}

/* ============================================
   Toast уведомления
   ============================================ */

.toast {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: var(--primary);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transform: translateX(120px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: var(--font-size-sm);
    font-weight: 500;
    max-width: 320px;
    pointer-events: none; /* Не блокирует клики когда скрыт */
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto; /* Разрешаем клики только когда показан */
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--error);
}

/* ============================================
   Адаптивность
   ============================================ */

@media (max-width: 768px) {
    body {
        padding: 0.75rem;
        font-size: var(--font-size-sm);
    }
    
    .card {
        padding: 1rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    h1 {
        font-size: var(--font-size-xl);
    }
    
    h2 {
        font-size: var(--font-size-lg);
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.5rem;
    }
    
    .card {
        padding: 0.875rem;
    }
    
    .toast {
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
    }
}
