/* ── RESET & BASE ── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f5f7fa;
    color: #333;
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
    width: 70px;
    background: linear-gradient(180deg, #00703C 0%, #004d26 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.sidebar-logo {
    margin-bottom: 30px;
}

.sidebar-logo img {
    width: 45px;
    height: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 15px;
    flex: 1;
}

.nav-item {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-size: 20px;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.sidebar-bottom {
    margin-top: auto;
}

.sidebar-bottom .nav-item:hover {
    background: rgba(220, 53, 69, 0.3);
    color: #fff;
}

/* ── MAIN WRAPPER ── */
.main-wrapper {
    flex: 1;
    margin-left: 70px;
    padding: 20px 30px;
    min-height: 100vh;
}

/* ── TOP HEADER ── */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 25px;
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 25px;
    position: relative;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-logo {
    height: 45px;
    width: auto;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
}

.page-sub {
    font-size: 11px;
    font-weight: 600;
    color: #00703C;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-date {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
}

.header-date i {
    color: #00703C;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: #f0f4f8;
    border-radius: 25px;
}

.user-avatar {
    width: 35px;
    height: 35px;
    background: #00703C;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

/* ── STATS ROW ── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #1a1a2e;
}

/* ── CONTENT GRID ── */
.content-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.table-panel {
    background: #fff;
    border-radius: 15px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.table-panel.full-width {
    width: 100%;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.panel-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-wrap i {
    position: absolute;
    left: 12px;
    color: #999;
    font-size: 14px;
}

.search-wrap input {
    padding: 10px 15px 10px 38px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    width: 220px;
    transition: border-color 0.3s ease;
}

.search-wrap input:focus {
    outline: none;
    border-color: #00703C;
}

select {
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

select:focus {
    outline: none;
    border-color: #00703C;
}

.btn-download {
    padding: 10px 18px;
    background: #00703C;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s ease;
}

.btn-download:hover {
    background: #005a2f;
}

.btn-refresh {
    padding: 10px 18px;
    background: #f0f4f8;
    color: #333;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-refresh:hover {
    background: #e0e4e8;
}

/* ── TABLE ── */
.table-wrap {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    padding: 15px 20px;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f8f9fa;
    border-bottom: 1px solid #eee;
}

.admin-table td {
    padding: 15px 20px;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}

.admin-table tbody tr {
    transition: background 0.2s ease;
}

.admin-table tbody tr:hover {
    background: #f8f9fa;
}

.loading-row,
.empty-row {
    text-align: center;
    padding: 40px 20px !important;
    color: #999;
    font-size: 14px;
}

/* ── SPINNER ── */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 112, 60, 0.2);
    border-top-color: #00703C;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── USER ID BADGE ── */
.user-id {
    font-weight: 700;
    color: #00703C;
}

/* ── ROLE BADGE ── */
.role-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.role-badge.super_admin {
    background: #f3e8ff;
    color: #7c3aed;
}

.role-badge.admin {
    background: #fff8e6;
    color: #f0a500;
}

.role-badge.user {
    background: #e8f4ff;
    color: #2d7dd2;
}

/* ── STALL ID ── */
.stall-id {
    font-family: monospace;
    color: #666;
}

.stall-id.empty {
    color: #ccc;
    font-style: italic;
}

/* ── DATE ── */
.date-cell {
    color: #888;
    font-size: 13px;
}

/* ── ACTION BUTTONS ── */
.action-btns {
    display: flex;
    gap: 8px;
}

.act-btn {
    width: 35px;
    height: 35px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.act-btn.edit {
    background: #e8f4ff;
    color: #2d7dd2;
}

.act-btn.edit:hover {
    background: #2d7dd2;
    color: #fff;
}

.act-btn.delete {
    background: #fdecea;
    color: #e05555;
}

.act-btn.delete:hover {
    background: #e05555;
    color: #fff;
}

/* ── PAGINATION ── */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 25px;
    border-top: 1px solid #eee;
}

.pagination-info {
    font-size: 14px;
    color: #666;
}

.pagination-buttons {
    display: flex;
    gap: 10px;
}

.btn-page {
    padding: 8px 16px;
    background: #f0f4f8;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-page:hover:not(:disabled) {
    background: #00703C;
    color: #fff;
    border-color: #00703C;
}

.btn-page:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── MODAL ── */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 15px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: #00703C;
}

.modal-close {
    width: 35px;
    height: 35px;
    border: none;
    background: #f0f4f8;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #fdecea;
    color: #e05555;
}

#editForm {
    padding: 25px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #00703C;
}

.form-group input:disabled {
    background: #f5f5f5;
    color: #999;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-cancel {
    padding: 12px 24px;
    background: #f0f4f8;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    background: #e0e4e8;
}

.btn-save {
    padding: 12px 24px;
    background: #00703C;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-save:hover {
    background: #005a2f;
}

/* ── TOAST ── */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #00703C;
    color: #fff;
    padding: 15px 25px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 5px 20px rgba(0, 112, 60, 0.3);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    z-index: 2000;
}

.toast.show {
    transform: translateX(0);
}

.toast i {
    font-size: 18px;
}

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .panel-actions {
        flex-wrap: wrap;
    }
    
    .search-wrap input {
        width: 180px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    
    .main-wrapper {
        margin-left: 60px;
        padding: 15px;
    }
    
    .header-center {
        display: none;
    }
    
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .panel-actions {
        width: 100%;
    }
    
    .search-wrap {
        width: 100%;
    }
    
    .search-wrap input {
        width: 100%;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 12px 10px;
        font-size: 13px;
    }
    
    .pagination-wrap {
        flex-direction: column;
        gap: 15px;
    }
}

/* Additional */
.log-date-range {
    display: flex;
    align-items: center;
    gap: 6px;
}
.log-date-range input[type="date"] {
    border: 1.5px solid var(--border, #d8e6dc);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 0.84rem;
    color: var(--ink, #1a2e22);
    background: var(--bg, #f4f8f5);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    font-family: inherit;
}
.log-date-range input[type="date"]:focus {
    border-color: #00703C;
}
.date-range-sep {
    font-size: 0.8rem;
    color: var(--muted, #7a8c80);
    font-weight: 500;
}
/* Action badge colors for logs */
.action-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.action-badge.login    { background: #e6f5ec; color: #00703C; }
.action-badge.logout   { background: #f0f5f2; color: #5a6a60; }
.action-badge.create   { background: #e8f4ff; color: #2d7dd2; }
.action-badge.update   { background: #fff8e6; color: #c47d00; }
.action-badge.delete   { background: #fdecea; color: #e05555; }
.action-badge.default  { background: #f3e8ff; color: #7c3aed; }
/* Log detail cell */
.log-details {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.82rem;
    color: var(--muted, #7a8c80);
}
.log-ip {
    font-size: 0.82rem;
    font-family: monospace;
    color: var(--ink-soft, #3d5445);
}