/* ============================================
   Pustaka Digital Ranting NU Pelem - CSS
   Tema: Hijau NU + Modern Elegant
   ============================================ */

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

:root {
    /* NU Green Theme */
    --primary: #1a7c3e;
    --primary-dark: #0d4620;
    --primary-light: #2d9d5e;
    --secondary: #f5f5f5;
    
    /* Neutral */
    --text: #333;
    --text-light: #666;
    --border: #ddd;
    --bg: #ffffff;
    
    /* Spacing */
    --spacing: 20px;
    --spacing-sm: 10px;
    --spacing-lg: 40px;
    
    /* Border Radius */
    --radius: 8px;
    --radius-lg: 12px;
    
    /* Shadow */
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text);
    background: var(--secondary);
    line-height: 1.6;
}

/* ============================================
   NAVBAR
   ============================================ */

.navbar {
    background: var(--primary);
    color: white;
    padding: var(--spacing) 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.navbar .nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--spacing);
}

.navbar .nav-brand a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.navbar .nav-brand a:hover {
    opacity: 0.9;
}

.navbar .nav-menu {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
}

.navbar .nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    transition: background 0.3s;
    display: flex;
    align-items: center;
    min-height: 44px;
    white-space: nowrap;
}

.navbar .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.navbar .nav-link.admin-link {
    background: rgba(255, 255, 255, 0.2);
}

.nav-search-mobile {
    display: none;
}

/* Dropdown */
.navbar .nav-dropdown {
    position: relative;
    width: 100%;
}

.navbar .dropdown-content {
    display: none;
    position: absolute;
    background: white;
    color: var(--text);
    top: 100%;
    left: 0;
    min-width: 200px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
}

.navbar .nav-dropdown:hover .dropdown-content {
    display: block;
}

.navbar .dropdown-content a {
    display: block;
    padding: 10px 15px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.3s;
}

.navbar .dropdown-content a:hover {
    background: var(--secondary);
}

/* Mobile Dropdown */
@media (max-width: 768px) {
    .navbar .nav-dropdown {
        width: 100%;
    }

    .navbar .dropdown-content {
        position: static;
        display: none;
        background: rgba(0, 0, 0, 0.08);
        border-radius: 0;
        box-shadow: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .navbar .nav-dropdown.active .dropdown-content {
        display: block;
        max-height: 300px;
    }

    .navbar .dropdown-content a {
        padding: 11px 20px;
        padding-left: 35px;
        font-size: 14px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    }

    .navbar .dropdown-content a:hover {
        background: rgba(0, 0, 0, 0.12);
    }

    .navbar .nav-dropdown > .nav-link::after {
        content: '▼';
        font-size: 11px;
        margin-left: 6px;
        transition: transform 0.3s ease;
        display: inline-block;
    }

    .navbar .nav-dropdown.active > .nav-link::after {
        transform: rotate(180deg);
    }
}

/* Hamburger Menu */
.navbar-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    padding: 5px;
    min-height: 44px;
    min-width: 44px;
    align-items: center;
    justify-content: center;
}

.navbar-toggle span {
    width: 24px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
    display: block;
}

.navbar-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.navbar-toggle.active span:nth-child(2) {
    opacity: 0;
}

.navbar-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* ============================================
   HERO SECTION
   ============================================ */

.hero {
    background: linear-gradient(135deg, #1a7c3e 0%, #0d4620 100%);
    color: white;
    padding: 80px var(--spacing);
    text-align: center;
}

.hero-content h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-content p {
    font-size: 1.1em;
    margin-bottom: 30px;
    opacity: 0.95;
}

.search-box {
    max-width: 500px;
    margin: 0 auto;
}

.search-box form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-box input {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    min-height: 44px;
}

.search-box button {
    padding: 12px 30px;
    background: white;
    color: var(--primary);
    border: none;
    border-radius: var(--radius);
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.3s;
    min-height: 44px;
    font-size: 16px;
}

.search-box button:hover {
    transform: scale(1.05);
}

/* ============================================
   CONTAINER & SECTIONS
   ============================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing);
}

.section {
    padding: var(--spacing-lg) 0;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.section h2 {
    color: var(--primary);
    margin-bottom: 30px;
    font-size: 1.8em;
}

/* ============================================
   BOOKS GRID
   ============================================ */

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.book-card {
    background: var(--bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    cursor: pointer;
}

.book-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.book-card a {
    text-decoration: none;
}

.book-cover {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: linear-gradient(135deg, #e0e0e0, #f5f5f5);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-cover .default-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    text-align: center;
    padding: 20px;
    font-weight: bold;
    font-size: 14px;
}

.book-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.book-card:hover .book-overlay {
    opacity: 1;
}

.btn-read {
    background: var(--primary);
    color: white;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: bold;
    cursor: pointer;
}

.book-card h3 {
    padding: 15px var(--spacing-sm) 5px;
    color: var(--primary);
    font-size: 1em;
    line-height: 1.3;
    min-height: 40px;
}

.book-card .author {
    padding: 0 var(--spacing-sm) 5px;
    color: var(--text-light);
    font-size: 0.9em;
}

.book-card .description {
    padding: 0 var(--spacing-sm) 10px;
    color: var(--text-light);
    font-size: 0.85em;
    line-height: 1.4;
}

.book-stats {
    padding: 10px var(--spacing-sm);
    border-top: 1px solid var(--border);
    font-size: 0.9em;
}

/* ============================================
   CATEGORY SECTION
   ============================================ */

.category-section {
    background: var(--secondary);
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing);
}

.category-badge {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    transition: background 0.3s, transform 0.3s;
    cursor: pointer;
}

.category-badge:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing);
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing);
    border-bottom: 2px solid var(--border);
}

