* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.raspored-section {
    margin-bottom: 30px;
    page-break-after: always;
}

.raspored-section:last-child {
    page-break-after: auto;
}

h1 {
    text-align: center;
    background-color: #4CAF50;
    color: white;
    padding: 15px;
    margin-bottom: 5px;
    border: 2px solid #000;
    font-size: 24px;
}

.informacije {
    text-align: center;
    padding: 8px;
    background-color: #f0f0f0;
    border: 1px solid #000;
    margin-bottom: 15px;
    font-weight: bold;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

th, td {
    border: 2px solid #000;
    padding: 10px;
    text-align: center;
    font-size: 14px;
}

th {
    background-color: #90EE90;
    font-weight: bold;
    text-transform: uppercase;
}

th.vrijeme-col {
    background-color: #FFD700;
}

th.sat-col {
    background-color: #FFD700;
    width: 50px;
}

td {
    background-color: white;
    min-height: 40px;
}

td.sat-col {
    background-color: #FFD700;
    font-weight: bold;
}

td.vrijeme-col {
    background-color: #FFFFE0;
    white-space: nowrap;
    font-weight: bold;
}

/* Kontrole */
.controls {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 12px 10px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    gap: 10px;
    flex-direction: column;
    align-items: center;
}

.controls button,
.controls .file-label {
    width: 45px;
    height: 45px;
    padding: 0;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.controls button:hover,
.controls .file-label:hover {
    background-color: #45a049;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.controls button:active,
.controls .file-label:active {
    transform: scale(0.95);
}

#edit-btn {
    background-color: #2196F3;
}

#edit-btn:hover {
    background-color: #0b7dda;
}

#save-btn {
    background-color: #FF9800;
}

#save-btn:hover {
    background-color: #e68900;
}

#cancel-btn {
    background-color: #f44336;
}

#cancel-btn:hover {
    background-color: #da190b;
}

.file-label {
    background-color: #9C27B0;
}

.file-label:hover {
    background-color: #7B1FA2;
}

/* Print stilovi - optimizirano za landscape */
@media print {
    @page {
        size: A4 landscape;
        margin: 8mm;
    }

    body {
        background: white;
        padding: 0;
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }

    .container {
        max-width: 100%;
        padding: 5px;
        box-shadow: none;
        border-radius: 0;
        width: 95%;
    }

    #raspored-container {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .no-print {
        display: none !important;
    }

    .raspored-section {
        page-break-inside: avoid;
        margin-bottom: 15px;
        page-break-after: auto;
        width: 100%;
    }

    .raspored-section:last-child {
        margin-bottom: 0;
    }

    h1 {
        padding: 8px;
        margin-bottom: 3px;
        font-size: 20px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .informacije {
        padding: 5px;
        margin-bottom: 8px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    table {
        margin-bottom: 0;
    }

    th, td {
        padding: 6px 8px;
        font-size: 12px;
    }

    h1, th, td, .informacije {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Responsive za manji ekran */
@media screen and (max-width: 1200px) {
    .controls {
        position: static;
        margin-bottom: 20px;
    }

    th, td {
        font-size: 12px;
        padding: 8px 4px;
    }
}

@media screen and (max-width: 768px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 8px;
        max-width: 100%;
    }

    h1 {
        font-size: 14px;
        padding: 8px;
        margin-bottom: 2px;
    }

    .informacije {
        font-size: 10px;
        padding: 4px;
        margin-bottom: 6px;
    }

    table {
        width: 100%;
    }

    th, td {
        font-size: 8px;
        padding: 3px 1px;
        border: 1px solid #000;
    }

    th.vrijeme-col, td.vrijeme-col {
        font-size: 7px;
        width: auto;
    }

    th.sat-col, td.sat-col {
        width: 25px;
        font-size: 7px;
    }

    .raspored-section {
        margin-bottom: 12px;
        padding-bottom: 80px;
    }

    /* Prebaci kontrole na donji dio */
    .controls {
        position: fixed;
        bottom: 10px;
        right: 10px;
        left: 10px;
        top: auto;
        background: rgba(255, 255, 255, 0.95);
        padding: 8px 10px;
        border-radius: 30px;
        z-index: 1000;
        display: flex;
        gap: 8px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        width: auto;
        max-width: calc(100% - 20px);
    }

    .controls button,
    .controls .file-label {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
}

/* Editable stilovi */
.editable {
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.editable:hover {
    background-color: #e3f2fd !important;
    outline: 2px solid #2196F3;
}

.editable::after {
    content: '✏️';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.editable:hover::after {
    opacity: 0.6;
}

.edit-mode {
    background-color: #fff3cd !important;
    border: 2px solid #ffc107 !important;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    animation: slideIn 0.3s;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover {
    color: #000;
}

.modal h2 {
    margin-top: 0;
    color: #333;
    border-bottom: 2px solid #4CAF50;
    padding-bottom: 10px;
}

.modal label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.modal input,
.modal select {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    box-sizing: border-box;
}

.modal input:focus,
.modal select:focus {
    outline: none;
    border-color: #4CAF50;
}

.modal-buttons {
    margin-top: 25px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-buttons button {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.modal-buttons button:first-child {
    background-color: #4CAF50;
    color: white;
}

.modal-buttons button:first-child:hover {
    background-color: #45a049;
}

.modal-buttons button:last-child {
    background-color: #f44336;
    color: white;
}

.modal-buttons button:last-child:hover {
    background-color: #da190b;
}