/* ==========================================================================
   1. TEMA WARNA (COLOR PALETTE) & KONSEP VISUAL CLEAN MINIMALIST
   ========================================================================== */
:root {
    /* Hijau Daun / Sage Green: Keberlanjutan, kepedulian lingkungan, kesegaran */
    --sage-dark: #23472B;
    --sage-primary: #4A7C59;
    --sage-medium: #6B9E78;
    --sage-light: #EAF2EC;

    /* Oranye Hangat / Kuning Mustard: Menggugah selera, antusias, aksen CTA */
    --mustard-warm: #F4A261;
    --orange-cta: #E76F51;
    --orange-hover: #D05638;
    --mustard-light: #FFF5EB;

    /* Putih / Abu-Abu Terang (Background): Bersih, profesional, nyaman di mata */
    --bg-main: #F7F9F7;
    --bg-white: #FFFFFF;
    --text-primary: #1C2826;
    --text-secondary: #5C6B64;
    --border-soft: #E2EAE4;

    /* Warna Status & Timer */
    --danger-red: #D9381E;
    --danger-bg: #FEECEB;
    --success-green: #2A9D8F;

    /* Efek Visual & Spasi */
    --shadow-clean: 0 6px 20px rgba(35, 71, 43, 0.05);
    --shadow-hover: 0 14px 30px rgba(35, 71, 43, 0.10);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   2. HEADER & PROFIL PENGGUNA (TANPA SWITCHER MANUAL)
   ========================================================================== */
.navbar {
    background-color: var(--bg-white);
    border-bottom: 1px solid var(--border-soft);
    padding: 1rem 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-clean);
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--sage-dark);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--orange-cta);
}

.user-status {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.auth-nav-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-name-label {
    font-weight: 700;
    color: var(--sage-dark);
}

.role-indicator {
    background-color: var(--mustard-light);
    color: var(--orange-cta);
    border: 1px solid var(--mustard-warm);
    padding: 5px 12px;
    border-radius: 50px;
    font-weight: 700;
}

/* ==========================================================================
   3. HALAMAN LOGIN SATU PINTU (UNIFIED LOGIN PAGE)
   ========================================================================== */
.auth-wrapper {
    min-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 5%;
}

.auth-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border-soft);
    max-width: 520px;
    width: 100%;
    padding: 2.4rem;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background-color: var(--sage-light);
    padding: 5px;
    border-radius: 50px;
    margin-bottom: 1.8rem;
}

.auth-tab {
    border: none;
    background: transparent;
    padding: 10px 14px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--sage-dark);
    cursor: pointer;
    transition: all 0.25s ease;
}

.auth-tab.active {
    background-color: var(--sage-primary);
    color: var(--bg-white);
    box-shadow: 0 3px 10px rgba(74, 124, 89, 0.25);
}

.auth-header {
    text-align: center;
    margin-bottom: 1.6rem;
}

.auth-header h2 {
    font-size: 1.6rem;
    color: var(--sage-dark);
    font-weight: 800;
    margin-bottom: 6px;
}

.auth-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.credential-info-box {
    margin-top: 1.6rem;
    background-color: var(--sage-light);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 1.1rem;
}

.cred-title {
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--sage-dark);
    margin-bottom: 8px;
}