.category-link {
    color: var(--text);
    text-decoration: none;
    padding: 5px 15px;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.category-link:hover,
.category-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

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

.footer {
    background: var(--primary);
    color: white;
    padding: var(--spacing-lg) 0;
    margin-top: var(--spacing-lg);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-lg);
    padding: 0 var(--spacing) var(--spacing);
}

.footer-section h3,
.footer-section h4 {
    margin-bottom: 10px;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding: var(--spacing) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: var(--radius);
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left-color: #17a2b8;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
    .hero {
        padding: 50px var(--spacing);
    }

    .hero-content h1 {
        font-size: 1.8em;
    }

    .hero-content p {
        font-size: 1em;
    }

    .navbar {
        padding: 12px 0;
        position: sticky;
        top: 0;
        z-index: 1000;
        box-shadow: var(--shadow);
    }

    .navbar .nav-container {
        flex-wrap: wrap;
        gap: 10px;
        padding: 0 var(--spacing-sm);
    }

    .navbar-toggle {
        display: flex;
        z-index: 1001;
        margin-right: 0;
        order: 2;
    }

    .navbar .nav-menu {
        gap: 0;
        font-size: 0.95em;
        display: none;
        width: 100%;
        flex-direction: column;
        background: linear-gradient(135deg, rgba(0, 0, 0, 0.1) 0%, rgba(0, 0, 0, 0.05) 100%);
        padding: 0;
        border-radius: 0;
        margin-top: 0;
        order: 3;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .navbar .nav-menu.active {
        display: flex;
        max-height: 500px;
    }

    .navbar .nav-link {
        padding: 15px 20px;
        border-radius: 0;
        font-size: 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        transition: all 0.3s ease;
        min-height: auto;
    }

    .navbar .nav-link:hover,
    .navbar .nav-link:active {
        background: rgba(255, 255, 255, 0.15);
    }

    .nav-search-mobile {
        display: block;
        width: 100%;
        padding: 12px var(--spacing);
        order: 4;
        margin-top: 0;
        background: rgba(0, 0, 0, 0.1);
        border-radius: 8px;
        margin: 0 var(--spacing-sm);
        width: auto;
    }

    .search-form-mobile {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    .search-form-mobile input {
        flex: 1;
        padding: 11px 14px;
        border: none;
        border-radius: 6px;
        font-size: 16px;
        min-height: 44px;
        background: white;
        color: var(--text);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
        transition: all 0.3s ease;
    }

    .search-form-mobile input:focus {
        outline: none;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
        background: #f8f8f8;
    }

    .search-form-mobile input::placeholder {
        color: #999;
    }

    .search-form-mobile button {
        padding: 11px 14px;
        background: white;
        color: var(--primary);
        border: none;
        border-radius: 6px;
        cursor: pointer;
        font-size: 18px;
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.3s ease;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
        font-weight: 600;
    }

    .search-form-mobile button:active {
        transform: scale(0.95);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: var(--spacing);
    }

    .search-box form {
        flex-direction: column;
    }

    .search-box input {
        min-width: auto;
    }

    .footer-content {
        gap: var(--spacing);
        grid-template-columns: 1fr;
    }

    .category-list {
        gap: var(--spacing-sm);
    }

    .category-badge {
        padding: 6px 12px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 10px 0;
    }

    .navbar .nav-container {
        padding: 0 10px;
    }

    .navbar .nav-brand a {
        font-size: 14px;
        flex: 1;
        min-width: 0;
    }

    .navbar .logo-text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: block;
        max-width: 140px;
    }

    .navbar-toggle {
        flex-shrink: 0;
    }

    .navbar-toggle span {
        width: 22px;
        height: 2.5px;
    }

    .navbar .nav-menu {
        gap: 0;
        max-height: 380px;
    }

    .navbar .nav-link {
        padding: 13px 18px;
        font-size: 14px;
    }

    .nav-search-mobile {
        padding: 10px 8px;
        margin: 0 10px;
    }

    .search-form-mobile {
        gap: 6px;
    }

    .search-form-mobile input {
        padding: 10px 12px;
        font-size: 14px;
        min-height: 42px;
    }

    .search-form-mobile button {
        padding: 10px 12px;
        font-size: 16px;
        min-height: 42px;
        min-width: 42px;
    }

    .category-list {
        gap: 5px;
    }

    .search-box {
        max-width: 100%;
        padding: 0 var(--spacing-sm);
    }

    .search-box form {
        gap: 5px;
    }

    .hero {
        padding: 40px var(--spacing-sm);
    }

    .hero-content h1 {
        font-size: 1.5em;
    }

    .hero-content p {
        font-size: 0.95em;
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.btn {
    display: inline-block;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--text-light);
}

.btn-secondary:hover {
    background: var(--text);
}

.btn-link {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s;
}

.btn-link:hover {
    color: var(--primary-dark);
}

.btn-link.danger {
    color: #dc3545;
}

.btn-link.danger:hover {
    color: #c82333;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Bottom nav mobile — disembunyikan di desktop */
.pk-bottomnav {
    display: none;
}
@media (max-width: 768px) {
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }
    .pk-bottomnav {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 9990;
        background: #fff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    .pk-bottomnav a {
        flex: 1 1 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px 2px 7px;
        color: #6b7280;
        font-size: 10px;
        line-height: 1.2;
        text-decoration: none;
    }
    .pk-bottomnav svg {
        width: 23px;
        height: 23px;
    }
    .pk-bottomnav .pk-active {
        color: #1a7c3e;
        font-weight: 700;
    }
}
