* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f3f4f6;
    color: #1f2937;
    line-height: 1.6;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    background: #1f2937;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    color: #fff;
    font-size: 1.25rem;
    font-weight: 600;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 0.5rem;
}

.nav-links a {
    color: #9ca3af;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-links a:hover, .nav-links a.active {
    color: #fff;
    background: #374151;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

h1 {
    margin-bottom: 1.5rem;
    color: #111827;
    font-size: clamp(1.5rem, 4vw, 2rem);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    flex-shrink: 0;
}

.orders-icon { background: #dbeafe; }
.today-icon { background: #fef3c7; }
.customers-icon { background: #d1fae5; }
.revenue-icon { background: #fce7f3; }

.stat-info {
    min-width: 0;
}

.stat-info h3 {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Charts Row */
.charts-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.chart-card h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #374151;
}

.chart-card canvas {
    max-width: 100%;
    height: auto !important;
}

/* Content Row */
.content-row {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card.wide {
    grid-column: span 2;
}

.card.full-width {
    width: 100%;
}

.card h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: #374151;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1.25rem;
    padding: 0 1.25rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 500px;
}

.data-table th, .data-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.data-table th {
    background: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 0.8rem;
    position: sticky;
    top: 0;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.data-table td {
    font-size: 0.875rem;
}

/* Status Badges */
.status {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-draft { background: #fef3c7; color: #92400e; }
.status-confirmed { background: #dbeafe; color: #1e40af; }
.status-sent_to_kitchen { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* Filter Form */
.filter-form {
    margin-bottom: 0;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex: 1;
    min-width: 120px;
}

.filter-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #374151;
}

.filter-group input, .filter-group select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    width: 100%;
}

.filter-group input:focus, .filter-group select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
    text-align: center;
}

.btn-primary {
    background: #4f46e5;
    color: #fff;
}

.btn-primary:hover {
    background: #4338ca;
}

.btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    background: #4f46e5;
    color: #fff;
}

.btn-sm:hover {
    background: #4338ca;
}

.result-count {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

/* Order Details */
.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.order-header h2 {
    font-size: clamp(1.25rem, 3vw, 1.5rem);
}

.order-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 8px;
}

.order-meta p {
    margin: 0;
    font-size: 0.875rem;
}

.text-right {
    text-align: right;
}

/* ===================== */
/* RESPONSIVE BREAKPOINTS */
/* ===================== */

/* Large Tablets and Small Desktops */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .content-row {
        grid-template-columns: 1fr;
    }

    .card.wide {
        grid-column: span 1;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
        gap: 0.25rem;
    }

    .nav-links a {
        padding: 0.4rem 0.75rem;
        font-size: 0.875rem;
    }

    .container {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem;
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }

    .stat-icon {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
    }

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

    .chart-card {
        padding: 1rem;
    }

    .card {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .filter-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .filter-group {
        width: 100%;
    }

    .filter-buttons {
        width: 100%;
        justify-content: stretch;
    }

    .filter-buttons .btn {
        flex: 1;
    }

    .data-table {
        min-width: 600px;
    }

    .data-table th, .data-table td {
        padding: 0.6rem 0.4rem;
        font-size: 0.8rem;
    }
}

/* Mobile Phones */
@media (max-width: 480px) {
    .navbar {
        padding: 0.5rem 0.75rem;
    }

    .nav-brand {
        font-size: 1rem;
        text-align: center;
        width: 100%;
    }

    .nav-links {
        gap: 0.15rem;
    }

    .nav-links a {
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }

    .container {
        padding: 0.75rem;
    }

    h1 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .stat-info h3 {
        font-size: 0.65rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    .chart-card, .card {
        padding: 0.75rem;
        border-radius: 8px;
    }

    .chart-card h3, .card h3 {
        font-size: 0.9rem;
    }

    .order-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .order-meta {
        grid-template-columns: 1fr;
        padding: 0.75rem;
    }

    .btn {
        padding: 0.45rem 0.75rem;
        font-size: 0.8rem;
    }

    .status {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }

    .data-table th, .data-table td {
        padding: 0.5rem 0.35rem;
        font-size: 0.75rem;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: row;
        text-align: left;
    }

    .nav-links a {
        padding: 0.3rem 0.4rem;
        font-size: 0.75rem;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .btn, .nav-links a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .data-table tbody tr:active {
        background: #e5e7eb;
    }
}

/* Print styles */
@media print {
    .navbar {
        position: relative;
        background: #fff;
        color: #000;
    }

    .nav-links {
        display: none;
    }

    .btn {
        display: none;
    }

    .card, .stat-card, .chart-card {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}
