:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-bg: #f8f9fa;
    --dark-bg: #343a40;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-bg);
    padding-top: 20px;
}

.navbar-custom {
    background-color: var(--primary-color);
}

.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    border-radius: 10px 10px 0 0 !important;
}

.btn-primary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-danger {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.table-responsive {
    border-radius: 10px;
    overflow: hidden;
}

.table th {
    background-color: var(--primary-color);
    color: white;
}

.status-paid {
    background-color: #d4edda !important;
}

.status-unpaid {
    background-color: #f8d7da !important;
}

.status-selected {
    background-color: #fff3cd !important;
}

.stats-card {
    text-align: center;
    padding: 15px;
}

.stats-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.screenshot-preview {
    max-width: 100%;
    max-height: 200px;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 5px;
}

.screenshot-preview:hover {
    border-color: var(--secondary-color);
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    .btn-sm-block {
        display: block;
        width: 100%;
        margin-bottom: 5px;
    }

    .table-responsive {
        font-size: 0.9rem;
    }

    .card {
        margin-bottom: 10px;
    }
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.bill-row {
    transition: background-color 0.3s ease;
}

.bill-row:hover {
    background-color: #f8f9fa !important;
}

.form-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.stat-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.date-input-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.date-input {
    padding-right: 30px;
}

.calendar-toggle {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
}

.calendar-popup {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.calendar-nav {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 30px);
    gap: 2px;
}

.calendar-day {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 3px;
}

.calendar-day:hover {
    background-color: #f0f0f0;
}

.calendar-day.selected {
    background-color: #007bff;
    color: white;
}

.calendar-day.other-month {
    color: #ccc;
}

.date-input-container {
    position: relative;
    display: inline-block;
    width: 100%;
}

.date-input {
    padding-right: 35px;
    width: 120px;
}

.calendar-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    padding: 0;
    width: 20px;
    height: 20px;
}

.calendar-popup {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    width: 240px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 4px;
}

.calendar-month-year {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.calendar-nav {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    padding: 4px 8px;
    border-radius: 3px;
}

.calendar-nav:hover {
    background-color: #f5f5f5;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 6px;
}

.calendar-weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: #666;
    padding: 4px 0;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-day {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid transparent;
}

.calendar-day:hover {
    background-color: #f0f6ff;
    border-color: #007bff;
}

.calendar-day.selected {
    background-color: #007bff;
    color: white;
    font-weight: 600;
}

.calendar-day.today {
    background-color: #e6f7ff;
    border-color: #007bff;
    font-weight: 600;
}

.calendar-day.other-month {
    color: #ccc;
}

.calendar-day.weekend {
    color: #999;
}

/* Адаптивная таблица для мобильных устройств */
@media (max-width: 768px) {
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table thead {
        display: none;
    }

    .table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        background: white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }

    .table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 15px;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        min-height: 48px;
    }

    .table tbody td:last-child {
        border-bottom: none;
    }

    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--primary-color);
        min-width: 100px;
        margin-right: 15px;
    }

    /* Скрываем ID на мобильных */
    .table tbody td:nth-child(2) {
        display: none;
    }

    /* Адаптивные кнопки действий */
    .btn-group-sm {
        flex-wrap: wrap;
        gap: 5px;
    }

    .btn-group-sm .btn {
        flex: 1;
        min-width: 40px;
        padding: 6px;
    }

    /* Адаптивный скриншот */
    .screenshot-preview {
        max-width: 40px;
        max-height: 40px;
    }

    /* Статус в виде кружка */
    .badge {
        font-size: 0.75rem;
        padding: 4px 8px;
    }

    /* Фильтры в столбик */
    .row.mb-3 {
        flex-direction: column;
    }

    .row.mb-3 .col-md-4 {
        width: 100%;
        margin-bottom: 10px;
    }

    /* Кнопки PDF */
    .btn-group {
        flex-direction: column;
        gap: 5px;
        margin-top: 10px;
    }

    .btn-group .btn {
        width: 100%;
    }
}

