/* Yayın Trend Analizi CSS - Tamamen Yeniden Yazıldı */

#trend-chart-container.trend-yayin-panel--hidden,
#trend-yayin-table-block.trend-yayin-panel--hidden {
    display: none !important;
}

.trend-yayin-panels {
    position: relative;
    width: 100%;
}

.trend-analysis-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1.5rem 1.25rem 1.25rem;
    margin-bottom: 1.25rem;
}

/* Header Bölümü */
.trend-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    gap: 1rem;
}

.trend-title-section {
    flex-shrink: 0;
    min-width: 200px;
}

.trend-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.trend-title i {
    color: #4299e1;
    font-size: 1.25rem;
}

.trend-title-sep {
    color: #cbd5e1;
    margin: 0 0.5rem;
    font-weight: 300;
    user-select: none;
    font-size: 1.25rem;
    line-height: 1;
}

.trend-title .trend-subtitle {
    font-size: 0.8125rem;
    color: #718096;
    margin: 0;
    font-weight: 400;
}

.trend-subtitle {
    font-size: 0.875rem;
    color: #718096;
    margin: 0;
}

/* Filtreleme Kontrolleri */
.filtering-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

/* Tarih Seçimi */
.date-selection {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex: 1;
}

.date-range-picker {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
}

.date-input-group {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    min-width: 200px;
    align-items: center;
}

.date-input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    white-space: nowrap;
    min-width: 80px;
}

.date-input-group label i {
    color: #4299e1;
    font-size: 0.875rem;
}

.date-input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    background: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.date-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.date-input:hover {
    border-color: #a0aec0;
}

/* Periyot Seçimi */
.period-selector {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    min-width: 200px;
    flex-shrink: 0;
    align-items: center;
}

/* Analiz Butonu Bölümü */
.analyze-section {
    display: flex;
    align-items: flex-end;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}


.period-selector label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #4a5568;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    white-space: nowrap;
    min-width: 60px;
}

.period-selector label i {
    color: #4299e1;
    font-size: 0.875rem;
}

.period-buttons {
    display: flex;
    gap: 0.25rem;
    background: #e2e8f0;
    padding: 0.25rem;
    border-radius: 6px;
}

.period-btn {
    padding: 0.375rem 0.75rem;
    border: none;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #ffffff;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 40px;
    text-align: center;
}

.period-btn:hover {
    background: #f7fafc;
    color: #2d3748;
}

.period-btn.active {
    background: var(--kku-brand, #4299e1);
    color: #ffffff;
}

/* Analiz Butonu */
.analyze-button {
    padding: 0.5rem 1rem;
    background: var(--kku-brand, #4299e1);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 100px;
    justify-content: center;
}

.analyze-button:hover {
    background: var(--kku-brand-hover, #3182ce);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--kku-brand, #4299e1) 30%, transparent);
}

.analyze-button:active {
    transform: translateY(0);
}

/* Chart Container */
.trend-chart-container {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    min-height: 350px;
}

#trend-chart {
    width: 100%;
    height: 350px;
}

/* Loading: loading-animation.css (proje genelinde aynı yapı) */

/* Error */
.trend-error {
    text-align: center;
    padding: 2rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    min-height: 350px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.trend-error h3 {
    color: #e53e3e;
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.trend-error p {
    color: #718096;
    margin: 0 0 1rem 0;
}

.trend-error-btn {
    padding: 0.5rem 1rem;
    background: #4299e1;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.trend-error-btn:hover {
    background: #3182ce;
}

/* Responsive */
@media (max-width: 1200px) {
    .trend-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .trend-title-section {
        min-width: auto;
    }
    
    .filtering-controls {
        width: 100%;
    }
    
    .date-range-picker {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-input-group {
        min-width: auto;
        flex-direction: column;
        align-items: stretch;
    }
    
    /* Sadece eski trend-header / filtering-controls düzeni; yillik-yayin toolbar satır kalsın */
    .filtering-controls .period-selector {
        min-width: auto;
        align-self: stretch;
        flex-direction: column;
        align-items: stretch;
    }
    
    .period-buttons {
        justify-content: center;
    }
    
    .analyze-section {
        flex: none;
        justify-content: center;
    }
    
    .analyze-button {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 991.98px) {
    #yayin-trend-analizi-root {
        padding: 1.1rem 0.35rem 0.75rem;
    }

    #yayin-trend-analizi-root .trend-chart-container {
        padding: 0.3rem 0.08rem 0.25rem;
        min-height: 280px;
        border: none;
        background: transparent;
    }

    #yayin-trend-analizi-root #trend-chart {
        height: 280px !important;
        min-height: 280px;
    }

    #patent-tescil-durum-container {
        padding: 1.1rem 0.9rem 1rem;
    }

    .birim-analiz-page #yayin-trend-analizi-root {
        padding: 1.1rem 0.75rem 1rem;
    }

    #yayin-trend-analizi-root .yillik-yayin-toolbar.trend-yayin-toolbar .trend-yayin-period-field {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.3rem 0.35rem;
    }

    #yayin-trend-analizi-root .yillik-yayin-toolbar.trend-yayin-toolbar .trend-yayin-period-field .period-buttons {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
    }

    #yayin-trend-analizi-root .yillik-yayin-toolbar.trend-yayin-toolbar .period-btn {
        flex: 1 1 0;
        min-width: 0;
        min-height: 1.7rem;
        padding: 0.2rem 0.28rem;
        font-size: 0.66rem;
    }
}

@media (max-width: 767px) {
    .trend-analysis-container:not(.yillik-yayin-section):not(.birim-trend-container) {
        padding: 0.6rem 0.5rem 0.85rem;
    }
    .date-selection,
    .analyze-section {
        padding: 0.75rem;
    }
    
    .period-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .period-btn {
        flex: 1;
        min-width: 60px;
    }
}

/* Trend: yıl alanları + periyot (Yıllara göre kartıyla aynı toolbar) */
.period-selector .trend-period-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #4a5568;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

.period-selector .trend-period-label i {
    color: #4299e1;
    font-size: 0.8rem;
}

.yillik-yayin-toolbar.trend-yayin-toolbar .trend-yayin-period-field {
    flex: 0 1 auto;
}

.yillik-yayin-toolbar.trend-yayin-toolbar .trend-yayin-period-field .period-selector {
    min-width: 0;
    gap: 0.4rem 0.55rem;
}

.yillik-yayin-toolbar.trend-yayin-toolbar .period-btn {
    min-height: 1.85rem;
    padding: 0.25rem 0.45rem;
    font-size: 0.72rem;
    font-weight: 600;
}

.yillik-yayin-toolbar .yillik-yayin-input[type="date"] {
    min-width: 10.5rem;
    width: auto;
    max-width: 100%;
}
