html {
    overflow-y: scroll; /* DODATO - uvek prikazuje scrollbar */
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f5f7fa;
    font-family: 'Inter', sans-serif;
    color: #2d3748;
    padding-top: 85px; /* DODATO - da sadržaj ne ide ispod fiksnog headera */
}

header {
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.header-content {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-main-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
    flex: 0 0 auto;
    white-space: nowrap;
    width: 220px;
}

.header-content.has-page-title .header-main-title {
    font-size: 16px;
    margin-right: 24px;
    width: 180px;
}

.header-page-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
    flex: 1 1 auto;
    text-align: center;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
}

.user-info {
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
    padding: 0 12px;
    white-space: nowrap;
    min-width: unset;  
}

.header-btn {
    padding: 8px 16px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: unset;  
    text-align: center;
    display: inline-block;
}

.header-btn:hover {
    background: #3182ce;
    /*transform: translateY(-1px);*/
}

.header-main-title .title-link {
    color: #4299e1;
    text-decoration: none;
    transition: color 0.2s;
}

.header-main-title .title-link:hover {
    color: #3182ce;
}

/* Naslov stranice - centralni prostor */
/* .header-page-title {
    font-size: 24px;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
    flex: 1 1 auto; 
    text-align: center; 
    white-space: nowrap;
} */

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 0 0 auto;
    margin-left: auto;
}

.user-info {
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
    padding: 0 12px;
    white-space: nowrap;
    min-width: unset;  
}

.header-btn {
    padding: 8px 16px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: unset;  
    text-align: center;
    display: inline-block;
}

.header-btn:hover {
    background: #3182ce;
    transform: translateY(-1px);
}

.logout-btn {
    background: #fc8181;
    min-width: unset;  
    color: white;
}

.logout-btn:hover {
    background: #f56565;
}

/* ================= CONTROLS ================= */
.controls-section {
    max-width: 1200px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 32px;
    margin: 32px auto;
    width: 90%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
    align-items: end;
}

.control-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.control-group label {
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.control-group input,
.control-group select {
    padding: 12px 16px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    background: #f7fafc;
    height: 48px;
}

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

.add-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.add-btn:hover {
    background: #38a169;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

/* ================= BOOKS ================= */
.books-section {
    max-width: 1200px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 32px;
    margin: 32px auto;
    max-width: 1200px;
    width: 90%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    min-height: 600px;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
    align-items: stretch;
}

.book {
    background: #fafafa;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.book:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
    border-color: #cbd5e0;
}

.book img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    border-bottom: 1px solid #e2e8f0;
}

.book-info {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.book-info h2 {
    font-size: 15px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 8px;
    line-height: 1.4;
    min-height: 42px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-info p {
    font-size: 13px;
    color: #718096;
    line-height: 1.5;
    margin-bottom: 8px;
}

.zanrovi-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.zanr-tag {
    font-size: 11px;
    padding: 4px 8px;
    background: #e6fffa;
    color: #234e52;
    border-radius: 4px;
    border: 1px solid #81e6d9;
}

.book-status {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-available { 
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.status-unavailable { 
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #fc8181;
}

.book-actions {
    padding: 12px 16px;
    display: flex;
    gap: 8px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
}

.btn-edit, .btn-delete, .btn-view {
    flex: 1;
    padding: 8px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    background: white;
}

.btn-view {
    color: #4299e1;
    border-color: #4299e1;
}

.btn-view:hover {
    background: #4299e1;
    color: white;
}

.btn-edit {
    color: #48bb78;
    border-color: #48bb78;
}

.btn-edit:hover {
    background: #48bb78;
    color: white;
}

.btn-delete {
    color: #f56565;
    border-color: #f56565;
}

.btn-delete:hover {
    background: #f56565;
    color: white;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 32px;
}

.pagination button {
    background: white;
    color: #4299e1;
    border: 1px solid #cbd5e0;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: #4299e1;
    color: white;
    border-color: #4299e1;
}

.pagination button:disabled {
    background: #f7fafc;
    color: #cbd5e0;
    cursor: not-allowed;
    border-color: #e2e8f0;
}

.pagination span {
    font-size: 14px;
    color: #718096;
    font-weight: 500;
}

#no-results, #loading {
    text-align: center;
    color: #718096;
    font-size: 16px;
    padding: 60px 20px;
    display: none;
}

/* ================= MODAL ================= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    overflow-y: auto;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 32px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a202c;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: #a0aec0;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #4a5568;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #4a5568;
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: #f7fafc;
    transition: all 0.2s;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #718096;
}

.checkbox-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #4a5568;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    grid-column: 1 / -1;
}

.btn-save, .btn-cancel {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-save {
    background: #48bb78;
    color: white;
}

.btn-save:hover {
    background: #38a169;
}

.btn-cancel {
    background: #edf2f7;
    color: #4a5568;
    border: 1px solid #cbd5e0;
}

.btn-cancel:hover {
    background: #e2e8f0;
}

/* ================= TOAST ================= */
.toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: white;
    color: #1a202c;
    padding: 16px 24px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 2000;
    animation: slideIn 0.3s ease;
    min-width: 280px;
    font-weight: 500;
}

.toast.success {
    border-color: #48bb78;
    background: #f0fff4;
    color: #22543d;
}

.toast.error {
    border-color: #f56565;
    background: #fff5f5;
    color: #742a2a;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
    .header-content {
        flex-wrap: wrap;
    }

    .header-content.has-page-title .header-main-title {
        margin-right: 0;
        margin-bottom: 8px;
    }

    .header-page-title {
        width: 100%;
        text-align: center;
    }

    .controls-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .book-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .checkbox-group {
        grid-template-columns: 1fr;
    }
}

/* ================= FOOTER ================= */
footer {
    background-color: #fff;
    border-top: 1px solid #e2e8f0;
    padding: 24px 0;
    margin-top: auto;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
    text-align: center;
}

.footer-info {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 16px;
}

.footer-info span {
    font-size: 14px;
    color: #718096;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-info i {
    color: #4299e1;
}

.footer-info a {
    color: #4299e1;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-info a:hover {
    color: #3182ce;
}

.footer-copyright {
    font-size: 13px;
    color: #a0aec0;
}

@media (max-width: 768px) {
    .footer-info {
        flex-direction: column;
        gap: 12px;
    }
    
    .footer-content {
        padding: 0 20px;
    }
}
