/* Plik: admin_style.css - Pełna wersja z nowymi mini-wykresami */

/* --- Zmienne i Globalne Ustawienia Panelu --- */
:root {
    --admin-bg: #f4f7f9;
    --admin-card-bg: #ffffff;
    --admin-text-color: #2c3e50;
    --admin-border-color: #e0e6ed;
    --admin-primary-color: #3498db;
    --admin-secondary-color: #e67e22;
    --admin-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    --admin-radius: 12px;
}

body.admin-view {
    background-color: var(--admin-bg);
}

.admin-panel {
    max-width: 95%;
    margin: 2rem auto;
    font-family: 'Inter', sans-serif;
    color: var(--admin-text-color);
}

/* --- Główny Layout Dashboardu (CSS Grid) --- */
.dashboard-main {
    display: grid;
    grid-template-columns: 1fr; /* Mobile-First: jedna kolumna */
    gap: 1.5rem;
}

/* --- Karty KPI (Kluczowe Wskaźniki) --- */
.dashboard-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.kpi-card {
    background: var(--admin-card-bg);
    border-radius: var(--admin-radius);
    padding: 1.5rem;
    box-shadow: var(--admin-shadow);
    text-align: center;
}

.kpi-card .kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--admin-primary-color);
    margin: 0;
}

.kpi-card .kpi-value.kpi-value-positive {
    color: #27ae60; 
}

.kpi-card .kpi-value.kpi-value-negative {
    color: #e74c3c; 
}


.kpi-card .kpi-label {
    font-size: 0.9rem;
    color: #7f8c8d;
    text-transform: uppercase;
    margin-top: 0.5rem;
}

/* --- Wykres i Tabele --- */
.card {
    background-color: var(--admin-card-bg);
    border-radius: var(--admin-radius);
    box-shadow: var(--admin-shadow);
    padding: 2rem;
    margin-bottom: 1.5rem;
        margin-top: 1.5rem;
}

.chart-container {
    position: relative;
    max-height: 400px;
    margin: 1rem 0;
}

.chart-container-medium {
    position: relative;
    max-height: 250px;
    margin: 1rem auto;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}
.results-table th, .results-table td {
    padding: 0.8rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--admin-border-color);
    transition: background-color 0.2s ease;
    vertical-align: middle;
}
.results-table th {
    font-weight: 500;
    background-color: #f8f9fa;
    color: #495057;
    text-transform: uppercase;
    font-size: 0.8rem;
}
.results-table tr:last-child td { border-bottom: none; }
.results-table tr:not(.no-hover):hover td { background-color: #f1f8fe; }
.results-table .question-text { font-weight: 500; }
.results-table tr.row-highlight td { background-color: #e3f2fd; font-weight: bold; }

/* Kolorowanie luk w tabelach */
.gap-high { color: #e74c3c; font-weight: bold; }
.gap-medium { color: #f39c12; font-weight: bold; }

.gap-positive {
    color: #27ae60; 
    font-weight: bold;
}
.gap-negative {
    color: #e74c3c;
    font-weight: bold;
}

/* Podsumowanie średniej luki nad wykresem */
.section-average-gap {
    text-align: center;
    background-color: #f8f9fa;
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    color: #495057;
}
.section-average-gap span {
    font-weight: 700;
    font-size: 1.2rem;
}

/* NOWE STYLE: Analiza segmentów */
.segment-analysis-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: center;
}
.segment-chart {
    flex: 1 1 250px; /* Flex-grow, flex-shrink, flex-basis */
}
.segment-table {
    flex: 2 1 400px;
    overflow-x: auto;
}

/* Formularze wewnątrz kart (np. logowanie, tworzenie zespołu) */
.card form .form-group {
    margin-bottom: 1rem;
}
.card form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}
.card form input[type="text"],
.card form input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--admin-border-color);
    border-radius: 8px;
    box-sizing: border-box;
}
.card .error-message {
    color: #e74c3c;
    margin-top: 1rem;
    font-weight: 500;
}
.card .success-message {
    color: #27ae60;
    margin-top: 1rem;
    font-weight: 500;
}

