/* =====================================================
   ECOVETRA ADMIN — Responsive Stylesheet
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: #f3f4f3;
    margin: 0;
    color: #191c1c;
}

/* ── SIDEBAR ── */
.sidebar {
    width: 260px;
    background: linear-gradient(160deg, #174413 0%, #1e5518 100%);
    color: white;
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    padding: 24px 16px;
    box-sizing: border-box;
    overflow-y: auto;
    z-index: 200;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 8px;
}

.sidebar-brand h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: #bcf0ae;
    letter-spacing: 1px;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: #bcf0ae;
    font-size: 22px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.sidebar-section-label {
    color: #bcf0ae;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin: 20px 0 6px 12px;
}

.sidebar a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.2s, color 0.2s;
}

.sidebar a:hover { background: rgba(255,255,255,0.1); color: white; }
.sidebar a.active { background: #bcf0ae; color: #174413; font-weight: 700; }
.sidebar a.danger { color: #ffb3ab; }
.sidebar a.danger:hover { background: rgba(186,26,26,0.2); color: white; }

/* ── TOPBAR (mobile) ── */
.admin-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    background: #174413;
    color: white;
    z-index: 150;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}

.admin-topbar span { font-size: 16px; font-weight: 800; color: #bcf0ae; }

.topbar-menu-btn {
    background: none;
    border: none;
    color: white;
    font-size: 26px;
    cursor: pointer;
    display: flex;
    align-items: center;
    padding: 0;
}

/* ── SIDEBAR OVERLAY ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 190;
}
.sidebar-overlay.active { display: block; }

/* ── MAIN CONTENT ── */
.main-content {
    margin-left: 260px;
    padding: 36px 40px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* ── PAGE HEADER ── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
    color: #174413;
}

/* ── CARDS ── */
.card {
    background: white;
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.card h2 {
    font-size: 15px;
    font-weight: 700;
    color: #174413;
    margin: 0 0 18px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #f3f4f3;
}

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: #41493e; margin-bottom: 6px; }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e1e3e2;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #191c1c;
    background: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: #3b6934;
    box-shadow: 0 0 0 3px rgba(59,105,52,0.12);
    background: white;
}
.form-group small { color: #717a6d; font-size: 12px; display: block; margin-top: 5px; }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #174413;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}
.btn:hover { background: #2f5c28; }
.btn:active { transform: scale(0.98); }

.btn-danger {
    background: #ba1a1a;
}
.btn-danger:hover { background: #8c0f0f; }

.btn-outline {
    background: transparent;
    border: 1.5px solid #174413;
    color: #174413;
}
.btn-outline:hover { background: #f3f4f3; }

.btn-logout {
    background: transparent;
    border: 1px solid #ba1a1a;
    color: #ba1a1a;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}
.btn-logout:hover { background: #ffdad6; }

/* ── MESSAGE ── */
.message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
}

.message.error {
    background: #ffdad6;
    color: #ba1a1a;
    border-color: #f5c6cb;
}

/* ── TABLE ── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: #f3f4f3; text-align: left; padding: 12px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #41493e; }
td { padding: 14px 16px; border-bottom: 1px solid #f3f4f3; vertical-align: middle; color: #191c1c; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f9f9f8; }

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

/* ── STATS GRID ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
    background: white;
    border-radius: 14px;
    padding: 20px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    border-left: 4px solid #174413;
}
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: #174413; }
.stat-card .stat-label { font-size: 12px; color: #717a6d; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    /* Topbar & Sidebar */
    .admin-topbar { display: flex; }
    .sidebar { transform: translateX(-100%); padding-top: 16px; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }

    /* Main content shifts down for topbar */
    .main-content {
        margin-left: 0;
        padding: 70px 12px 32px;
    }

    /* Page header stacks */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 16px;
    }
    .page-header h1 { font-size: 18px; }
    .page-header a, .page-header button { font-size: 12px; padding: 7px 12px; }

    /* Cards */
    .card { padding: 14px 12px; border-radius: 10px; }
    .card h2 { font-size: 13px; margin-bottom: 14px; }

    /* Forms */
    .form-group { margin-bottom: 14px; }
    .form-group label { font-size: 12px; }
    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"],
    .form-group input[type="number"],
    .form-group textarea,
    .form-group select { font-size: 13px; padding: 9px 11px; }

    /* Grids collapse to single column */
    .grid-2, .grid-3, .akun-grid, .two-col { 
        grid-template-columns: 1fr !important; 
    }

    /* Stats collapse to 1 column on very small screens */
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }

    /* Stat card more compact */
    .stat-card { padding: 14px; gap: 12px; }
    .stat-icon { width: 40px; height: 40px; font-size: 20px; border-radius: 10px; }
    .stat-value { font-size: 26px; }
    .stat-label { font-size: 10px; }

    /* Welcome bar stacks */
    .welcome-bar {
        padding: 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .welcome-bar h2 { font-size: 16px; }
    .welcome-bar > div:last-child {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .welcome-bar > div:last-child a {
        flex: 1;
        text-align: center;
        font-size: 12px;
        padding: 7px 10px;
    }

    /* Table: scroll + smaller text */
    table { font-size: 12px; min-width: 480px; }
    th { padding: 9px 8px; font-size: 10px; }
    td { padding: 10px 8px; }

    /* Hide less important table columns on mobile */
    .hide-mobile { display: none !important; }

    /* Action buttons in table */
    td .btn { padding: 5px 10px; font-size: 11px; margin: 2px 1px; }

    /* Buttons */
    .btn { font-size: 13px; padding: 9px 14px; }
    .btn-logout { font-size: 12px; }

    /* Message */
    .message { font-size: 13px; padding: 10px 12px; }

    /* Section box */
    .section-box { padding: 12px; }

    /* Image preview */
    .img-preview { height: 90px; }

    /* Quick actions */
    .qa-btn { padding: 10px 12px; font-size: 12px; }
    .qa-btn .material-symbols-outlined { font-size: 18px; }
    
    /* Akun page avatar */
    .akun-info { padding: 14px; gap: 14px; }
    .avatar-circle { width: 60px; height: 60px; font-size: 24px; }
    .akun-info-detail .username { font-size: 16px; }
}

@media (max-width: 420px) {
    .stats-grid { grid-template-columns: 1fr; }
    .main-content { padding: 68px 10px 28px; }
}

/* ── GRIDS (beranda / forms) ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

@media (max-width: 900px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

/* ── MISC UTILITIES ── */
.img-preview {
    max-width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 10px;
    border: 1px solid #e1e3e2;
    display: block;
}

.section-box {
    background: #f9f9f8;
    padding: 16px;
    border-radius: 10px;
    border: 1px solid #e1e3e2;
    margin-bottom: 12px;
}

/* Headings without admin_style overriding page headers */
h1, h2, h3 { 
    color: #174413; 
    margin-top: 0; 
}

/* Input not inside .form-group (legacy compatibility) */
input[type="text"]:not(.form-group *),
input[type="url"]:not(.form-group *),
input[type="password"]:not(.form-group *),
textarea:not(.form-group *),
select:not(.form-group *) {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e1e3e2;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fafafa;
    box-sizing: border-box;
}

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #41493e;
    margin-bottom: 6px;
}

/* Dashboard card list style */
.card.flex-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.card-content h3 { margin: 0 0 6px 0; color: #191c1c; font-size: 15px; }
.card-content p { margin: 0; color: #41493e; font-size: 13px; }

/* Scrollable table wrapper */
.table-wrapper { 
    overflow-x: auto; 
    border-radius: 12px;
    background: white;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    -webkit-overflow-scrolling: touch;
}
.table-wrapper table { margin: 0; }

/* ── DATA LIST (pengganti tabel, mobile-friendly) ── */
.data-list { display: flex; flex-direction: column; gap: 0; }

.data-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f3f4f3;
}
.data-item:last-child { border-bottom: none; padding-bottom: 0; }
.data-item:first-child { padding-top: 0; }

.data-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1.5px solid #e1e3e2;
}
.data-thumb-round { border-radius: 50% !important; }

.data-thumb-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    background: #f3f4f3;
    border: 1.5px solid #e1e3e2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #c0c9bb;
}
.data-thumb-placeholder .material-symbols-outlined { font-size: 24px; }

.data-info {
    flex: 1;
    min-width: 0;
}
.data-title {
    font-size: 14px;
    font-weight: 600;
    color: #191c1c;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.data-meta {
    font-size: 12px;
    color: #717a6d;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.data-badge {
    display: inline-block;
    background: #e8f5e1;
    color: #174413;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 4px;
    letter-spacing: 0.03em;
}

.data-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    flex-direction: row;
}

@media (max-width: 480px) {
    .data-actions {
        flex-direction: column;
        gap: 4px;
    }
    .data-actions .btn {
        font-size: 11px;
        padding: 5px 10px;
        text-align: center;
    }
    .data-title { font-size: 13px; }
    .data-thumb, .data-thumb-placeholder { width: 44px; height: 44px; }
}


/* ── DASHBOARD ── */
.welcome-bar {
    background: linear-gradient(135deg, #174413 0%, #2f5c28 100%);
    color: white;
    border-radius: 16px;
    padding: 28px 32px;
    margin-bottom: 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.welcome-bar h2 { margin: 0; font-size: 22px; color: #bcf0ae; }
.welcome-bar p { margin: 6px 0 0; font-size: 14px; opacity: 0.8; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: white;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    gap: 18px;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08); }
.stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
}
.stat-icon.green { background: #e8f5e1; color: #174413; }
.stat-icon.teal  { background: #e0f2f1; color: #00695c; }
.stat-icon.amber { background: #fff8e1; color: #f57f17; }
.stat-icon.blue  { background: #e3f2fd; color: #1565c0; }
.stat-value { font-size: 32px; font-weight: 800; color: #174413; line-height: 1; }
.stat-label { font-size: 12px; font-weight: 600; color: #717a6d; text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }

.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }

.recent-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f3;
}
.recent-item:last-child { border-bottom: none; padding-bottom: 0; }
.recent-dot { width: 8px; height: 8px; border-radius: 50%; background: #174413; flex-shrink: 0; }
.recent-title { font-size: 14px; font-weight: 500; color: #191c1c; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-date { font-size: 12px; color: #717a6d; white-space: nowrap; }

.quick-actions { display: grid; grid-template-columns: 1fr; gap: 10px; }
.qa-btn {
    display: flex; align-items: center; gap: 12px;
    background: #f9f9f8;
    border: 1.5px solid #e1e3e2;
    border-radius: 10px;
    padding: 12px 16px;
    text-decoration: none;
    color: #174413;
    font-size: 13px; font-weight: 600;
    transition: background 0.2s, border-color 0.2s;
}
.qa-btn:hover { background: #edf7e8; border-color: #a1d494; }
.qa-btn .material-symbols-outlined { font-size: 20px; }

/* ── AKUN PAGE ── */
.akun-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.avatar-circle {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #174413, #3b6934);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 800; color: #bcf0ae;
    flex-shrink: 0;
}
.akun-info {
    background: #f9f9f8;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}
.akun-info-detail .username { font-size: 20px; font-weight: 800; color: #174413; }
.akun-info-detail .role { font-size: 13px; color: #717a6d; margin-top: 4px; }