/* Дополнительные улучшения для очень маленьких экранов */
@media (max-width: 480px) {
    .container-fluid {
        padding: 0 10px;
    }

    .card {
        margin-bottom: 15px;
    }

    .table tbody td {
        padding: 10px;
        font-size: 14px;
    }

    .table tbody td::before {
        min-width: 80px;
        font-size: 12px;
    }

    /* Уменьшаем отступы в карточках */
    .card-body {
        padding: 15px;
    }

    /* Адаптивная форма */
    .form-control, .form-select {
        font-size: 16px; /* Убираем zoom на iOS */
    }

    /* Навигация */
    .navbar-brand {
        font-size: 1rem;
    }

    .navbar-text {
        display: none;
    }
}

/* Улучшенное отображение для планшетов */
@media (max-width: 1024px) and (min-width: 769px) {
    .table th, .table td {
        padding: 8px;
        font-size: 14px;
    }

    .btn-group-sm .btn {
        padding: 4px 8px;
    }
}

/* Специальные стили для мобильного представления */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none;
    }

    .mobile-only {
        display: block;
    }

    /* Улучшенное отображение статуса */
    .status-badge {
        display: inline-flex;
        align-items: center;
        gap: 5px;
    }

    .status-badge::before {
        content: "";
        width: 10px;
        height: 10px;
        border-radius: 50%;
        display: inline-block;
    }

    .status-paid .status-badge::before {
        background-color: #28a745;
    }

    .status-unpaid .status-badge::before {
        background-color: #dc3545;
    }
}

/* Анимации для лучшего UX */
.bill-row {
    transition: all 0.3s ease;
}

.bill-row:active {
    transform: scale(0.98);
    background-color: #f8f9fa;
}

/* Улучшенная доступность для touch */
.btn {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.form-control, .form-select {
    min-height: 44px;
}

/* Оптимизация для iOS */
@supports (-webkit-touch-callout: none) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }

    input, select, textarea {
        font-size: 16px; /* Предотвращает zoom при фокусе */
    }
}

/* Добавьте в CSS */
.upload-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 15px 0;
}

.upload-option-btn {
    padding: 12px;
    border: 2px dashed #ccc;
    background: #f9f9f9;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.upload-option-btn:hover {
    background: #e9e9e9;
    border-color: #007bff;
}

@media (max-width: 768px) {
    .upload-options {
        flex-direction: column;
    }

    .upload-option-btn {
        font-size: 14px;
        padding: 15px;
    }
}

.screenshot-upload-container {
    padding: 10px;
}

.preview-container {
    position: relative;
}

.source-buttons .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    font-size: 14px;
}

.source-buttons .btn i {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.placeholder-container {
    padding: 40px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.file-info .alert {
    margin-bottom: 0;
}

.instructions .accordion-button {
    font-size: 14px;
    padding: 10px 15px;
}

.instructions .accordion-body {
    font-size: 13px;
    padding: 15px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .source-buttons .btn {
        min-height: 70px;
        font-size: 13px;
        padding: 10px;
    }

    .source-buttons .btn i {
        font-size: 1.3em;
    }

    .preview-container img {
        max-height: 250px !important;
    }
}

/* Анимации */
.preview-container, .placeholder-container {
    transition: all 0.3s ease;
}

.btn:active {
    transform: scale(0.98);
}

/* Улучшения для touch устройств */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .source-buttons .btn {
        min-height: 60px;
    }
}

/* Добавьте эти стили в существующий CSS */
.screenshot-upload-container {
    padding: 10px;
}

.preview-container {
    position: relative;
}

.source-buttons .btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    font-size: 14px;
}

.source-buttons .btn i {
    font-size: 1.5em;
    margin-bottom: 5px;
}

.placeholder-container {
    padding: 40px;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    background-color: #f8f9fa;
}

.file-info .alert {
    margin-bottom: 0;
}

.instructions .accordion-button {
    font-size: 14px;
    padding: 10px 15px;
}

.instructions .accordion-body {
    font-size: 13px;
    padding: 15px;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .source-buttons .btn {
        min-height: 70px;
        font-size: 13px;
        padding: 10px;
    }

    .source-buttons .btn i {
        font-size: 1.3em;
    }

    .preview-container img {
        max-height: 250px !important;
    }

    .screenshot-upload-container {
        padding: 5px;
    }
}

