/* ================================================
   MOBILE RESPONSIVE - knjige-index.css
   Dodati na kraj postojećeg CSS fajla
   ================================================ */

/* ================= HAMBURGER MENI ================= */

.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.hamburger-btn:hover {
    background: #f0f4f8;
}

.hamburger-btn span {
    display: block;
    width: 24px;
    height: 2.5px;
    background: #2d3748;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
}

.hamburger-btn span:nth-child(2) {
    margin: 5px 0;
}

/* Animacija X */
.hamburger-btn.open span:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.hamburger-btn.open span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.hamburger-btn.open span:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ================= MOBILNI MENI OVERLAY ================= */

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-nav-overlay.visible {
    opacity: 1;
}

.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100%;
    background: #fff;
    z-index: 1200;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.mobile-nav-drawer.open {
    right: 0;
}

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

.mobile-nav-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a202c;
}

.mobile-nav-close {
    width: 36px;
    height: 36px;
    background: #f7fafc;
    border: none;
    border-radius: 8px;
    font-size: 22px;
    cursor: pointer;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mobile-nav-close:hover {
    background: #edf2f7;
    color: #2d3748;
}

/* Profil sekcija u draweru */
.mobile-nav-profile {
    padding: 16px 20px;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-nav-profile-avatar {
    width: 44px;
    height: 44px;
    background: #4299e1;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.mobile-nav-profile-info strong {
    display: block;
    font-size: 14px;
    color: #1a202c;
    font-weight: 600;
}

.mobile-nav-profile-info span {
    font-size: 12px;
    color: #718096;
}

/* Linkovi u draweru */
.mobile-nav-links {
    padding: 12px 0;
    flex: 1;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    color: #2d3748;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.mobile-nav-link:hover {
    background: #f7fafc;
    color: #4299e1;
    border-left-color: #4299e1;
}

.mobile-nav-link i {
    width: 20px;
    text-align: center;
    color: #718096;
    font-size: 16px;
}

.mobile-nav-link:hover i {
    color: #4299e1;
}

.mobile-nav-link .nav-badge {
    margin-left: auto;
    background: #f56565;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.mobile-nav-separator {
    height: 1px;
    background: #e2e8f0;
    margin: 8px 20px;
}

.mobile-nav-section-label {
    padding: 8px 20px 4px;
    font-size: 11px;
    font-weight: 700;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Logout dugme u draweru */
.mobile-nav-logout {
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
}

.mobile-nav-logout button {
    width: 100%;
    padding: 12px;
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mobile-nav-logout button:hover {
    background: #fed7d7;
}

/* ================= HEADER MOBILNI ================= */

@media (max-width: 768px) {

    header {
        padding: 0 !important;  /* dodati */
        height: 60px !important; /* dodati */
        display: flex;
        align-items: center;
    }

    /* Sakrij desktop navigaciju */
    .header-actions {
        display: none !important;
    }

    /* Pokaži hamburger */
    .hamburger-btn {
        display: flex !important;
    }

    /* Header layout na mobi */
    .header-content {
        padding: 0 16px !important;
        height: 60px !important;
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .header-main-title {
        font-size: 17px !important;
        width: auto !important;
        flex: 1 !important;
    }

    /* Body padding za manji header */
    body {
        padding-top: 60px !important;
    }

    /* ================= PAGE WRAPPER ================= */

    .page-wrapper {
        padding: 0 12px;
    }

    /* ================= CONTROLS SEKCIJA ================= */

    .controls-section {
        padding: 16px;
        margin: 12px 0;
        border-radius: 10px;
    }

    .controls-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 16px;
    }

    .control-group label {
        font-size: 12px;
        margin-bottom: 6px;
    }

    .control-group input,
    .control-group select {
        height: 44px;
        
        padding: 10px 12px;
        border-radius: 8px;
        /* Sprečava zoom na iOS pri fokus */
        font-size: 16px;
    }

    .add-btn {
        width: 100%;
        padding: 13px;
        font-size: 15px;
        border-radius: 8px;
        margin-bottom: 8px;
    }

    /* Dva dugmeta jedan pored drugog na mobi */
    .controls-section > div[style*="justify-content: space-between"] {
        gap: 10px;
    }

    .controls-section > div[style*="justify-content: space-between"] .add-btn {
        flex: 1;
        margin-bottom: 0;
        font-size: 13px;
        padding: 11px 8px;
    }

    /* ================= FEATURED SEKCIJE ================= */

    .featured-sections {
        gap: 12px;
    }

    .featured-section {
        padding: 16px;
        border-radius: 10px;
    }

    .featured-header h2 {
        font-size: 16px;
    }

    .featured-manage-btn {
        font-size: 12px;
        padding: 7px 12px;
    }

    .featured-grid {
        gap: 12px;
        padding-bottom: 6px;
        /* Scrollbar tanak na mobi */
        scrollbar-width: none;
    }

    .featured-grid::-webkit-scrollbar {
        display: none;
    }

    .featured-card {
        flex: 0 0 120px;
    }

    .featured-card img {
        height: 155px;
    }

    .featured-card-info {
        padding: 8px;
    }

    .featured-card-info h3 {
        font-size: 12px;
    }

    .featured-card-info p {
        font-size: 11px;
    }

    /* ================= KNJIGE SEKCIJA ================= */

    .books-section {
        padding: 16px;
        margin: 12px 0 20px;
        border-radius: 10px;
        min-height: auto;
    }

    /* Grid 2 kolone na telefonu */
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 20px;
    }

    .book {
        border-radius: 8px;
    }

    .book img {
        height: 180px;
    }

    .book-info {
        padding: 10px;
    }

    .book-info h2 {
        font-size: 13px;
        min-height: 36px;
        margin-bottom: 6px;
    }

    .book-info p {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .zanrovi-tags {
        gap: 4px;
        margin-top: 6px;
    }

    .zanr-tag {
        font-size: 10px;
        padding: 3px 6px;
    }

    .book-actions {
        padding: 8px 10px;
        gap: 6px;
    }

    .btn-view,
    .btn-edit,
    .btn-delete {
        padding: 7px 4px;
        font-size: 11px;
        border-radius: 5px;
    }

    /* ================= PAGINACIJA ================= */

    .pagination {
        gap: 10px;
        margin-top: 16px;
        flex-wrap: wrap;
    }

    .pagination button {
        padding: 9px 14px;
        font-size: 13px;
        flex: 1;
        min-width: 0;
    }

    .pagination span {
        font-size: 13px;
        width: 100%;
        text-align: center;
        order: -1;
    }

    /* ================= MODAL ================= */

    .modal.active {
        align-items: flex-end;
        padding: 0;
    }

    .modal-content {
        max-width: 100%;
        width: 100%;
        max-height: 92vh;
        border-radius: 20px 20px 0 0;
        padding: 24px 16px 32px;
        box-shadow: 0 -8px 40px rgba(0,0,0,0.2);
    }

    .modal-header h2 {
        font-size: 17px;
    }

    .modal-header {
        margin-bottom: 20px;
        padding-bottom: 14px;
    }

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

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

    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px; /* Sprečava iOS zoom */
        padding: 11px 14px;
    }

    .checkbox-group {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .form-actions {
        margin-top: 20px;
        padding-top: 16px;
        gap: 10px;
    }

    .btn-save,
    .btn-cancel {
        padding: 13px;
        font-size: 15px;
    }

    /* ================= NAJNOVIJE MODAL ================= */

    #najnovijeListaKnjiga {
        max-height: 55vh;
    }

    .najnovije-row {
        padding: 10px 0;
    }

    /* ================= FOOTER ================= */

    footer {
        position: static;
        padding: 20px 0;
    }

    .footer-content {
        padding: 0 16px;
    }

    .footer-info {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 12px;
    }

    .footer-info span {
        font-size: 13px;
    }

    .footer-copyright {
        font-size: 12px;
    }
}

/* ================= MALI TELEFONI (do 400px) ================= */

@media (max-width: 400px) {

    .book-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .book img {
        height: 155px;
    }

    .book-info h2 {
        font-size: 12px;
    }

    .featured-card {
        flex: 0 0 105px;
    }

    .featured-card img {
        height: 135px;
    }

    .header-main-title {
        font-size: 15px;
    }
}

/* ================= TABLET (769px - 1024px) ================= */

@media (min-width: 769px) and (max-width: 1024px) {

    .controls-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .book-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .page-wrapper {
        padding: 0 20px;
    }
}