.cred-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cred-pill {
    text-align: left;
    background: var(--bg-white);
    border: 1px solid var(--border-soft);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.cred-pill:hover {
    border-color: var(--sage-primary);
    background-color: var(--mustard-light);
}

.link-btn {
    background: none;
    border: none;
    color: var(--sage-primary);
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    text-decoration: underline;
}

/* ==========================================================================
   4. BANNER UTAMA (HERO SECTION)
   ========================================================================== */
.hero {
    margin: 2rem 5% 1.5rem;
    background: linear-gradient(130deg, var(--sage-dark) 0%, var(--sage-primary) 100%);
    border-radius: var(--radius-lg);
    padding: 3.8rem 3.5rem;
    color: var(--bg-white);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 3rem;
    box-shadow: var(--shadow-hover);
}

.hero-content {
    max-width: 620px;
}

.badge-hero {
    display: inline-block;
    background-color: rgba(244, 162, 97, 0.22);
    color: var(--mustard-warm);
    border: 1px solid var(--mustard-warm);
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
}

.hero h1 {
    font-size: 2.65rem;
    line-height: 1.2;
    margin-bottom: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.hero p {
    font-size: 1.05rem;
    opacity: 0.92;
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    background: rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(10px);
    padding: 1.8rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 320px;
}

.stat-box h3 {
    font-size: 1.85rem;
    color: var(--mustard-warm);
    font-weight: 800;
}

.stat-box p {
    font-size: 0.82rem;
    opacity: 0.9;
    margin: 0;
}

/* ==========================================================================
   5. TOMBOL (BUTTONS) & CALL-TO-ACTION
   ========================================================================== */
.btn {
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.22s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 0.82rem;
}

.btn-cta {
    background-color: var(--orange-cta);
    color: var(--bg-white);
    box-shadow: 0 4px 14px rgba(231, 111, 81, 0.35);
}

.btn-cta:hover {
    background-color: var(--orange-hover);
    transform: translateY(-2px);
}

.btn-bid {
    background-color: var(--mustard-warm);
    color: var(--text-primary);
}

.btn-bid:hover {
    background-color: #e6914c;
    transform: translateY(-2px);
}

.btn-outline {
    background-color: rgba(255, 255, 255, 0.12);
    color: var(--bg-white);
    border: 1.5px solid var(--bg-white);
}

.btn-outline:hover {
    background-color: var(--bg-white);
    color: var(--sage-dark);
}

.btn-secondary {
    background-color: var(--sage-light);
    color: var(--sage-dark);
}

.btn-secondary:hover {
    background-color: #d6e5da;
}

.full-width {
    width: 100%;
}

/* ==========================================================================
   6. CONTAINER, WHITESPACE & FILTER CEPAT
   ========================================================================== */
.container {
    padding: 1.5rem 5% 4rem;
    max-width: 1440px;
    margin: 0 auto;
    width: 100%;
}

.view-section {
    display: none;
    animation: fadeIn 0.35s ease;
}

.view-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-bottom: 2.5rem;
    background: var(--bg-white);
    padding: 1.25rem 1.75rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-clean);
    border: 1px solid var(--border-soft);
}

.category-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pill {
    padding: 9px 18px;
    border-radius: 50px;
    border: 1px solid var(--border-soft);
    background: var(--bg-main);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pill.active, .pill:hover {
    background-color: var(--sage-primary);
    color: var(--bg-white);
    border-color: var(--sage-primary);
}

.location-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--sage-dark);
}

.location-filter select {
    padding: 9px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    font-weight: 700;
    color: var(--sage-dark);
    background-color: var(--sage-light);
    outline: none;
    cursor: pointer;
}

.section-title-row {
    margin-bottom: 1.8rem;
}

.section-title-row h2 {
    font-size: 1.65rem;
    color: var(--sage-dark);
    font-weight: 800;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* ==========================================================================
   7. KARTU PRODUK LELANG & COUNTDOWN TIMER MENCOLOK
   ========================================================================== */
.food-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2.2rem;
}

.food-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-clean);
    border: 1px solid var(--border-soft);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.food-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.card-img-wrapper {
    position: relative;
    height: 215px;
    overflow: hidden;
    background-color: var(--sage-light);
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.food-card:hover .card-img-wrapper img {
    transform: scale(1.05);
}

.discount-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background-color: var(--orange-cta);
    color: var(--bg-white);
    font-weight: 800;
    font-size: 0.82rem;
    padding: 5px 12px;
    border-radius: 50px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.distance-badge {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background-color: rgba(28, 40, 38, 0.82);
    backdrop-filter: blur(4px);
    color: var(--bg-white);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
}

.countdown-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: var(--bg-white);
    color: var(--danger-red);
    font-weight: 800;
    font-size: 0.86rem;
    padding: 6px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    border: 2px solid var(--danger-red);
    letter-spacing: 0.5px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: var(--danger-red);
    border-radius: 50%;
    animation: pulseRed 1.2s infinite;
}