/* Анимации */
.preview-container, .placeholder-container {
    transition: all 0.3s ease;
}

.btn:active {
    transform: scale(0.98);
}

/* Улучшения для touch устройств */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .source-buttons .btn {
        min-height: 60px;
    }

    /* Увеличиваем область нажатия для мобильных */
    .bill-row td button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Улучшения для мобильной версии */
@media (max-width: 768px) {
    .screenshot-upload-container {
        padding: 10px;
    }

    .source-buttons .btn {
        padding: 12px 8px;
        font-size: 14px;
    }

    .source-buttons .btn i {
        font-size: 18px;
        margin-bottom: 5px;
    }

    .source-buttons .btn span {
        display: block;
        line-height: 1.2;
    }
}

/* Улучшение доступности */
.btn:active {
    transform: scale(0.98);
}

.btn:focus {
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

/* Стили для функционала буфера обмена */
.clipboard-info {
    border-left: 4px solid #ffc107;
}

.clipboard-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Мобильная адаптация для новых столбцов */
@media (max-width: 768px) {
    .table tbody td:nth-child(8), /* Комментарий */
    .table tbody td:nth-child(10), /* Дата оплаты */
    .table tbody td:nth-child(11) /* Добавил */ {
        display: none;
    }

    .table tbody td::before {
        min-width: 80px;
        font-size: 12px;
    }
}

/* Улучшения для touch устройств */
@media (hover: none) and (pointer: coarse) {
    .clipboard-info .alert {
        padding: 12px;
    }
}

.screenshot-preview {
    transition: opacity 0.3s ease;
}

.screenshot-preview.loading {
    opacity: 0.5;
}

.screenshot-placeholder {
    border: 1px dashed #dee2e6;
    border-radius: 4px;
}

/* ДОБАВЬТЕ В СТИЛИ */
.container-fluid {
    max-width: 100%;
    padding: 0 15px;
}

/* Обновляем сетку колонок */
.row {
    margin: 0;
}

.col-lg-4.col-md-6 {
    width: 30%; /* Уменьшаем левую колонку */
    max-width: 400px; /* Максимальная ширина */
    padding-right: 10px;
}

.col-lg-8.col-md-6 {
    width: 70%; /* Увеличиваем правую колонку */
    padding-left: 10px;
}

/* Адаптивность для мобильных */
@media (max-width: 992px) {
    .col-lg-4.col-md-6,
    .col-lg-8.col-md-6 {
        width: 100%;
        max-width: none;
        padding: 0;
    }
}

/* Уменьшаем отступы в карточках левой колонки */
.col-lg-4.col-md-6 .card-body {
    padding: 15px;
}

.col-lg-4.col-md-6 .card {
    margin-bottom: 15px;
}

/* Уменьшаем размеры элементов формы в левой колонке */
.col-lg-4.col-md-6 .form-control,
.col-lg-4.col-md-6 .form-select {
    padding: 6px 10px;
    font-size: 14px;
}

.col-lg-4.col-md-6 .btn {
    padding: 8px 12px;
    font-size: 14px;
}

/* Уменьшаем статистику */
.col-lg-4.col-md-6 .stats-grid {
    gap: 10px;
}

.col-lg-4.col-md-6 .stat-item {
    padding: 10px;
}

.col-lg-4.col-md-6 .stat-value {
    font-size: 1.4rem;
}

/* Увеличиваем таблицу */
.col-lg-8.col-md-6 .table-responsive {
    font-size: 14px;
}

.col-lg-8.col-md-6 .table th,
.col-lg-8.col-md-6 .table td {
    padding: 8px 6px;
}

/* Компактные кнопки действий */
.col-lg-8.col-md-6 .btn-group-sm .btn {
    padding: 4px 6px;
    font-size: 12px;
}
/* Добавьте в styles.css */
.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
    min-height: 30px;
}

