@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: #f0f2f5;
}

/* ==================== LOGIN PAGE ==================== */
.login-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header .logo-img {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    margin-bottom: 15px;
}

.login-header h1 {
    color: #ff6b6b;
    font-size: 28px;
}

.login-header p {
    color: #666;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.3s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #ff6b6b;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background: #ff6b6b;
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s;
}

.btn-login:hover {
    transform: translateY(-2px);
}

.error-message {
    background: #fee;
    color: #ff4444;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.demo-cred {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: #999;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* ==================== ADMIN LAYOUT ==================== */
.admin-container {
    display: flex;
    min-height: 100vh;
}

/* ==================== HAMBURGER TOGGLE ==================== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: #2c3e50;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: #f0f2f5;
}

/* Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 260px;
    background: #2c3e50;
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease, width 0.3s ease;
}

.sidebar-header {
    text-align: center;
    padding: 25px 20px;
    border-bottom: 1px solid #34495e;
}

.sidebar-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    margin-bottom: 10px;
    object-fit: cover;
}

.sidebar-header h2 {
    font-size: 20px;
    margin-bottom: 5px;
}

.sidebar-header span {
    font-size: 12px;
    color: #999;
}

.sidebar-nav {
    padding: 20px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 25px;
    color: #ccc;
    text-decoration: none;
    transition: all 0.3s;
    white-space: nowrap;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: #ff6b6b;
    color: white;
}

.sidebar-nav i {
    width: 20px;
    flex-shrink: 0;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 20px;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

/* ==================== TOP BAR ==================== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 15px 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    gap: 12px;
    flex-wrap: wrap;
}

.top-bar h1 {
    font-size: clamp(16px, 3vw, 24px);
    white-space: nowrap;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f2f5;
    padding: 8px 15px;
    border-radius: 30px;
    flex-shrink: 0;
}

/* ==================== STATS CARDS ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.stat-card i {
    font-size: 42px;
    color: #ff6b6b;
    flex-shrink: 0;
}

.stat-info h3 {
    font-size: clamp(20px, 3vw, 28px);
    margin-bottom: 5px;
    word-break: break-all;
}

.stat-info p {
    color: #666;
    font-size: 13px;
}

/* ==================== CHART ==================== */
.chart-container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    overflow: hidden;
}

.chart-container h3 {
    margin-bottom: 20px;
    font-size: clamp(14px, 2.5vw, 18px);
}

/* ==================== RECENT ORDERS ==================== */
.recent-orders {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.recent-orders h3 {
    margin-bottom: 20px;
    font-size: clamp(14px, 2.5vw, 18px);
}

/* ==================== DATA TABLE ==================== */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 15px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    min-width: 500px;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table td {
    font-size: 13px;
    vertical-align: middle;
}

/* Product image in table */
.data-table td img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
}

/* ==================== STATUS BADGE ==================== */
.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    display: inline-block;
}

.status-menunggu { background: #ffeaa7; color: #d4a000; }
.status-dikonfirmasi { background: #b2dfdb; color: #00695c; }
.status-diproses { background: #bbdef5; color: #1565c0; }
.status-dikirim { background: #c8e6c9; color: #2e7d32; }
.status-selesai { background: #a5d6a7; color: #1b5e20; }

/* ==================== BUTTONS ==================== */
.btn-add {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-add:hover {
    background: #ff5252;
    transform: translateY(-2px);
}

.btn-edit {
    background: #4ecdc4;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 5px;
    font-size: 12px;
    white-space: nowrap;
}

.btn-delete {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
}

.btn-edit:hover, .btn-delete:hover {
    opacity: 0.8;
}

/* ==================== MODAL ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-save {
    background: #4ecdc4;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
}

.btn-cancel {
    background: #ddd;
    color: #666;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
}

/* ==================== FILTER SELECT ==================== */
#filterStatus {
    padding: 8px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    flex-shrink: 0;
}

/* ==================== RESPONSIVE: TABLET (≤1024px) ==================== */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }
}

/* ==================== RESPONSIVE: MOBILE (≤768px) ==================== */
@media (max-width: 768px) {
    /* Show hamburger */
    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Sidebar slides off-screen by default */
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
    }

    /* Sidebar visible when open */
    .sidebar.open {
        transform: translateX(0);
    }

    /* Main content full width */
    .main-content {
        margin-left: 0;
        padding: 15px;
    }

    /* Top bar stacks nicely */
    .top-bar {
        padding: 12px 15px;
        gap: 10px;
    }

    .top-bar h1 {
        font-size: 18px;
        flex: 1;
    }

    /* Stats: 2 columns on tablet-mobile */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .stat-card {
        padding: 18px;
        gap: 12px;
    }

    .stat-card i {
        font-size: 32px;
    }

    /* Chart padding */
    .chart-container,
    .recent-orders {
        padding: 18px;
    }

    /* Table scrollable container */
    .data-table,
    #ordersTable,
    #productsTable,
    #reviewsTable {
        min-width: 550px;
    }

    /* Wrap tables */
    .main-content > table,
    .recent-orders > table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 15px;
    }

    /* Modal full screen on small phones */
    .modal-content {
        padding: 20px;
    }

    .modal-buttons {
        justify-content: stretch;
    }

    .btn-save,
    .btn-cancel {
        flex: 1;
        text-align: center;
    }
}

/* ==================== RESPONSIVE: SMALL MOBILE (≤480px) ==================== */
@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
        gap: 10px;
        flex-direction: column;
        align-items: flex-start;
    }

    .stat-card i {
        font-size: 28px;
    }

    .stat-info h3 {
        font-size: 20px;
    }

    .stat-info p {
        font-size: 11px;
    }

    .top-bar {
        padding: 10px 12px;
    }

    .main-content {
        padding: 10px;
    }

    .chart-container,
    .recent-orders {
        padding: 14px;
    }

    .btn-add {
        padding: 8px 14px;
        font-size: 13px;
    }

    #filterStatus {
        font-size: 13px;
        padding: 7px 10px;
    }

    .admin-info span {
        display: none;
    }
}

/* ==================== RESPONSIVE: VERY SMALL (≤360px) ==================== */
@media (max-width: 360px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        align-items: center;
    }
}