/* components.css — Повторяющиеся компоненты */

/* Сетка объектов — адаптивная */
.obj-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
@media (min-width: 600px) { .obj-grid { grid-template-columns: 1fr 1fr 1fr; gap: 12px; } }
@media (min-width: 900px) { .obj-grid { grid-template-columns: 1fr 1fr 1fr 1fr; } }
.obj-tile { border-radius: var(--radius); background: rgba(255,255,255,0.09); border: 1px solid rgba(59,130,246,0.3); box-shadow: 0 0 8px rgba(59,130,246,0.15), 0 2px 8px rgba(0,0,0,0.2); cursor: pointer; overflow: hidden; transition: all 0.2s ease; backdrop-filter: blur(10px); }
.obj-tile:hover { transform: translateY(-3px); box-shadow: 0 0 14px rgba(59,130,246,0.25), 0 6px 16px rgba(0,0,0,0.3); }
.obj-tile:active { transform: scale(0.97) translateY(0); }
.obj-tile.active { border-color: rgba(59,130,246,0.6); box-shadow: 0 0 18px rgba(59,130,246,0.4), 0 2px 12px rgba(0,0,0,0.3); }
.obj-tile-img { width: 100%; aspect-ratio: 4/3; background-size: cover; background-position: center; display: block; background-color: rgba(255,255,255,0.06); }
.obj-tile-placeholder { display: flex; align-items: center; justify-content: center; font-size: 32px; opacity: 0.3; background: linear-gradient(135deg, rgba(255,255,255,0.05), rgba(255,255,255,0.08)); }
.obj-tile-body { padding: 10px 12px 12px; }
.obj-tile-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
.obj-tile-meta { font-size: 12px; color: var(--muted); }

/* Смета карточка */
.est-item { display: flex; align-items: center; gap: 10px; padding: 12px; background: rgba(255,255,255,0.09); border: 1px solid rgba(59,130,246,0.3); border-radius: var(--radius); margin-bottom: 6px; cursor: pointer; transition: all 0.2s ease; box-shadow: 0 0 8px rgba(59,130,246,0.15); }
.est-item:hover { transform: translateY(-2px); box-shadow: 0 0 14px rgba(59,130,246,0.25), 0 4px 12px rgba(0,0,0,0.25); }
.est-item:active { transform: scale(0.98) translateY(0); }
.est-info { flex: 1; min-width: 0; }
.est-name { font-weight: 600; font-size: 14px; }
.est-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.est-badge { padding: 3px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.est-draft { background: rgba(59,130,246,0.2); color: #60a5fa; }
.est-sent { background: rgba(245,158,11,0.2); color: #fbbf24; }
.est-approved { background: rgba(34,197,94,0.2); color: #4ade80; }
.est-rejected { background: rgba(239,68,68,0.2); color: #f87171; }

/* Модальное окно (dialog animate-ui style: fade + zoom + slide) */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6); z-index: 200;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px);
    opacity: 1;
    transition: opacity 0.2s ease;
}
.modal-overlay.modal-hidden { opacity: 0; pointer-events: none; }
.modal {
    background: linear-gradient(135deg, #141e30, #0d1b3e);
    border: 1px solid rgba(59,130,246,0.3);
    border-radius: 16px; padding: 24px;
    max-width: 400px; width: 90%;
    box-shadow: 0 0 20px rgba(59,130,246,0.2), 0 20px 60px rgba(0,0,0,0.5);
    opacity: 1;
    transform: translateY(0) scale(1);
    transition: opacity 0.25s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}
.modal.modal-hidden {
    opacity: 0;
    transform: translateY(8px) scale(0.95);
}
@media (prefers-reduced-motion: reduce) {
    .modal-overlay, .modal { transition: opacity 0.15s ease; }
    .modal.modal-hidden { transform: none; }
}
.modal h2 { font-size: 18px; margin-bottom: 16px; color: #fff; }
.modal-body-scroll { max-height: 50vh; overflow-y: auto; padding-right: 4px; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }
.modal-btn { flex: 1; padding: 10px; }

/* Toast */
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: rgba(30,41,59,0.9); color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 13px; z-index: 300; backdrop-filter: blur(10px); border: 1px solid rgba(59,130,246,0.3); animation: fadeInOut 2.5s forwards; box-shadow: 0 0 10px rgba(59,130,246,0.2); }
@keyframes fadeInOut { 0% { opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } 100% { opacity: 0; } }

/* Пустое состояние */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: rgba(255,255,255,0.7); }

/* === Кастомный чекбокс (как в animate-ui HeadlessCheckbox) ===
   Применяется ко ВСЕМ input[type="checkbox"] в проекте, без изменения DOM.
   Скрытая нативная кнопка + кастомный бокс с анимированной галочкой.
   Поддержка :checked, :disabled, :indeterminate. */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
    border: 2px solid rgba(100, 116, 139, 0.6);
    border-radius: 6px;
    background: transparent;
    position: relative;
    display: inline-block;
    vertical-align: middle;
    transition: background-color 0.2s cubic-bezier(0.22, 1, 0.36, 1),
                border-color 0.2s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.15s ease;
}
/* Псевдоэлемент с галочкой (SVG как background-image) */
input[type="checkbox"]::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 13l4 4L19 7'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 75% 75%;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.18s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}
/* Состояние :checked */
input[type="checkbox"]:checked {
    background-color: #3b82f6;
    border-color: #3b82f6;
}
input[type="checkbox"]:checked::after {
    opacity: 1;
    transform: scale(1);
}
/* Состояние :indeterminate (как в HeadlessCheckbox) */
input[type="checkbox"]:indeterminate {
    background-color: #3b82f6;
    border-color: #3b82f6;
}
input[type="checkbox"]:indeterminate::after {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round'><path d='M5 12h14'/></svg>");
    background-size: 70% 70%;
    opacity: 1;
    transform: scale(1);
}
/* Фокус-кольцо для доступности */
input[type="checkbox"]:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}
/* Отключённое состояние */
input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
/* Лёгкий фидбек на нажатие */
input[type="checkbox"]:active { transform: scale(0.92); }
@media (prefers-reduced-motion: reduce) {
    input[type="checkbox"],
    input[type="checkbox"]::after { transition: none; }
}

/* FAB */
.fab { position: fixed; bottom: 80px; right: 20px; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; border: none; font-size: 24px; cursor: pointer; box-shadow: 0 0 12px rgba(59,130,246,0.4), 0 4px 16px rgba(59,130,246,0.3); z-index: 150; display: flex; align-items: center; justify-content: center; }
.fab:active { transform: scale(0.95); }

/* Секции */
.section-title { font-size: 15px; font-weight: 600; padding: 12px 0 6px; }
