/* public/css/main.css */

/* --- Базовые стили --- */
body {
    font-family: 'Inter', 'Roboto', sans-serif; /* Добавил Inter, он современнее */
    background-color: #f9fafb;
    color: #333;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* === ТЁМНАЯ ТЕМА === */
html.dark body {
    background-color: #0f172a;
    color: #f1f5f9;
}

/* --- Глобальные отступы и контейнеры (Мобильная адаптация) --- */
main {
    width: 100%;
    /* На мобильных отступы меньше */
    padding: 16px !important;
}

@media (min-width: 768px) {
    main {
        padding: 32px !important; /* На десктопе больше */
    }
}

/* --- Сайдбар (Адаптивный) --- */
aside {
    /* По умолчанию скрыт на мобилках (класс hidden md:flex в HTML) */
    /* Здесь стили ссылок */
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #4b5563;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.2s ease;
    border-radius: 8px;
    margin-bottom: 2px;
    cursor: pointer;
    white-space: nowrap; /* Чтобы текст не переносился при анимации */
}

.sidebar-link:hover {
    color: #8b5cf6;
    background-color: #f3f4f6;
}

.sidebar-link.active {
    color: #73c033;
    background-color: #f0fdf4;
    font-weight: 500;
}

.sidebar-link.active i {
    color: #73c033;
}

.sidebar-link i {
    width: 24px;
    text-align: center;
}

/* Тёмная тема сайдбара */
html.dark .sidebar-link { color: #94a3b8; }
html.dark .sidebar-link:hover { color: #a78bfa; background-color: #1e293b; }
html.dark .sidebar-link.active { color: #84cc16; background-color: rgba(132, 204, 22, 0.1); }
html.dark .sidebar-link.active i { color: #84cc16; }

/* --- Таблицы (Адаптивные) --- */
/* Обертка для скролла на мобильных */
.table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dv-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px; /* Минимальная ширина, чтобы не сплющивало */
}

.dv-table th {
    background-color: #f9fafb;
    color: #1f2937;
    font-weight: 600;
    font-size: 12px; /* Чуть меньше шрифт */
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px 16px;
    text-align: left;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.dv-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
    color: #4b5563;
    vertical-align: middle;
    transition: border-color 0.3s, color 0.3s;
}

.dv-table tr:last-child td { border-bottom: none; }
.dv-table tr:hover td { background-color: #f9fafb; }

/* Тёмная тема таблиц */
html.dark .dv-table th { background-color: #1e293b; color: #e2e8f0; border-bottom-color: #334155; }
html.dark .dv-table td { border-bottom-color: #334155; color: #cbd5e1; }
html.dark .dv-table tr:hover td { background-color: #1e293b; }

/* --- Формы и инпуты --- */
.dv-input {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    padding: 0.6rem 1rem;
    font-size: 0.875rem; /* 14px */
    transition: all 0.2s;
    outline: none;
    background-color: #fff;
    color: #1f2937;
}

/* Увеличиваем тач-зону инпутов на мобильных */
@media (max-width: 640px) {
    .dv-input {
        padding: 0.75rem 1rem; 
        font-size: 16px; /* Чтобы iOS не зумил при фокусе */
    }
}

.dv-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

html.dark .dv-input {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}
html.dark .dv-input:focus {
    border-color: #a78bfa; 
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

/* Фикс автозаполнения Chrome (Dark) */
html.dark .dv-input:-webkit-autofill,
html.dark .dv-input:-webkit-autofill:hover, 
html.dark .dv-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #f1f5f9;
    -webkit-box-shadow: 0 0 0px 1000px #0f172a inset;
    transition: background-color 5000s ease-in-out 0s;
}

/* --- Типографика --- */
.page-title {
    font-size: 24px; /* Поменьше на мобильных */
    font-weight: 700;
    color: #111827;
    margin-bottom: 1rem;
    line-height: 1.2;
    transition: color 0.3s;
}

@media (min-width: 768px) {
    .page-title {
        font-size: 28px; /* Больше на десктопе */
        margin-bottom: 1.5rem;
    }
}

html.dark .page-title { color: #f1f5f9; }

/* --- Бейдж Powered By --- */
.brand-btn {
    position: relative !important; 
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-top: 24px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: fit-content !important;
    padding: 6px 12px !important; 
    border-radius: 10px !important;
    background: #0f172a !important; 
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #94a3b8 !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0.1em !important;
    text-transform: uppercase !important;
    user-select: none !important;
    cursor: default;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.brand-btn span {
    background: linear-gradient(90deg, #22d3ee, #60a5fa) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    margin-left: 4px !important;
    font-weight: 900 !important;
    font-size: 11px !important;
}

.custom-scrollbar::-webkit-scrollbar {
    width: 4px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #e5e7eb;
    border-radius: 20px;
}
html.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #334155;
}
#dv-top-loader {
    position: fixed;
    top: 0;
    left: 0;
    height: 1px; 
    width: 0%;
    z-index: 99999;
    background: linear-gradient(90deg, 
        #22d3ee, 
        #a855f7, 
        #22c55e, 
        #14b8a6,
        #6366f1
    );
    background-size: 300% 100%;
    animation: dvLoaderGradient 2s linear infinite;
    /* анимируем и ширину, и прозрачность ТОЛЬКО когда видно */
    transition: width .25s ease, opacity .35s ease;
}

/* когда скрываем — анимируем только opacity, width станет 0 без анимации */
#dv-top-loader.dv-hide {
    opacity: 0;
    transition: opacity .35s ease;
}

/* --- Toast Notifications --- */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none; /* Чтобы клики проходили сквозь контейнер */
}

.toast {
    background: #fff;
    border-left: 4px solid #8b5cf6; /* dv-purple */
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    pointer-events: auto;
    font-size: 14px;
    color: #374151;
}

.toast.show { transform: translateX(0); }
.toast.error { border-left-color: #ef4444; }
.toast.success { border-left-color: #22c55e; }

html.dark .toast {
    background: #1e293b;
    color: #f1f5f9;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}