/* =============================================
   Trashily — GLOBAL STYLES
   Clean & Organic Theme
   ============================================= */

:root {
    --primary:       #4CAF50;
    --primary-dark:  #388E3C;
    --primary-light: #E8F5E9;
    --accent:        #FF8F00;
    --accent-light:  #FFF8E1;
    --danger:        #E53935;
    --danger-light:  #FFEBEE;
    --info:          #1E88E5;
    --info-light:    #E3F2FD;
    --text-dark:     #1B2D1C;
    --text-body:     #374038;
    --text-muted:    #7A8A7B;
    --border:        #DDE8DE;
    --bg-light:      #F5F7F5;
    --bg-white:      #FFFFFF;
    --sidebar-w:     260px;
    --radius:        14px;
    --shadow:        0 2px 12px rgba(0,0,0,.07);
    --shadow-md:     0 4px 24px rgba(0,0,0,.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg-light);
    color: var(--text-body);
    font-size: 15px;
    line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
img { max-width: 100%; }

/* ============ LAYOUT ============ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .3s;
}

.sidebar-logo {
    padding: 1.5rem 1.25rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-box {
    width: 40px; height: 40px;
    background: var(--primary);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo .logo-box i { color: #fff; font-size: 18px; }

.sidebar-logo .logo-text h2 { font-size: .95rem; font-weight: 700; color: var(--text-dark); line-height: 1.2; }
.sidebar-logo .logo-text span { font-size: .75rem; color: var(--text-muted); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.nav-section { padding: .25rem 1.25rem .25rem; }
.nav-section-label {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    padding: .75rem 0 .4rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem .9rem;
    border-radius: 10px;
    color: var(--text-body);
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
    margin-bottom: 2px;
}

.nav-item i { width: 20px; text-align: center; font-size: .9rem; color: var(--text-muted); transition: color .15s; }
.nav-item:hover { background: var(--bg-light); color: var(--primary-dark); }
.nav-item:hover i { color: var(--primary); }
.nav-item.active { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.nav-item.active i { color: var(--primary); }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.user-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem;
    background: var(--bg-light);
    border-radius: 12px;
}

.user-card .avatar {
    width: 36px; height: 36px;
    background: var(--primary-light);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: .8rem;
    font-weight: 700;
    color: var(--primary-dark);
    flex-shrink: 0;
}

.user-card .user-info { flex: 1; min-width: 0; }
.user-card .user-name { font-size: .8rem; font-weight: 600; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .user-role { font-size: .7rem; color: var(--text-muted); }
.user-card .logout-btn { color: var(--text-muted); font-size: .85rem; transition: color .15s; }
.user-card .logout-btn:hover { color: var(--danger); }

/* ============ MAIN CONTENT ============ */
.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left h1 { font-size: 1.1rem; font-weight: 700; color: var(--text-dark); }
.topbar-left p { font-size: .8rem; color: var(--text-muted); margin-top: 1px; }

.topbar-right { display: flex; align-items: center; gap: .75rem; }

.poin-badge {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--primary-light);
    padding: .45rem .9rem;
    border-radius: 100px;
    font-size: .825rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.poin-badge i { font-size: .9rem; }

.content { padding: 1.75rem; flex: 1; }

/* ============ CARDS ============ */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 { font-size: .95rem; font-weight: 700; color: var(--text-dark); }
.card-body { padding: 1.5rem; }

/* ============ STAT CARDS ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }

.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 52px; height: 52px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.green   { background: var(--primary-light); color: var(--primary); }
.stat-icon.orange  { background: var(--accent-light);  color: var(--accent); }
.stat-icon.blue    { background: var(--info-light);    color: var(--info); }
.stat-icon.red     { background: var(--danger-light);  color: var(--danger); }

.stat-info .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text-dark); line-height: 1.1; }
.stat-info .stat-label { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

/* ============ TABLE ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead th {
    padding: .75rem 1rem;
    background: var(--bg-light);
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-light); }

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .65rem;
    border-radius: 100px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-green  { background: var(--primary-light); color: var(--primary-dark); }
.badge-orange { background: var(--accent-light);  color: var(--accent); }
.badge-red    { background: var(--danger-light);  color: var(--danger); }
.badge-blue   { background: var(--info-light);    color: var(--info); }
.badge-gray   { background: #F0F0F0; color: #666; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1.2rem;
    border-radius: 10px;
    font-family: inherit;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s, box-shadow .15s;
    text-decoration: none;
}

.btn:active { transform: scale(.97); }

.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover  { background: var(--primary-dark); }

.btn-danger   { background: var(--danger-light); color: var(--danger); }
.btn-danger:hover   { background: var(--danger); color: #fff; }

.btn-info     { background: var(--info-light); color: var(--info); }
.btn-info:hover     { background: var(--info); color: #fff; }

.btn-ghost    { background: var(--bg-light); color: var(--text-body); border: 1px solid var(--border); }
.btn-ghost:hover    { background: var(--border); }

.btn-sm { padding: .4rem .8rem; font-size: .8rem; border-radius: 8px; }
.btn-lg { padding: .875rem 1.75rem; font-size: 1rem; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .45rem; }
.form-control {
    width: 100%;
    padding: .7rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: .9rem;
    color: var(--text-dark);
    background: var(--bg-light);
    transition: border-color .2s, background .2s;
}
.form-control:focus { outline: none; border-color: var(--primary); background: #fff; }
.form-control::placeholder { color: var(--text-muted); }

textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ============ MODAL ============ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
    animation: modalIn .25s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: 1rem; font-weight: 700; color: var(--text-dark); }
.modal-close { background: var(--bg-light); border: none; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text-muted); transition: background .15s; }
.modal-close:hover { background: var(--border); }

.modal-body { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; gap: .75rem; justify-content: flex-end; }

/* ============ AUTOCOMPLETE ============ */
.autocomplete-wrap { position: relative; }
.autocomplete-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0; right: 0;
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    z-index: 999;
    max-height: 220px;
    overflow-y: auto;
    display: none;
}
.autocomplete-list.open { display: block; }
.autocomplete-item {
    padding: .7rem 1rem;
    cursor: pointer;
    font-size: .875rem;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.selected { background: var(--primary-light); }
.autocomplete-item .item-avatar {
    width: 32px; height: 32px;
    background: var(--primary-light);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 700; color: var(--primary-dark);
    flex-shrink: 0;
}
.autocomplete-item .item-info .item-name { font-weight: 600; color: var(--text-dark); }
.autocomplete-item .item-info .item-sub { font-size: .75rem; color: var(--text-muted); }

/* ============ SAMPAH ITEM ============ */
.sampah-rows { display: flex; flex-direction: column; gap: .75rem; }
.sampah-row {
    display: grid;
    grid-template-columns: 1fr 120px 80px 36px;
    gap: .75rem;
    align-items: center;
    padding: .875rem 1rem;
    background: var(--bg-light);
    border-radius: 12px;
    border: 1.5px solid var(--border);
}
.sampah-row .sampah-poin { font-size: .8rem; color: var(--primary-dark); font-weight: 600; text-align: center; }
.btn-remove-row { background: var(--danger-light); border: none; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--danger); display: flex; align-items: center; justify-content: center; transition: background .15s; flex-shrink: 0; }
.btn-remove-row:hover { background: var(--danger); color: #fff; }

/* ============ TOTAL POIN PREVIEW ============ */
.poin-preview {
    background: var(--primary-light);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: .5rem;
}
.poin-preview .label { font-size: .85rem; color: var(--primary-dark); font-weight: 600; }
.poin-preview .value { font-size: 1.4rem; font-weight: 700; color: var(--primary-dark); }

/* ============ HADIAH GRID ============ */
.hadiah-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.hadiah-card {
    background: #fff;
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
    cursor: pointer;
}
.hadiah-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.hadiah-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.hadiah-card .hadiah-img { height: 100px; background: var(--bg-light); display: flex; align-items: center; justify-content: center; font-size: 2.5rem; }
.hadiah-card .hadiah-info { padding: .875rem 1rem; }
.hadiah-card .hadiah-name { font-size: .85rem; font-weight: 700; color: var(--text-dark); margin-bottom: .25rem; }
.hadiah-card .hadiah-poin { font-size: .8rem; color: var(--primary-dark); font-weight: 600; }
.hadiah-card .hadiah-stok { font-size: .72rem; color: var(--text-muted); }

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ============ SEARCH BAR ============ */
.search-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    background: var(--bg-light);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: .55rem 1rem;
    transition: border-color .2s;
}
.search-bar:focus-within { border-color: var(--primary); background: #fff; }
.search-bar i { color: var(--text-muted); font-size: .9rem; }
.search-bar input { border: none; background: none; font-family: inherit; font-size: .875rem; color: var(--text-dark); flex: 1; }
.search-bar input:focus { outline: none; }

/* ============ PAGINATION ============ */
.pagination { display: flex; align-items: center; gap: .4rem; padding-top: 1rem; }
.page-btn {
    width: 34px; height: 34px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: #fff;
    font-family: inherit;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-body);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, border-color .15s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ============ UTILITIES ============ */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-sm { gap: .5rem; }
.gap-md { gap: 1rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-small { font-size: .8rem; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.w-full { width: 100%; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .sampah-row { grid-template-columns: 1fr 100px 70px 36px; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .content { padding: 1rem; }
}

/* ============ SIDEBAR NAV BADGES ============ */
.nav-badge-pill {
    background: var(--danger, #E53935);
    color: #FFFFFF;
    font-size: .72rem;
    font-weight: 700;
    padding: .15rem .55rem;
    border-radius: 100px;
    margin-left: auto;
    line-height: 1.2;
}
.nav-badge-pill.orange {
    background: var(--accent, #FF8F00);
}

/* ============ ADMIN NOTIFICATION BELL & DROPDOWN ============ */
.admin-notif-wrap {
    position: relative;
    display: inline-block;
}
.btn-notif-bell {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--bg-light, #F5F7F5);
    border: 1.5px solid var(--border, #DDE8DE);
    color: var(--text-dark, #1B2D1C);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.05rem;
    cursor: pointer;
    position: relative;
    transition: all .2s ease;
}
.btn-notif-bell:hover {
    background: var(--primary-light, #E8F5E9);
    border-color: var(--primary, #4CAF50);
    color: var(--primary-dark, #388E3C);
}
.notif-badge-count {
    position: absolute;
    top: -5px; right: -5px;
    background: var(--danger, #E53935);
    color: #FFFFFF;
    font-size: .68rem;
    font-weight: 700;
    padding: .15rem .45rem;
    border-radius: 100px;
    box-shadow: 0 2px 6px rgba(229,57,53,.4);
    border: 2px solid #FFFFFF;
    line-height: 1;
}

.notif-dropdown-menu {
    display: none;
    position: absolute;
    top: 48px; right: 0;
    width: 320px;
    background: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(0,0,0,.15);
    border: 1px solid var(--border, #DDE8DE);
    z-index: 1000;
    overflow: hidden;
    animation: fadeInDownNotif .2s ease;
}
.notif-dropdown-menu.open {
    display: block;
}
@keyframes fadeInDownNotif {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.notif-dd-header {
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--border, #DDE8DE);
    display: flex; align-items: center; justify-content: space-between;
    background: #FAFAFA;
}
.notif-dd-title {
    font-size: .88rem;
    font-weight: 700;
    color: var(--text-dark, #1B2D1C);
}
.notif-dd-body {
    max-height: 320px;
    overflow-y: auto;
}
.notif-empty-state {
    padding: 2rem 1rem;
    text-align: center;
    font-size: .83rem;
    color: var(--text-muted);
}
.notif-dd-item {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--border, #DDE8DE);
    text-decoration: none;
    transition: background .15s;
}
.notif-dd-item:last-child {
    border-bottom: none;
}
.notif-dd-item:hover {
    background: var(--bg-light, #F5F7F5);
}
.notif-dd-item.unread {
    background: var(--primary-light, #E8F5E9);
}
.notif-item-icon {
    width: 34px; height: 34px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    flex-shrink: 0;
    margin-top: 2px;
}
.notif-item-icon.green {
    background: #E8F5E9; color: #2E7D32;
}
.notif-item-icon.orange {
    background: #FFF8E1; color: #E65100;
}
.notif-item-content {
    flex: 1;
    min-width: 0;
}
.notif-item-title {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text-dark, #1B2D1C);
    line-height: 1.2;
}
.notif-item-sub {
    font-size: .78rem;
    color: var(--text-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: .15rem;
}
.notif-item-time {
    font-size: .7rem;
    color: var(--text-muted);
    margin-top: .2rem;
}
.notif-dd-footer {
    padding: .75rem 1rem;
    background: #FAFAFA;
    border-top: 1px solid var(--border, #DDE8DE);
    text-align: center;
    font-size: .78rem;
    font-weight: 600;
    display: flex;
    justify-content: center;
    gap: .75rem;
}
.notif-dd-footer a {
    color: var(--primary-dark, #388E3C);
}
.notif-dd-footer a:hover {
    text-decoration: underline;
}