.screenshot-preview {
    max-width: 40px;
    max-height: 40px;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.file-btn {
    min-width: 60px;
}
/* Стиль для выделенных строк */
tr.selected {
    background-color: #fff3cd !important; /* Желтый фон */
    border-left: 4px solid #ffc107;
}

/* Стиль для чекбоксов выделения */
.bill-checkbox {
    cursor: pointer;
}

.bill-checkbox:checked {
    accent-color: #ffc107;
}
.selected-info {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 10px;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stats-text {
    font-weight: bold;
    color: #856404;
}

.counter-text {
    color: #6c757d;
    font-size: 0.9em;
}

/* Стиль для выделенных строк */
tr.selected {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107;
}

tr.selected td {
    border-color: #ffeaa7;
}

/* Стиль для чекбоксов */
.bill-checkbox {
    cursor: pointer;
    transform: scale(1.2);
}

.bill-checkbox:checked {
    accent-color: #ffc107;
}

/* Кнопки действий */
.action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.selected-bill-item {
    transition: background-color 0.2s;
}

.selected-bill-item:hover {
    background-color: #f8f9fa;
}

.table-warning {
    background-color: #fff3cd !important;
}

.bill-selection-checkbox {
    cursor: pointer;
}

.selected-bills-list {
    max-height: 400px;
    overflow-y: auto;
}
.bill-row.selected {
    background-color: #fff9c4 !important;
    border-left: 4px solid #ffeb3b;
}

.bill-row {
    transition: background-color 0.3s ease;
}
/* Стили для выделенных строк */
.bill-row.selected {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107;
}

.bill-row.status-selected {
    background-color: #fff3cd !important;
}

/* Анимация при выделении */
.bill-row {
    transition: background-color 0.3s ease;
    cursor: pointer;
}

.bill-row:hover {
    background-color: #f8f9fa !important;
}
/* Стиль для выделенных счетов */
.status-selected {
    background-color: #fff3cd !important;
    border-left: 4px solid #ffc107;
}

/* Анимация для двойного клика */
.double-click-highlight {
    animation: doubleClickPulse 0.3s ease-in-out;
}

@keyframes doubleClickPulse {
    0% { background-color: #fff3cd; }
    50% { background-color: #ffeaa7; }
    100% { background-color: #fff3cd; }
}

/* Улучшенные стили для строк таблицы */
.bill-row {
    transition: background-color 0.2s ease;
    cursor: pointer;
}

.bill-row:hover {
    background-color: #f8f9fa;
}

.bill-row.status-paid {
    opacity: 0.7;
    background-color: #f8f9fa;
}

.bill-row.status-unpaid {
    font-weight: 500;
}
.bill-item.selected {
    background-color: #fff9c4 !important;
    border-left: 4px solid #ffeb3b !important;
}

.bill-item.selected:hover {
    background-color: #fff59d !important;
}
/* Стили для выделенных счетов */
.bill-row.selected {
    background-color: #fff9c4 !important;
    border-left: 4px solid #ffeb3b !important;
}

.bill-row.selected:hover {
    background-color: #fff59d !important;
}

/* Стили для статистики */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.875rem;
    color: #6c757d;
}
/* Стили для статистики по категориям */
#category-stats {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

#category-stats h6 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-weight: 600;
}

.category-name {
    font-size: 0.9rem;
    color: #495057;
}

.category-amount {
    font-size: 0.9rem;
    color: #28a745;
    font-weight: 600;
}

/* Адаптивность для статистики */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .stat-item {
        padding: 10px;
    }

    .stat-value {
        font-size: 1.3rem;
    }
}
/* Стили для статистики по организациям и категориям */
.organization-stats {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #e9ecef;
}

.organization-stats:last-child {
    margin-bottom: 0;
}

.org-name {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.org-name i {
    color: #6c757d;
    font-size: 0.8rem;
}

.category-name {
    color: #6c757d;
    font-size: 0.8rem;
}

.category-amount {
    color: #198754;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
    .organization-stats {
        padding: 8px;
    }

    .org-name {
        font-size: 0.85rem;
    }

    .category-name, .category-amount {
        font-size: 0.75rem;
    }
}
/* Добавьте в static/css/styles.css */
.search-highlight {
    background-color: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 3px;
    padding: 2px 4px;
    font-weight: bold;
}

.search-active {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.search-results-info {
    background-color: #e7f3ff;
    border: 1px solid #b6d4fe;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}