/**
 * @file: style.css
 * @description: Кастомные стили для Tables Manager
 * @dependencies: Bootstrap 5
 * @created: 2024-01-18
 */

/* === БАЗОВЫЕ СТИЛИ === */
:root {
    --primary-color: #162b3a;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    --sidebar-width: 280px;
    --header-height: 76px;
    --border-radius: 8px;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
.navbar-dark{
    background-color: var(--primary-color);
}
/* Body and Layout */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.stat-icon{
    width: 24px;
    height: 24px;
    text-align: center;
}
.main-content {
    flex: 1;
    padding-top: 0;
}

/* === НАВИГАЦИЯ === */
.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

.dropdown-menu {
    border: none;
    box-shadow: var(--box-shadow-lg);
    border-radius: var(--border-radius);
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

/* === КАРТОЧКИ === */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
    transform: translateY(-2px);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #e9ecef;
    padding: 1.25rem 1.5rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* === ТАБЛИЦЫ === */
.table-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    padding: 1rem 0.75rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f4;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* === СТАТИСТИЧЕСКИЕ КАРТОЧКИ === */
.stats-card {
    background: linear-gradient(135deg, #ff752d 0%, #ff4337 100%);
    color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
}

.stats-card.success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.stats-card.warning {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stats-card.info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stats-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stats-label {
    font-size: 0.875rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-change {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* === ФИЛЬТРЫ === */
.filters-panel {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
    display: block;
}

/* === КНОПКИ === */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #ff752d 0%, #ff4337 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff4337 0%, #ff4337 100%);
    transform: translateY(-1px);
}

.btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
}
.btn-success {
    background:#0762c8; 
    color: #fff;
}
.btn-success:hover {
    background:#0650a5; 
    color: #fff;
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* === BADGES И СТАТУСЫ === */
.badge {
    font-weight: 500;
    border-radius: calc(var(--border-radius) / 2);
    padding: 0.5rem 0.75rem;
}

.bg-orange {
    background-color: #fd7e14 !important;
    color: white !important;
}

.status-badge {
    display: inline-block;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    cursor: pointer;
}

.status-new { background-color: #e3f2fd; color: #1976d2; }
.status-in-progress { background-color: #fff3e0; color: #f57c00; }
.status-completed { background-color: #e8f5e8; color: #388e3c; }
.status-cancelled { background-color: #ffebee; color: #d32f2f; }

/* === ГРАФИКИ === */
.chart-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    height: 400px;
}

.chart-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: var(--dark-color);
}

/* === НАВИГАЦИЯ ПО ВКЛАДКАМ === */
.nav-tabs .nav-link {
    border: none;
    background: transparent;
    color: #6c757d;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    transition: all 0.3s ease;
}

.nav-tabs .nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.1);
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: white;
    border-bottom: 2px solid var(--primary-color);
}

.tab-content {
    padding: 1rem 0;
}

/* === ДАШБОРД === */
.dashboard-filters {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 1.5rem;
}

.dashboard-chart-tabs {
    border-bottom: none !important;
}

.dashboard-chart-tabs .nav-link {
    color: #6c757d;
    border: none;
    font-weight: 500;
    padding: 0.75rem 1rem;
}

.dashboard-chart-tabs .nav-link.active {
    color: var(--primary-color);
    background-color: transparent;
    border-bottom: 2px solid var(--primary-color);
}

.dashboard-quick-links .card {
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
}

.dashboard-quick-links .card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dashboard-quick-links .card-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.dashboard-source-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f1f3f4;
}

.dashboard-source-item:last-child {
    border-bottom: none;
}

.dashboard-source-item .badge {
    font-size: 0.875rem;
    min-width: 2.5rem;
}

/* === ПАГИНАЦИЯ === */
.pagination {
    margin-bottom: 0;
}

.page-link {
    border: none;
    color: var(--primary-color);
    font-weight: 500;
    padding: 0.75rem 1rem;
    margin: 0 0.125rem;
    border-radius: var(--border-radius);
}

.page-link:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* === FOOTER === */
.footer {
    background-color: white !important;
    border-top: 1px solid #e9ecef;
    margin-top: 2rem;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .stats-card {
        margin-bottom: 1rem;
        padding: 1rem;
    }
    
    .stats-value {
        font-size: 2rem;
    }
    
    .table-responsive {
        border-radius: var(--border-radius);
    }
    
    .chart-container {
        height: 300px;
        padding: 1rem;
    }
    
    .dashboard-quick-links .card-body {
        padding: 0.75rem;
    }
    
    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 576px) {
    #plansTable {
        font-size: 0.75rem;
    }
    
    .stats-value {
        font-size: 1.75rem;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .dashboard-source-item {
        padding: 0.5rem 0;
    }
}

/* === ДОПОЛНИТЕЛЬНЫЕ УТИЛИТЫ === */
.text-gradient {
    background: linear-gradient(135deg, #ff752d 0%, #ff4337 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #ff752d 0%, #ff4337 100%) !important;
}

.shadow-custom {
    box-shadow: var(--box-shadow-lg) !important;
}

.border-radius-custom {
    border-radius: var(--border-radius) !important;
}

/* === АНИМАЦИИ === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* === СОСТОЯНИЯ ЗАГРУЗКИ === */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === СТИЛИ ДЛЯ СТРАНИЦЫ ПЛАНОВ === */

/* Таблица планов */
#plansTable {
    font-family: 'Inter', sans-serif;
}

#plansTable thead th {
    background: linear-gradient(135deg, #ff752d 0%, #ff4337 100%);
    color: white;
    text-align: center;
    font-weight: 600;
    border: 1px solid #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

#plansTable tbody td {
    border: 1px solid #e9ecef;
    transition: all 0.2s ease;
}

#plansTable tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

#plansTable tbody tr:hover {
    background-color: #e3f2fd;
    transform: scale(1.01);
}

/* Ячейки планов */
.plan-cell {
    position: relative;
    cursor: pointer;
    min-height: 80px;
    transition: all 0.3s ease;
}

.plan-cell:hover {
    background-color: #fff3e0 !important;
    box-shadow: inset 0 0 0 2px #ff9800;
}

.plan-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1976d2;
    text-decoration: none;
    transition: all 0.2s ease;
}

.plan-value:hover {
    color: #ff9800;
    transform: scale(1.1);
}

.plan-meta {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Кнопки удаления планов */
.plan-cell .btn-outline-danger {
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plan-cell:hover .btn-outline-danger {
    opacity: 1;
}

/* Итоговая строка */
.table-info {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
    color: white;
    font-weight: 700;
}

.table-info td {
    border-color: rgba(255, 255, 255, 0.3) !important;
    font-size: 1.1rem;
}

/* Модальные окна планов */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    background: linear-gradient(135deg, #ff752d 0%, #ff4337 100%);
    color: white;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Строки регионов в модальном окне */
.region-row {
    padding: 0.75rem;
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    background-color: #f8f9fa;
    transition: all 0.2s ease;
}

.region-row:hover {
    border-color: #007bff;
    background-color: #e3f2fd;
}

.region-row .form-control {
    border: 1px solid #ced4da;
    transition: border-color 0.2s ease;
}

.region-row .form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Анимации для таблицы планов */
@keyframes planCellPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.plan-cell.updated {
    animation: planCellPulse 0.6s ease-in-out;
}

/* Индикаторы статуса планов */
.plan-status-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #28a745;
}

.plan-status-indicator.empty {
    background-color: #dc3545;
}

.plan-status-indicator.partial {
    background-color: #ffc107;
}

/* Карточки статистики планов */
.plan-stats-card {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
}

.plan-stats-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.plan-stats-card.blue {
    background: linear-gradient(135deg, #ff752d 0%, #ff4337 100%);
}

.plan-stats-card.green {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
}

.plan-stats-card.orange {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

/* Алерты */
.alert {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.alert-info {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1976d2;
    border-left: 4px solid #2196f3;
}

/* Загрузка планов */
.plans-loading {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.plans-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
}

/* Пустое состояние */
.plans-empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
}

.plans-empty-state .fa-chart-line {
    opacity: 0.3;
    margin-bottom: 2rem;
}

/* Кнопки действий планов */
.plan-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1rem;
}

.plan-actions .btn {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
}

/* Tooltip для планов */
.plan-tooltip {
    font-size: 0.75rem;
    max-width: 200px;
}

/* Адаптивность для планов */
@media (max-width: 768px) {
    .plan-cell {
        min-height: 60px;
        font-size: 0.875rem;
    }
    
    .plan-value {
        font-size: 1rem;
    }
    
    .plan-meta {
        font-size: 0.65rem;
    }
    
    .region-row {
        margin-bottom: 0.5rem;
    }
    
    .plan-stats-card {
        margin-bottom: 0.75rem;
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    #plansTable {
        font-size: 0.75rem;
    }
    
    .plan-cell {
        padding: 0.25rem;
    }
    
    .plan-value {
        font-size: 0.75rem;
    }
}

/* === ВОРОНКА ПРОДАЖ === */
.funnel-container {
    padding: 1rem 0;
    max-width: 100%;
}

.funnel-stage {
    margin-bottom: 0.75rem;
    position: relative;
}

.funnel-stage:last-child {
    margin-bottom: 0;
}

.funnel-bar {
    min-height: 60px;
    position: relative;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.funnel-bar:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.funnel-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    color: white;
    font-weight: 600;
}

.funnel-label {
    font-size: 0.95rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.funnel-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    text-align: right;
}

.funnel-count {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.funnel-percent {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 0.2rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* === ПРОГРЕСС БАРЫ === */
.progress-sm {
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background-color: #e9ecef;
}

.progress-bar {
    transition: width 0.6s ease;
}

.progress-bar.bg-gradient {
    background: linear-gradient(90deg, #ff752d 0%, #ff4337 100%);
}

/* === АНИМАЦИИ === */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.funnel-stage {
    animation: slideInUp 0.6s ease-out forwards;
}

.funnel-stage:nth-child(1) { animation-delay: 0.1s; }
.funnel-stage:nth-child(2) { animation-delay: 0.2s; }
.funnel-stage:nth-child(3) { animation-delay: 0.3s; }
.funnel-stage:nth-child(4) { animation-delay: 0.4s; }
.funnel-stage:nth-child(5) { animation-delay: 0.5s; }

/* === АДАПТИВНОСТЬ ВОРОНКИ === */
@media (max-width: 768px) {
    .funnel-container {
        padding: 0.5rem 0;
    }
    
    .funnel-bar {
        min-height: 50px;
    }
    
    .funnel-content {
        padding: 0.5rem 0.75rem;
    }
    
    .funnel-label {
        font-size: 0.85rem;
    }
    
    .funnel-count {
        font-size: 1.1rem;
    }
    
    .funnel-percent {
        font-size: 0.8rem;
    }
}

@media (max-width: 576px) {
    .funnel-bar {
        min-height: 45px;
    }
    
    .funnel-content {
        padding: 0.4rem 0.6rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }
    
    .funnel-label {
        font-size: 0.8rem;
    }
    
    .funnel-stats {
        align-items: flex-start;
        text-align: left;
    }
    
    .funnel-count {
        font-size: 1rem;
    }
    
    .funnel-percent {
        font-size: 0.75rem;
    }
}

/* === ДОПОЛНИТЕЛЬНЫЕ СТИЛИ ДЛЯ ОТЧЕТОВ === */
.trend-comparison {
    padding: 1rem 0;
}

.trend-item {
    text-align: center;
    padding: 0.5rem;
}

.trend-indicator {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 1rem;
}

.progress progress-sm {
    margin-bottom: 0.25rem;
}

#citiesChart {
    height: 320px !important;
    max-height: 400px;
    min-height: 200px;
    width: 100% !important;
    display: block;
} 