/* ======================
   RESET & BASE
====================== */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: Arial;
    margin: 0;
    background: #eef2f7;
    color: #222;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s, color 0.3s;
}

/* ======================
   HEADER
====================== */
header {
    background: linear-gradient(135deg, #2c3e50, #3498db);
    color: white;
    padding: 25px;
    text-align: center;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    position: relative;
    transition: 0.3s;
}

/* NAVBAR */
header nav {
    margin-top: 10px;
}

header nav a {
    color: white;
    margin: 0 8px;
    text-decoration: none;
    font-size: 14px;
}

header nav a:hover {
    text-decoration: underline;
}

/* ======================
   LAYOUT
====================== */
.container {
    max-width: 1000px;
    margin: auto;
    padding: 20px;
}

.top-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* ======================
   INPUT
====================== */
input, select {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    transition: 0.3s;
}

/* ======================
   GRID & CARD
====================== */
.grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.card {
    flex: 1 1 220px;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: 0.3s;
}

/* ======================
   GAMBAR BUKU (FIXED)
====================== */
.cover,
.img-buku {
    width: 100%;
    height: 220px;
    object-fit: contain;   /* 🔥 biar tidak nge-zoom / tidak kepotong */
    background: #f3f3f3;
    border-radius: 10px;
    margin: 10px 0;
}

/* ======================
   LINK BUKU (FIXED DUPLIKASI)
====================== */
.link-buku {
    display: block;
    margin: 8px 0;
    padding: 8px;
    text-align: center;
    background: #3498db;
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
}

.link-buku:hover {
    background: #2980b9;
    text-decoration: none;
}

/* ======================
   UI ELEMENT
====================== */
.badge {
    background: #3498db;
    color: white;
    padding: 3px 8px;
    border-radius: 6px;
}

.actions {
    margin-top: 10px;
    display: flex;
    justify-content: space-between;
}

button {
    padding: 6px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.delete { background: red; color: white; }
.edit { background: orange; color: white; }
.add { background: #2c3e50; color: white; }

/* ======================
   TOGGLE BUTTON
====================== */
#toggleMode {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1000;

    width: 45px;
    height: 45px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;
    border: none;

    background: #222;
    color: white;
    font-size: 18px;
    cursor: pointer;

    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    transition: 0.3s;
}

/* ======================
   DARK MODE
====================== */
body.dark {
    background: #121212;
    color: #f5f5f5;
}

body.dark header {
    background: linear-gradient(135deg, #000000, #2c2c2c);
}

body.dark .card {
    background: #1e1e1e;
    box-shadow: 0 2px 6px rgba(255,255,255,0.05);
}

body.dark input,
body.dark select {
    background: #2c2c2c;
    color: #fff;
    border: 1px solid #555;
}

body.dark .badge {
    background: #555;
}

body.dark button {
    opacity: 0.9;
}

body.dark #toggleMode {
    background: #f5f5f5;
    color: #222;
}

/* ======================
   FORM PEMINJAMAN
====================== */
#formPinjam {
    margin-top: 30px;
}

#formPinjam form {
    background: white;
    padding: 15px;
    border-radius: 10px;
}

body.dark #formPinjam form {
    background: #1e1e1e;
}

.error {
    color: red;
    font-size: 12px;
    margin-top: -5px;
    margin-bottom: 5px;
}

/* ======================
   FOOTER
====================== */
footer {
    text-align: center;
    padding: 15px;
    margin-top: 30px;
    font-size: 14px;
    background: #ddd;
}

body.dark footer {
    background: #111;
    color: #fff;
}

/* ======================
   SECTION TITLE
====================== */
section h2 {
    margin-top: 20px;
    font-size: 18px;
}

/* ======================
   RESPONSIVE (HP)
====================== */
@media (max-width: 768px) {

    header {
        padding: 18px;
        font-size: 14px;
    }

    .container {
        padding: 15px;
    }

    .top-bar {
        flex-direction: column;
    }

    input, select {
        width: 100%;
    }

    .form {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .card {
        padding: 12px;
    }

    .actions {
        flex-direction: column;
        gap: 5px;
    }

    button {
        width: 100%;
    }

    #toggleMode {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* ======================
   OPTIONAL GRID MODE (tetap aman)
====================== */
.container-buku {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    padding: 20px;
}

.buku {
    text-align: center;
}

.buku img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 10px;
}