/* --- Zwijana sekcja <details> --- */
details.survey-results-container {
    margin-top: 2rem;
}
details.survey-results-container summary {
    font-size: 1.5rem;
    font-weight: 500;
    cursor: pointer;
    padding: 1rem 1.5rem;
    background-color: var(--admin-card-bg);
    border-radius: var(--admin-radius);
    border: 1px solid var(--admin-border-color);
    box-shadow: var(--admin-shadow);
    margin-bottom: 1rem;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
details.survey-results-container summary .arrow {
    transition: transform 0.2s;
}
details[open].survey-results-container summary .arrow {
    transform: rotate(90deg);
}

.survey-result {
    border: 1px solid var(--admin-border-color);
    border-radius: var(--admin-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background-color: var(--admin-card-bg);
}
.survey-result h3 {
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--admin-border-color);
    padding-bottom: 0.5rem;
}

/* --- Style ogólne panelu (przyciski, linki) --- */
.button-primary { background-color: var(--admin-primary-color); color: white; border: none; padding: 0.75rem 1.5rem; border-radius: 8px; cursor: pointer; transition: background-color 0.2s; text-decoration: none; display: inline-block; }
.button-primary:hover { background-color: #2980b9; }
.button-secondary { background-color: #ecf0f1; color: var(--admin-text-color); border: none; padding: 0.75rem 1.5rem; border-radius: 8px; cursor: pointer; transition: background-color 0.2s; text-decoration: none; display: inline-block; }
.button-secondary:hover { background-color: #bdc3c7; }

/* --- Media Queries (RESPONSIVE WEB DESIGN) --- */
@media (min-width: 768px) {
    .dashboard-main {
        grid-template-columns: 1fr 1.5fr;
        align-items: flex-start;
    }
    .dashboard-kpis {
        grid-column: 1 / -1;
    }
}
@media (min-width: 1200px) {
    .dashboard-main {
        grid-template-areas:
            "kpis kpis"
            "left right";
        grid-template-columns: 1fr 2fr;
    }
    .dashboard-kpis { grid-area: kpis; }
    .dashboard-left { grid-area: left; }
    .dashboard-right { grid-area: right; }
}

/* --- STYLE DLA MINI-WYKRESÓW Z SŁUPKAMI OBOK SIEBIE --- */
.action-col {
    width: 120px;
    text-align: center;
}

.sparkline-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 32px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-bottom: 2px solid var(--admin-border-color);
    background: transparent;
    position: relative;
    z-index: 1;
    transform-origin: center;
}

.sparkline-container:hover {
    background-color: #ffffff;
    transform: scale(4);
    z-index: 999;
    box-shadow: 0 8px 25px rgba(0,0,0,0.4);
    border-bottom: 1px solid var(--admin-primary-color);
    padding: 4px;
}

.spark-slot {
    flex-grow: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1px;
    height: 100%;
}

.spark-bar-current,
.spark-bar-desired {
    display: block;
    width: 3px; /* Szerokość dostosowana do 4-krotnego powiększenia */
    border-radius: 0.5px 0.5px 0 0;
}

.spark-bar-current {
    background-color: #3498db;
}

.spark-bar-desired {
    background-color: #c8103e;
}

/* Usunięcie starej animacji transformu słupków */
.sparkline-container:hover .spark-bar-current,
.sparkline-container:hover .spark-bar-desired {
    transform: none;
}

/* --- STYLE DLA OKNA MODALNEGO --- */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #ffffff;
    margin: auto;
    padding: 20px;
    border-radius: var(--admin-radius);
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
    width: 90%;
    max-width: 800px;
    animation: slideInFade 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--admin-border-color);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover,
.modal-close:focus {
    color: #000;
    text-decoration: none;
}

.modal-body {
    width: 100%;
}

@keyframes slideInFade {
    from {
        opacity: 0;
        transform: translateY(-40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* NOWY STYL DLA NOWEJ SEKCJI */
.segment-analysis-details {
    margin-top: 1.5rem;
}

/* --- STYLE DLA ZAKŁADEK (TABÓW) --- */
.tab-nav {
    display: flex;
    border-bottom: 2px solid var(--admin-border-color);
    margin-bottom: 1.5rem;
}
.tab-button {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    background-color: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 1rem;
    font-weight: 500;
    color: #7f8c8d;
    transition: color 0.2s ease, border-color 0.2s ease;
    margin-bottom: -2px; /* Aby dolna krawędź nachodziła na krawędź kontenera */
}
.tab-button:hover {
    color: var(--admin-primary-color);
}
.tab-button.active {
    color: var(--admin-text-color);
    border-bottom-color: var(--admin-primary-color);
}
.tab-pane {
    display: none;
}
.tab-pane.active {
    display: block;
}
/* --- NOWE ELEMENTY ANALITYKI --- */
.alignment-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}
.alignment-high { background: #d4edda; color: #155724; }
.alignment-med { background: #fff3cd; color: #856404; }
.alignment-low { background: #f8d7da; color: #721c24; }

.insight-item {
    padding: 15px;
    border-left: 4px solid var(--admin-primary-color);
    background: #f8f9fa;
    margin-bottom: 10px;
    border-radius: 0 4px 4px 0;
}
.insight-header {
    font-weight: bold;
    color: var(--admin-primary-color);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.open-answer-card {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
}
.open-answer-card:last-child { border-bottom: none; }
.aggregated-text-answers {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
@media (max-width: 900px) {
    .aggregated-text-answers {
        grid-template-columns: 1fr;
    }
}
.text-answer-group {
    border: 1px solid var(--admin-border-color);
    border-radius: 8px;
    background: #fbfcfd;
    overflow: hidden;
}
.text-answer-group-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--admin-border-color);
}
.text-answer-group-header h4 {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.35;
    color: var(--admin-text-color);
}
.text-answer-group-header span {
    white-space: nowrap;
    font-size: 0.78rem;
    font-weight: 800;
    color: #4a5568;
    background: #edf2f7;
    border-radius: 999px;
    padding: 0.25rem 0.55rem;
}
.text-answer-list {
    padding: 0 1rem;
}
.text-answer-content {
    color: #2d3748;
    line-height: 1.5;
}
/* --- Cohesion Analysis Styles --- */
.cohesion-hero-card {
    padding: 1.5rem 2rem;
}
.cohesion-hero-card .cohesion-scale-panel {
    border: none;
    margin-bottom: 0;
    padding: 0;
    background: transparent;
}
.cohesion-scale-panel {
    border: 1px solid var(--admin-border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    background: #fbfcfd;
}
.cohesion-scale-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}
.cohesion-scale-title {
    font-weight: 700;
    color: var(--admin-text-color);
}
.cohesion-scale-subtitle {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 0.25rem;
}
.cohesion-scale-score {
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    color: #2c3e50;
    white-space: nowrap;
}
.cohesion-methodology {
    margin-top: 1rem;
    border: 1px solid var(--admin-border-color);
    border-radius: 8px;
    background: #f8fafc;
}
.cohesion-methodology summary {
    cursor: pointer;
    padding: 0.85rem 1rem;
    font-weight: 700;
    color: #2c3e50;
    user-select: none;
}
.cohesion-methodology-body {
    padding: 0 1rem 1rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: #4a5568;
}
.cohesion-methodology-body p {
    margin: 0.75rem 0;
}
.cohesion-methodology-body ul {
    margin: 0.75rem 0 0.75rem 1.25rem;
    padding: 0;
}
.cohesion-methodology-body li {
    margin-bottom: 0.4rem;
}
.cohesion-methodology-body code {
    background: #edf2f7;
    color: #2d3748;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-size: 0.85rem;
}
@media (max-width: 1100px) {
    .cohesion-visual-grid {
        grid-template-columns: 1fr !important;
    }
}
.insight-box { background: #fdfdfd; border: 1px solid #eee; border-radius: 8px; padding: 1.5rem; }
.insight-item { margin-bottom: 1rem; padding-bottom: 0.8rem; border-bottom: 1px dashed #eee; font-size: 0.95rem; }
.insight-item:last-child { border-bottom: none; }
.recommendation { font-size: 0.8rem; color: #7f8c8d; margin-top: 4px; font-style: italic; }
.results-table .alignment-badge { padding: 4px 8px; border-radius: 12px; font-weight: bold; font-size: 0.85rem; display: inline-block; min-width: 45px; text-align: center; }
.results-table .question-text { max-width: 350px; font-size: 0.9rem; }


/* --- Trend Analysis Styles --- */
.delta-badge { font-size: 0.75rem; padding: 2px 6px; border-radius: 4px; font-weight: bold; margin-top: 5px; display: inline-block; }
.delta-pos { background: #ecfaf2; color: #27ae60; }
.delta-neg { background: #ffe6e6; color: #e74c3c; }


