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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

/* ===== HEADER ===== */
header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: #fff;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 { font-size: 2rem; margin-bottom: 0.75rem; }

.header-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.header-controls input,
.header-controls select {
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
}

.header-controls input { width: 280px; }
.header-controls select { width: 200px; cursor: pointer; }

.header-controls button {
    padding: 0.6rem 1.2rem;
    border: 2px solid #fff;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}
.header-controls button:hover {
    background: #fff;
    color: #2c3e50;
}

/* ===== LOGIN MODAL ===== */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}
.modal.hidden { display: none; }

.modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.modal-content h2 { margin-bottom: 1rem; text-align: center; color: #2c3e50; }

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.modal-content label { font-weight: bold; }
.modal-content input {
    padding: 0.7rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
}
.modal-content button {
    padding: 0.7rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.3s;
}
.modal-content button[type="submit"] { background: #3498db; color: #fff; }
.modal-content button[type="submit"]:hover { background: #2980b9; }
.modal-content button[type="button"] { background: #e0e0e0; color: #333; }
.modal-content button[type="button"]:hover { background: #ccc; }

.error-text { color: #e74c3c; text-align: center; margin-top: 0.5rem; font-size: 0.9rem; }
.error-text.hidden { display: none; }

/* ===== ADMIN PANEL ===== */
#admin-panel {
    background: #fff;
    padding: 1.5rem;
    margin: 1.5rem auto;
    max-width: 700px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
#admin-panel.hidden { display: none; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.admin-header h2 { color: #2c3e50; }
.admin-header button {
    background: #e74c3c;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
}
.admin-header button:hover { background: #c0392b; }

#admin-panel form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
#admin-panel label { font-weight: bold; }
#admin-panel input {
    padding: 0.7rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
}
#admin-panel button[type="submit"] {
    background: #27ae60;
    color: #fff;
    padding: 0.8rem;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    cursor: pointer;
    transition: background 0.3s;
}
#admin-panel button[type="submit"]:hover { background: #219a52; }

/* ===== PRODUK GRID ===== */
.container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ===== KARTU PRODUK ===== */
.produk-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}
.produk-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
}

.produk-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}
.produk-card .card-body {
    padding: 1.2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.produk-card h3 {
    font-size: 1.2rem;
    margin-bottom: 0.4rem;
    color: #2c3e50;
}
.produk-card .harga {
    font-size: 1.15rem;
    font-weight: bold;
    color: #27ae60;
    margin-bottom: 1rem;
}

.produk-card .card-actions {
    margin-top: auto;
    display: flex;
    gap: 0.5rem;
}
.produk-card .card-actions button {
    flex: 1;
    padding: 0.6rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s;
}
.btn-beli { background: #2ecc71; color: #fff; }
.btn-beli:hover { background: #27ae60; }
.btn-hapus { background: #e74c3c; color: #fff; }
.btn-hapus:hover { background: #c0392b; }

/* ===== STATS BAR ===== */
#stats-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* ===== FOOTER ===== */
footer {
    text-align: center;
    padding: 1.5rem 0;
    color: #7f8c8d;
    border-top: 1px solid #e0e0e0;
    margin-top: 1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    header h1 { font-size: 1.4rem; }
    .header-controls input { width: 100%; }
    .header-controls select { width: 100%; }
    .container { grid-template-columns: 1fr; padding: 1rem; }
}