@keyframes pulseRed {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(217, 56, 30, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(217, 56, 30, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(217, 56, 30, 0); }
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.merchant-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.merchant-name {
    font-size: 0.8rem;
    color: var(--sage-primary);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.stock-pill {
    background-color: var(--sage-light);
    color: var(--sage-dark);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 50px;
}

.food-title {
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.35;
}

.price-box {
    background-color: var(--bg-main);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-top: auto;
    margin-bottom: 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--border-soft);
}

.price-col span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.original-price {
    text-decoration: line-through;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

.current-bid-price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--sage-dark);
}

.buy-now-label {
    text-align: right;
}

.buy-now-price {
    font-size: 1rem;
    font-weight: 800;
    color: var(--orange-cta);
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* ==========================================================================
   8. DASHBOARD MERCHANT & PENERIMA DONASI
   ========================================================================== */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    font-size: 1.8rem;
    color: var(--sage-dark);
    font-weight: 800;
}

.merchant-summary-cards {
    display: flex;
    gap: 1rem;
}

.mini-stat {
    background: var(--bg-white);
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-soft);
    box-shadow: var(--shadow-clean);
}

.mini-stat span {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.mini-stat strong {
    font-size: 1.2rem;
    color: var(--sage-dark);
}

.merchant-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 2rem;
}

.card-panel {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-clean);
    border: 1px solid var(--border-soft);
}

.card-panel h3 {
    font-size: 1.2rem;
    color: var(--sage-dark);
    margin-bottom: 1.4rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid var(--sage-light);
}

.form-group {
    margin-bottom: 1.1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    font-size: 0.92rem;
    background-color: var(--bg-main);
    outline: none;
    transition: border 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--sage-primary);
    background-color: var(--bg-white);
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
}

.data-table th {
    background-color: var(--sage-light);
    color: var(--sage-dark);
    font-weight: 700;
}

.status-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 700;
}

.status-active {
    background-color: var(--mustard-light);
    color: var(--orange-cta);
}

.status-sold {
    background-color: var(--sage-light);
    color: var(--sage-dark);
}

.status-donated {
    background-color: #E0F2FE;
    color: #0369A1;
}

.donation-alert-box {
    background-color: var(--sage-light);
    color: var(--sage-dark);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--sage-primary);
    font-size: 0.9rem;
}

.donation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.donation-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 1.4rem;
    background-color: var(--bg-main);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}

.donation-card h4 {
    font-size: 1.1rem;
    color: var(--sage-dark);
    margin-top: 4px;
}

/* ==========================================================================
   9. MODAL LELANG & TOAST NOTIFICATION
   ========================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 40, 38, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1rem;
}

.modal-overlay.open {
    display: flex;
}

.modal-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    max-width: 460px;
    width: 100%;
    padding: 1.8rem;
    box-shadow: var(--shadow-hover);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-item-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--sage-dark);
}

.modal-merchant {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.modal-price-box {
    display: flex;
    justify-content: space-between;
    background: var(--sage-light);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 1.2rem;
}

.modal-price-box span {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.modal-price-box strong {
    font-size: 1.15rem;
    color: var(--sage-dark);
}

.helper-text {
    display: block;
    margin-top: 5px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 1.4rem;
}

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--sage-dark);
    color: var(--bg-white);
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover);
    font-size: 0.9rem;
    font-weight: 600;
    border-left: 5px solid var(--mustard-warm);
    animation: fadeIn 0.3s ease;
}

footer {
    margin-top: auto;
    background-color: var(--bg-white);
    border-top: 1px solid var(--border-soft);
    padding: 2rem 5%;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.88rem;
}

@media (max-width: 960px) {
    .hero {
        flex-direction: column;
        padding: 2.5rem 2rem;
    }
    .merchant-grid {
        grid-template-columns: 1fr;
    }
}