/* ============================================================
   Multi Calendar System v2 — base.css
   Reset + переменные + типографика. Светлая тема.
   ============================================================ */

/* ------------------------------------------------------------
   1. CSS-переменные
   ------------------------------------------------------------ */
:root {
    /* Палитра */
    --color-primary:        #1976d2;
    --color-primary-hover:  #1565c0;
    --color-primary-light:  #e3f2fd;

    --color-success:        #2e7d32;
    --color-success-light:  #e8f5e9;
    --color-warning:        #ed6c02;
    --color-warning-light:  #fff3e0;
    --color-danger:         #c62828;
    --color-danger-light:   #ffebee;

    --color-bg:             #f5f5f5;
    --color-bg-paper:       #ffffff;
    --color-bg-muted:       #fafafa;

    --color-text:           #1a1a1a;
    --color-text-muted:     #666666;
    --color-text-light:     #999999;

    --color-border:         #e0e0e0;
    --color-border-dark:    #c0c0c0;

    --color-overlay:        rgba(0, 0, 0, 0.5);

    /* Отступы */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;

    /* Радиусы */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    /* Тени */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);

    /* Типографика */
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                   "Helvetica Neue", Arial, sans-serif;
    --font-mono: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono",
                 Consolas, monospace;

    --font-size-xs: 12px;
    --font-size-sm: 13px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-2xl: 22px;
    --font-size-3xl: 28px;

    --line-height-tight: 1.25;
    --line-height-normal: 1.5;

    /* Размеры */
    --header-height: 60px;
    --nav-width-mobile: 100%;
    --content-max-width: 1400px;

    /* Транзишены */
    --transition-fast: 120ms ease;
    --transition-normal: 200ms ease;

    /* Z-index */
    --z-header: 100;
    --z-bottom-nav: 100;
    --z-modal: 1000;
    --z-toast: 1100;
}

/* ------------------------------------------------------------
   2. Reset
   ------------------------------------------------------------ */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    line-height: var(--line-height-normal);
    color: var(--color-text);
    background-color: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--space-3);
    font-weight: 600;
    line-height: var(--line-height-tight);
    color: var(--color-text);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-md); }
h6 { font-size: var(--font-size-sm); }

p {
    margin: 0 0 var(--space-3);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

ul, ol {
    margin: 0 0 var(--space-3);
    padding-left: var(--space-5);
}

img, svg, video, canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* ------------------------------------------------------------
   3. Формы (наследование шрифта)
   ------------------------------------------------------------ */
input,
textarea,
select,
button {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    padding: 0;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

/* ------------------------------------------------------------
   4. Доступность
   ------------------------------------------------------------ */
:focus {
    outline: none;
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Убираем focus-ring у мыши (не у клавиатуры) */
.js-focus-visible :focus:not(.focus-visible) {
    outline: none;
}

/* ------------------------------------------------------------
   5. Скроллбар (тонкий, светлый)
   ------------------------------------------------------------ */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--color-border-dark);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--color-text-light);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--color-border-dark) transparent;
}

/* ------------------------------------------------------------
   6. Выделение
   ------------------------------------------------------------ */
::selection {
    background-color: var(--color-primary-light);
    color: var(--color-text);
}

/* ------------------------------------------------------------
   7. Утилиты
   ------------------------------------------------------------ */
.hidden        { display: none !important; }
.invisible     { visibility: hidden !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.text-center   { text-align: center; }
.text-right    { text-align: right; }
.text-muted    { color: var(--color-text-muted); }
.text-danger   { color: var(--color-danger); }
.text-success  { color: var(--color-success); }
.text-warning  { color: var(--color-warning); }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }

.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.flex-center  { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap-1   { gap: var(--space-1); }
.flex-gap-2   { gap: var(--space-2); }
.flex-gap-3   { gap: var(--space-3); }
.flex-gap-4   { gap: var(--space-4); }

/* ------------------------------------------------------------
   8. Анимации
   ------------------------------------------------------------ */
@keyframes spin {
    to { transform: rotate(360deg); }
}

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

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

.spin {
    animation: spin 1s linear infinite;
}

/* ------------------------------------------------------------
   9. Печать
   ------------------------------------------------------------ */
@media print {
    .no-print { display: none !important; }
    body { background: white; }
    a { color: inherit; text-decoration: none; }
}