/* Основные стили плагина */
.ccjs-container {
    width: 100%;
    max-width: 1200px;
    margin: 15px auto;
    padding: 15px;
    font-family: 'Roboto', sans-serif;
    box-sizing: border-box;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.ccjs-title {
    color: #242424;
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px 0;
    line-height: 1.3;
    text-align: center;
}

.ccjs-subtitle {
    color: #7f8c8d;
    font-size: 13px;
    margin: 0 0 15px 0;
    line-height: 1.4;
    text-align: center;
    font-weight: 400;
}

/* Легенда */
.ccjs-legend-top {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
}

.ccjs-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #4a5568;
    font-weight: 500;
}

.ccjs-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 2px;
}

.ccjs-legend-color.positive {
    background: #e74c3c;
    border: 1px solid #c0392b;
}

.ccjs-legend-color.negative {
    background: #2ecc71;
    border: 1px solid #27ae60;
}

/* Основной контейнер */
.ccjs-content-wrapper {
    display: flex;
    gap: 20px;
    height: 420px; /* Компактная высота для ноутбука */
}

/* Левая часть: График */
.ccjs-chart-section {
    flex: 2;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.ccjs-chart-wrapper {
    flex: 1;
    background: #f8fafc;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    position: relative;
    min-height: 280px;
    max-height: 320px;
}

#ccjs-expense-chart {
    width: 100% !important;
    height: 100% !important;
}

/* Итоги */
.ccjs-totals {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
    margin-top: 5px;
}

.ccjs-total-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.ccjs-total-label {
    font-size: 11px;
    font-weight: 500;
    color: #666;
    text-align: center;
}

.ccjs-total-value {
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

#ccjs-total-plan {
    color: #2980b9;
}

#ccjs-total-fact {
    color: #27ae60;
}

#ccjs-total-deviation {
    color: #e74c3c;
}

/* Правая часть: Форма с прокруткой */
.ccjs-controls-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    overflow: hidden;
    min-width: 260px;
    max-width: 320px;
}

.ccjs-controls-header {
    padding: 12px;
    background: white;
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.ccjs-controls-header h4 {
    margin: 0 0 5px 0;
    color: #2c3e50;
    font-size: 14px;
    font-weight: 700;
}

.ccjs-controls-header p {
    margin: 0;
    color: #7f8c8d;
    font-size: 11px;
    line-height: 1.4;
}

/* Контейнер для полей ввода с прокруткой */
.ccjs-inputs-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Стили для скроллбара */
.ccjs-inputs-container::-webkit-scrollbar {
    width: 4px;
}

.ccjs-inputs-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.ccjs-inputs-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.ccjs-inputs-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Группа ввода */
.ccjs-input-group {
    background: white;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    position: relative;
}

.ccjs-input-group:hover {
    border-color: #3498db;
}

.ccjs-input-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.ccjs-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ccjs-input-column {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.ccjs-column-label {
    font-size: 10px;
    color: #7f8c8d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ccjs-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    color: #2c3e50;
    transition: all 0.2s ease;
    box-sizing: border-box;
    text-align: center;
}

.ccjs-input:focus {
    outline: none;
    border-color: #3498db;
}

.ccjs-input.plan {
    background: #f0f8ff;
    border-color: #3498db;
    color: #2980b9;
    cursor: not-allowed;
}

.ccjs-input.fact {
    background: #f0fff4;
    border-color: #2ecc71;
    color: #27ae60;
}

.ccjs-input.fact:focus {
    border-color: #27ae60;
}

/* Индикатор отклонения */
.ccjs-deviation-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
}

.ccjs-deviation-indicator.positive {
    background: rgba(231, 76, 60, 0.1);
    color: #e74c3c;
}

.ccjs-deviation-indicator.negative {
    background: rgba(46, 204, 113, 0.1);
    color: #2ecc71;
}

/* Футер с кнопкой */
.ccjs-controls-footer {
    padding: 12px;
    background: white;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    flex-shrink: 0;
}

.ccjs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    min-height: 36px;
    text-align: center;
    line-height: 1.3;
}

.ccjs-btn:hover {
    background: #2980b9;
}

.ccjs-btn:active {
    transform: translateY(1px);
}

.ccjs-btn-icon {
    font-size: 12px;
    flex-shrink: 0;
}

/* Адаптивность */
@media (max-width: 1024px) {
    .ccjs-content-wrapper {
        flex-direction: column;
        height: auto;
        gap: 15px;
    }
    
    .ccjs-chart-section {
        min-height: 300px;
    }
    
    .ccjs-controls-section {
        min-width: auto;
        max-width: none;
        height: 350px;
    }
    
    .ccjs-legend-top {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .ccjs-container {
        padding: 12px;
        margin: 10px auto;
    }
    
    .ccjs-title {
        font-size: 18px;
    }
    
    .ccjs-subtitle {
        font-size: 12px;
        margin-bottom: 12px;
    }
    
    .ccjs-totals {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .ccjs-input-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .ccjs-chart-wrapper {
        padding: 10px;
        max-height: 280px;
    }
    
    .ccjs-controls-header {
        padding: 10px;
    }
    
    .ccjs-controls-footer {
        padding: 10px;
    }
    
    .ccjs-inputs-container {
        padding: 10px;
        gap: 8px;
    }
    
    .ccjs-btn {
        padding: 6px 10px;
        font-size: 11px;
        min-height: 32px;
    }
    
    .ccjs-legend-item {
        font-size: 11px;
    }
    
    .ccjs-legend-top {
        padding: 6px 10px;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .ccjs-legend-top {
        flex-direction: column;
        gap: 6px;
        align-items: center;
    }
    
    .ccjs-legend-item {
        gap: 6px;
    }
    
    .ccjs-btn {
        font-size: 10px;
        padding: 5px 8px;
    }
    
    .ccjs-chart-wrapper {
        max-height: 250px;
    }
}