/* Teko Financial Summary Styles - Light/Dark Theme Support */

:root {
    /* Тёмная тема (по умолчанию) */
    --tfs-bg: #1e1e1e;
    --tfs-panel-bg: #252525;
    --tfs-row-bg: #2a2a2a;
    --tfs-row-hover: #333333;
    --tfs-input-bg: #333333;
    --tfs-input-border: #444444;
    --tfs-text-main: #e0e0e0;
    --tfs-text-muted: #aaaaaa;
    --tfs-text-header: #ffd700;
    --tfs-accent: #0073aa;
    --tfs-accent-hover: #005a87;
    --tfs-border: #333333;
    --tfs-shadow: rgba(0, 0, 0, 0.4);

    /* Таблица */
    --tfs-th-bg: #333333;
    --tfs-th-text: #ffffff;
    --tfs-tr-even: #2a2a2a;
    --tfs-tr-odd: #222222;
    --tfs-tr-hover: #3b3b3b;
    --tfs-tr-summary: #444444;
    --tfs-tr-summary-text: #ffd700;
}

[data-tfs-theme="light"] {
    /* Светлая тема */
    --tfs-bg: #ffffff;
    --tfs-panel-bg: #f8f9fa;
    --tfs-row-bg: #ffffff;
    --tfs-row-hover: #f1f3f5;
    --tfs-input-bg: #ffffff;
    --tfs-input-border: #ced4da;
    --tfs-text-main: #333333;
    --tfs-text-muted: #6c757d;
    --tfs-text-header: #e6b800;
    --tfs-accent: #0073aa;
    --tfs-accent-hover: #005a87;
    --tfs-border: #e9ecef;
    --tfs-shadow: rgba(0, 0, 0, 0.08);

    /* Таблица */
    --tfs-th-bg: #f1f3f5;
    --tfs-th-text: #212529;
    --tfs-tr-even: #ffffff;
    --tfs-tr-odd: #f8f9fa;
    --tfs-tr-hover: #e9ecef;
    --tfs-tr-summary: #e2e6ea;
    --tfs-tr-summary-text: #d39e00;
}

/* Wrapper */
.tfs-summary {
    color: var(--tfs-text-main);
    background: var(--tfs-bg);
    padding: 24px;
    border-radius: 16px;
    max-width: 100%;
    margin: 0 auto;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    box-shadow: 0 8px 24px var(--tfs-shadow);
    line-height: 1.5;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Theme Switcher */
.tfs-theme-toggle {
    position: absolute;
    top: 20px;
    right: 24px;
    background: var(--tfs-panel-bg);
    border: 1px solid var(--tfs-border);
    color: var(--tfs-text-main);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    z-index: 10;
}

.tfs-theme-toggle:hover {
    transform: scale(1.1);
}

/* Header */
.tfs-summary h3 {
    margin: 0 0 24px 0;
    color: var(--tfs-text-header);
    font-size: 1.6em;
    text-align: center;
    border-bottom: 2px solid var(--tfs-border);
    padding-bottom: 16px;
    font-weight: 700;
}

/* Controls */
.tfs-time-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
    justify-content: center;
    background: var(--tfs-panel-bg);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--tfs-border);
}

.tfs-time-controls select,
.tfs-time-controls input {
    background: var(--tfs-input-bg);
    color: var(--tfs-text-main);
    border: 1px solid var(--tfs-input-border);
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    flex: 0 1 auto;
    transition: all 0.2s ease;
}

.tfs-time-controls select:focus,
.tfs-time-controls input:focus {
    border-color: var(--tfs-accent);
}

.tfs-time-controls button {
    background: var(--tfs-accent);
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    min-width: 110px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.2);
}

.tfs-time-controls button:hover {
    background: var(--tfs-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 115, 170, 0.3);
}

/* Table */
.tfs-table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--tfs-border);
}

.tfs-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--tfs-text-main);
    font-size: 14px;
    min-width: 800px;
    /* Чтобы не сжималась сильно на телефонах */
}

.tfs-table th,
.tfs-table td {
    border: 1px solid var(--tfs-border);
    padding: 12px;
    text-align: center;
}

.tfs-table th {
    background-color: var(--tfs-th-bg);
    color: var(--tfs-th-text);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.tfs-table th:hover {
    background-color: var(--tfs-accent);
    color: #fff;
}

.tfs-table th[aria-sort="ascending"]::after {
    content: " \25B2";
    font-size: 0.8em;
}

.tfs-table th[aria-sort="descending"]::after {
    content: " \25BC";
    font-size: 0.8em;
}

.tfs-table tbody tr:nth-child(even) {
    background-color: var(--tfs-tr-even);
}

.tfs-table tbody tr:nth-child(odd) {
    background-color: var(--tfs-tr-odd);
}

.tfs-table tbody tr:hover {
    background-color: var(--tfs-tr-hover);
}

.tfs-table tr.tfs-summary-row {
    background-color: var(--tfs-tr-summary) !important;
    font-weight: bold;
    color: var(--tfs-tr-summary-text);
}

.tfs-table tr.tfs-summary-row td {
    font-size: 1.1em;
}

/* Loading Skeleton */
.tfs-skeleton {
    animation: tfs-pulse 1.5s infinite;
}

.tfs-skeleton-title {
    height: 28px;
    width: 60%;
    margin: 0 auto 24px;
    background: var(--tfs-border);
    border-radius: 8px;
}

.tfs-skeleton-row {
    height: 48px;
    margin-bottom: 8px;
    background: var(--tfs-row-bg);
    border-radius: 8px;
    border: 1px solid var(--tfs-border);
}

@keyframes tfs-pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

@media (max-width: 768px) {
    .tfs-summary {
        padding: 16px;
        border-radius: 8px;
    }

    .tfs-time-controls {
        flex-direction: column;
        gap: 14px;
    }

    .tfs-time-controls select,
    .tfs-time-controls input,
    .tfs-time-controls button {
        width: 100%;
    }

    .tfs-theme-toggle {
        top: 10px;
        right: 10px;
        width: 32px;
        height: 32px;
    }
}