/* Opći stilovi */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    text-align: center;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1; /* gura footer na dno */
}

/* Header i navigacija */
header {
    background: #222;
    color: white;
    padding: 20px;
}

.nav-menu {
    display: flex;
    justify-content: center;
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-menu li {
    margin: 0 15px;
}

.nav-menu a {
    text-decoration: none;
    color: white;
    font-weight: bold;
}

/* Sekcije */
.content {
    padding: 40px;
    max-width: 900px;
    margin: auto;
    background: white;
    margin-top: 20px;
    border-radius: 10px;
    box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}

/* Flexbox za podatke */
.data-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* Kružni grafikon - CSS samo */
.pie-chart {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: conic-gradient(
        #3498db 0% 40%,  /* Industrija */
        #2ecc71 40% 75%,  /* Kućanstva */
        #f1c40f 75% 100%  /* Transport */
    );
    margin: 0 auto;
}

/* Flexbox analiza sekcija */
.analysis-flex {
    display: flex;
    justify-content: space-around;
    flex-wrap: nowrap; /* wrap */
    gap: 20px;
    margin-top: 20px;
}

.analysis-box {
    background: #e3e3e3;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 250px;
    max-width: 300px;
}

/* Flexbox za kontakt formu */
.form-flex {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

input, button {
    width: 80%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    width: 50%;
}

button:hover {
    background-color: #2980b9;
}

/* Footer */
footer {
    margin-top: 30px;
    padding: 10px;
    background: #222;
    color: white;
}

/* Responzivnost */
@media (max-width: 768px) {
    .data-container {
        flex-direction: column;
        align-items: center;
    }

    .analysis-flex {
        flex-direction: column;
        align-items: center;
    }

    .nav-menu {
        flex-direction: column;
        text-align: center;
    }

    .form-flex input, .form-flex button {
        width: 100%;
    }
}

/* ==================== STILOVI ZA TABLICU ==================== */

/* Kontejner za tablicu - omogućuje horizontalni scroll na mobitelima */
.table-container {
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Glavni stil za tablicu */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
}

/* Stil za zaglavlje tablice */
th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Stil za ćelije tablice */
td {
    padding: 10px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

/* Naizmjenično bojenje redova - poboljšava čitljivost */
tr:nth-child(even) {
    background-color: #f8f9fa;
}

/* Efekt pri prelasku mišem preko reda */
tr:hover {
    background-color: #e3f2fd;
    transition: background-color 0.3s ease;
}

/* Stil za naslov tablice (caption) */
caption {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
    color: #333;
    caption-side: top;
}

/* Posebni stil za ocjene */
td:last-child {
    font-weight: bold;
    color: #f39c12;
}

/* Stil za ID kolonu - centriranje */
td:first-child,
th:first-child {
    text-align: center;
    font-weight: 500;
}

/* Stil za godinu - centriranje */
td:nth-child(3),
th:nth-child(3) {
    text-align: center;
}

/* Stil za trajanje - centriranje */
td:nth-child(5),
th:nth-child(5) {
    text-align: center;
}

/* Stil za državu - mala slova s kapom */
td:nth-child(6) {
    font-variant: small-caps;
}

/* Responzivni stil za tablicu na malim ekranima */
@media (max-width: 768px) {
    .table-container {
        margin: 10px 0;
    }
    
    table {
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 10px;
    }
}

/* Stilovi za padajući izbornik */
.nav-menu {
    list-style: none;
    background-color: #222;

    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.nav-menu li {
    position: relative;
}

.nav-menu a {
    text-decoration: none;
    color: burlywood;
    font-weight: bold;
    padding: 10px 15px;
    display: block;
    transition: all 0.3s ease;
}

.nav-menu > li > a:hover {
    background-color: #555;
    border-radius: 5px;
}

/* Padajući izbornik - početno skriven */
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: #333;
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 180px;
    border-radius: 5px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.dropdown-menu li {
    margin: 0;
}

.dropdown-menu a {
    padding: 10px 15px;
    color: white;
    white-space: nowrap;
}

.dropdown-menu a:hover {
    background-color: #555;
}

/* Prikaz padajućeg izbornika na hover */
.dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Responzivnost za mobile */
@media (max-width: 768px) {
    .nav-menu {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        background: #444;
        margin-top: 5px;
        display: none;
    }
    
    /* Na mobitelu - klikom se otvara (hover ne radi na touch) */
    .dropdown:focus-within .dropdown-menu,
    .dropdown.active .dropdown-menu {
        display: block;
    }
    
    .dropdown-menu a {
        padding-left: 30px;
    }
}

/* ==================== CSS VARIJABLE ==================== */
:root {
    /* Boje za pie chart */
    --pie-comedy: #f1c40f;
    --pie-drama: #3498db;
    --pie-action: #e74c3c;
    --pie-animation: #2ecc71;
    --pie-horror: #9b59b6;
    --pie-other: #95a5a6;
    
    /* Boje za histogram */
    --bar-gradient-start: #667eea;
    --bar-gradient-end: #764ba2;
    --bar-hover: #f39c12;
    
    /* Dimenzije */
    --pie-size: 200px;
    --chart-card-padding: 20px;
    --chart-border-radius: 10px;
    
    /* Sjene */
    --chart-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --chart-hover-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ==================== GRAFIKONI ==================== */

/* Kontejner za grafikone */
.charts-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: center;
    margin: 30px 0;
}

/* Kartica za svaki grafikon */
.chart-card {
    background: white;
    border-radius: var(--chart-border-radius);
    padding: var(--chart-card-padding);
    box-shadow: var(--chart-shadow);
    transition: all 0.3s ease;
    flex: 1;
    min-width: 280px;
    text-align: center;
}

.chart-card:hover {
    box-shadow: var(--chart-hover-shadow);
    transform: translateY(-5px);
}

.chart-card h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2em;
}

/* ==================== PIE CHART ==================== */
.pie-chart-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.pie-chart {
    position: relative;
    width: var(--pie-size);
    height: var(--pie-size);
    border-radius: 50%;
    background: conic-gradient(
        var(--pie-comedy) 0deg 100deg,      /* 5 komedija = 100° */
        var(--pie-drama) 100deg 200deg,     /* 5 drama = 100° */
        var(--pie-action) 200deg 260deg,    /* 3 akcije = 60° */
        var(--pie-animation) 260deg 300deg, /* 2 animacije = 40° */
        var(--pie-horror) 300deg 340deg,    /* 2 horora = 40° */
        var(--pie-other) 340deg 360deg      /* 2 ostala = 20° */
    );
    box-shadow: var(--chart-shadow);
    transition: transform 0.3s ease;
}

.pie-chart:hover {
    transform: scale(1.05);
}

/* Legenda za pie chart */
.pie-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    font-size: 12px;
}

.legend-color {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 3px;
    margin-right: 5px;
    vertical-align: middle;
}

.comedy-color { background: var(--pie-comedy); }
.drama-color { background: var(--pie-drama); }
.action-color { background: var(--pie-action); }
.animation-color { background: var(--pie-animation); }
.horror-color { background: var(--pie-horror); }
.other-color { background: var(--pie-other); }

/* ==================== HISTOGRAM ==================== */
.histogram {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 20px;
    padding: 20px 0;
    min-height: 250px;
}

.bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    max-width: 60px;
}

.bar-label {
    font-size: 12px;
    font-weight: bold;
    color: #666;
    writing-mode: horizontal-tb;
}

.bar {
    width: 100%;
    background: linear-gradient(to top, var(--bar-gradient-start), var(--bar-gradient-end));
    border-radius: 5px 5px 0 0;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 20px;
}

.bar:hover {
    background: linear-gradient(to top, var(--bar-hover), #e67e22);
    transform: scaleX(1.05);
}

.bar-value {
    font-size: 12px;
    font-weight: bold;
    color: #333;
}

/* CSS varijable za vrijednosti histograma */
:root {
    --rating-9: 10;
    --rating-8: 10;
    --rating-7: 30;
    --rating-6: 30;
    --rating-5: 60;
    --rating-4: 30;
}

/* ==================== RESPONZIVNOST ==================== */
@media (max-width: 768px) {
    :root {
        --pie-size: 150px;
        --chart-card-padding: 15px;
    }
    
    .charts-container {
        flex-direction: column;
        gap: 20px;
    }
    
    .histogram {
        gap: 10px;
    }
    
    .bar-container {
        max-width: 40px;
    }
    
    .pie-legend {
        gap: 8px;
        font-size: 10px;
    }
}




/* ==================== HOVER EFEKTI ZA GRAFIKONE ==================== */

/* Hover efekt za pie chart - povećanje i sjena */
.pie-chart {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pie-chart:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* Hover efekt za pojedinačne segmente pie charta */
.pie-chart:hover {
    filter: brightness(1.02);
}

/* Hover efekt za stupce histograma */
.bar {
    transition: all 0.3s ease;
    cursor: pointer;
}

.bar:hover {
    background: linear-gradient(to top, #f39c12, #e67e22);
    transform: scaleX(1.05);
    filter: brightness(1.1);
}

/* Dodatne informacije na hover - prikazuje podatke */
.bar-container {
    position: relative;
}

.bar-container:hover .bar-value {
    transform: scale(1.2);
    color: #f39c12;
    font-weight: bold;
}

/* Tooltip za stupce - prikazuje dodatne informacije */
.bar-container::after {
    content: attr(data-info);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 5px;
    font-size: 10px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    margin-bottom: 5px;
}

.bar-container:hover::after {
    opacity: 1;
}
