/* =========================
   Root / reset
========================= */
:root {
    --primary: #4caf50;
    --primary-dark: #3f9443;
    --primary-soft: #ecf9ee;
    --bg: #f5f6f7;
    --card: #ffffff;
    --text: #1f1f1f;
    --muted: #7b7b7b;
    --border: #e5e7eb;
    --danger: #d92d20;
    --warning: #f59e0b;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
    --container: 1180px;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-pill: 999px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

/* =========================
   Layout
========================= */
.container {
    width: min(100% - 24px, var(--container));
    margin: 0 auto;
}

.site-main {
    padding: 18px 0 110px;
}

.mobile-app {
    max-width: 480px;
    margin: 0 auto;
}

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
}

/* =========================
   Generic sections / cards
========================= */
.section {
    margin-bottom: 20px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-head h3 {
    margin: 0;
    font-size: 1.2rem;
}

.section-head a {
    color: var(--muted);
    font-size: 0.9rem;
}

.admin-card,
.table-card,
.form-card,
.card {
    background: #fff;
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.auth-card {
    max-width: 560px;
    margin: 0 auto;
}

.auth-card + .auth-card {
    margin-top: 18px;
}

.card-title,
.section-title {
    margin: 0 0 10px;
    font-size: 2rem;
    line-height: 1.15;
}

.section-subtitle {
    margin: 0 0 20px;
    color: var(--muted);
}

/* =========================
   Hero / banners
========================= */
.hero-card {
    background: linear-gradient(180deg, #6ad56f 0%, #b8f1b7 100%);
    border-radius: 28px;
    padding: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
    margin-bottom: 18px;
}

.hero-card h2 {
    margin: 0 0 8px;
    font-size: 1.7rem;
    line-height: 1.2;
}

.hero-card p {
    margin: 0;
    color: #245128;
    font-size: 0.95rem;
}

/* =========================
   Search
========================= */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-radius: 999px;
    padding: 12px 16px;
    box-shadow: var(--shadow);
    margin: 18px 0 22px;
}

.search-bar input {
    border: 0;
    outline: 0;
    width: 100%;
    background: transparent;
    font-size: 0.95rem;
}

.search-bar button {
    border: 0;
    background: transparent;
    padding: 0;
}

/* =========================
   Categories
========================= */
.category-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.category-pill {
    display: block;
    text-align: center;
}

.category-pill .icon-wrap {
    width: 62px;
    height: 62px;
    margin: 0 auto 8px;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.category-pill .icon-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.category-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ecf9ee;
    color: var(--primary-dark, #3f9443);
    font-weight: 700;
    font-size: 1rem;
}

.category-pill span {
    display: block;
    font-size: 0.82rem;
    color: var(--muted);
}

/* =========================
   Product cards
========================= */
.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.product-card {
    background: var(--card);
    border-radius: 22px;
    padding: 12px;
    box-shadow: var(--shadow);
    position: relative;
}

.product-card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    margin-bottom: 12px;
}

.product-card h4 {
    font-size: 1rem;
    margin: 0 0 6px;
}

.product-card .meta {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 8px;
}

.product-card .price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.product-card .price {
    font-weight: 700;
    color: var(--primary-dark);
    font-size: 1rem;
}

/* =========================
   Buttons
========================= */
.btn,
.cta-btn,
.add-btn,
.secondary-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: var(--radius-pill);
    padding: 12px 18px;
    font-weight: 700;
    text-decoration: none;
    transition: 0.2s ease;
}

.btn,
.cta-btn,
.add-btn {
    background: var(--primary);
    color: #fff;
}

.btn:hover,
.cta-btn:hover,
.add-btn:hover {
    background: var(--primary-dark);
}

.btn-secondary,
.secondary-btn {
    background: #f1f3f4;
    color: #444;
}

.btn-secondary:hover,
.secondary-btn:hover {
    background: #e6e8ea;
}

.btn-sm {
    padding: 9px 14px;
    font-size: 0.88rem;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

/* =========================
   Product details
========================= */
.product-details-page {
    display: grid;
    gap: 18px;
}

.product-gallery,
.product-info-box {
    background: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 18px;
}

.product-gallery img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

.product-info-box h1,
.product-info-box h2 {
    margin: 0 0 10px;
}

.product-info-box .product-price {
    color: var(--primary-dark);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.qty-box {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: #f7f7f7;
    border-radius: 999px;
}

.qty-box button {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    box-shadow: var(--shadow);
}

.bottom-buy-bar {
    position: sticky;
    bottom: 90px;
    z-index: 20;
    margin-top: 16px;
    background: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

/* =========================
   Cart / checkout
========================= */
.cart-list {
    display: grid;
    gap: 14px;
}

.cart-item {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 14px;
    background: #fff;
    border-radius: 22px;
    box-shadow: var(--shadow);
    padding: 14px;
}

.cart-item img {
    width: 88px;
    height: 88px;
    object-fit: contain;
    border-radius: 18px;
    background: #f9f9f9;
}

.cart-item h4 {
    margin: 0 0 6px;
}

.cart-item .meta {
    color: var(--muted);
    font-size: 0.9rem;
}

.cart-item .price {
    margin-top: 6px;
    font-weight: 700;
    color: var(--primary-dark);
}

.coupon-card {
    background: linear-gradient(90deg, #55c95d, #43b54d);
    color: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 16px 18px;
    margin: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.coupon-card .apply-btn {
    background: #fff;
    color: var(--primary-dark);
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
}

.summary-card {
    background: #fff;
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 18px;
    margin-top: 14px;
}

.summary-line {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    color: #555;
}

.summary-line.total {
    border-bottom: 0;
    padding-top: 16px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.summary-line.total span:last-child {
    color: var(--primary-dark);
    font-size: 1.8rem;
}

/* =========================
   Admin cards / tables
========================= */
.admin-card,
.table-card {
    border-radius: 20px;
    padding: 18px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table th {
    color: #555;
    font-size: 0.92rem;
}

table td {
    font-size: 0.95rem;
}

/* =========================
   Admin dashboard
========================= */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 16px;
}

.stat-card {
    background: #fff;
    border-radius: 24px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.stat-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.stat-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.stat-card-value {
    margin: 0;
    font-size: 2rem;
    line-height: 1;
    font-weight: 800;
    color: var(--text);
}

.stat-card-meta {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.stat-card-blue {
    background: linear-gradient(180deg, #eef6ff 0%, #ffffff 100%);
}

.stat-card-blue .stat-card-icon {
    background: #dbeafe;
    color: #175cd3;
}

.stat-card-primary {
    background: linear-gradient(180deg, #ecf9ee 0%, #ffffff 100%);
}

.stat-card-primary .stat-card-icon {
    background: #d8f3dc;
    color: var(--primary-dark);
}

.stat-card-purple {
    background: linear-gradient(180deg, #f4efff 0%, #ffffff 100%);
}

.stat-card-purple .stat-card-icon {
    background: #ebe0ff;
    color: #6f42c1;
}

.stat-card-amber {
    background: linear-gradient(180deg, #fff7e6 0%, #ffffff 100%);
}

.stat-card-amber .stat-card-icon {
    background: #ffe7b3;
    color: #b7791f;
}

.stat-card-red {
    background: linear-gradient(180deg, #fff1f1 0%, #ffffff 100%);
}

.stat-card-red .stat-card-icon {
    background: #ffd6d6;
    color: #d92d20;
}

/* =========================
   Status badges
========================= */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.status-pending {
    background: #fff8e8;
    color: #9a6700;
}

.status-confirmed {
    background: #eef6ff;
    color: #175cd3;
}

.status-preparing {
    background: #f4efff;
    color: #6f42c1;
}

.status-ready {
    background: #ecfdf3;
    color: #027a48;
}

.status-delivery {
    background: #eaf4ff;
    color: #1d4ed8;
}

.status-delivered {
    background: #ecf9ee;
    color: #256b2a;
}

.status-cancelled {
    background: #fff1f1;
    color: #b42318;
}

.status-default {
    background: #f3f4f6;
    color: #4b5563;
}

/* =========================
   Forms
========================= */
.form-card {
    border-radius: 22px;
    padding: 18px;
}

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
    outline: none;
}

.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
}

/* =========================
   Alerts / flash
========================= */
.flash {
    margin: 0 0 16px;
    padding: 14px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    box-shadow: var(--shadow);
    background: #fff;
}

.flash.success {
    background: #ecf9ee;
    color: #256b2a;
    border: 1px solid #cfead3;
}

.flash.error {
    background: #fff1f1;
    color: #b42318;
    border: 1px solid #f3c7c7;
}

.flash.warning {
    background: #fff8e8;
    color: #9a6700;
    border: 1px solid #f0dfae;
}

.flash.info {
    background: #eef6ff;
    color: #175cd3;
    border: 1px solid #cfe0ff;
}

/* =========================
   Utilities
========================= */
.text-muted {
    color: var(--muted);
}

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

.mt-0 {
    margin-top: 0;
}

.mb-0 {
    margin-bottom: 0;
}

.mb-3 {
    margin-bottom: 18px;
}

.d-flex {
    display: flex;
}

.gap-2 {
    gap: 12px;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

/* =========================
   Disabled states
========================= */
.add-btn:disabled,
.cta-btn:disabled,
.qty-box button:disabled,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================
   Page preloader
========================= */
.page-preloader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.page-preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-box {
    text-align: center;
    background: #ffffff;
    padding: 28px 24px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    min-width: 220px;
}

.preloader-box h3 {
    margin: 14px 0 6px;
    font-size: 20px;
    color: #1f2937;
}

.preloader-box p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

.preloader-spinner {
    width: 52px;
    height: 52px;
    margin: 0 auto;
    border: 5px solid #e5e7eb;
    border-top: 5px solid var(--primary);
    border-radius: 50%;
    animation: spinLoader 0.8s linear infinite;
}

@keyframes spinLoader {
    100% {
        transform: rotate(360deg);
    }
}

/* =========================
   Responsive
========================= */
@media (max-width: 767px) {
    .hero-card h2 {
        font-size: 1.45rem;
    }

    .card-title,
    .section-title {
        font-size: 1.55rem;
    }

    .bottom-buy-bar {
        bottom: 90px;
        flex-direction: column;
        align-items: stretch;
    }
}

@media (min-width: 768px) {
    .site-main {
        padding-bottom: 30px;
    }

    .mobile-app {
        max-width: 100%;
    }

    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .category-row {
        grid-template-columns: repeat(6, 1fr);
    }

    .product-details-page {
        grid-template-columns: 1.05fr 1fr;
        align-items: start;
    }

    .cart-list {
        gap: 16px;
    }

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

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1100px) {
    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}