:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --bg-color: #f3f4f6;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.1) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 40px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
}

.cart-btn {
    position: relative;
    background: white;
    padding: 10px 20px;
    border-radius: 99px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: 0.2s;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
}

.cart-btn:hover {
    transform: translateY(-2px);
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 99px;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

.product-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: 0.3s;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.product-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: #e5e7eb;
}

.product-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.product-cat {
    font-size: 0.75rem;
    color: var(--primary);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 5px;
}

.product-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.product-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    flex-grow: 1;
}

.product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.price {
    font-size: 1.25rem;
    font-weight: 800;
}

.add-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

.add-btn:hover {
    background: var(--primary-dark);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

/* Modal Scroll Fix */
.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.3s ease;
    max-height: 85vh;
    /* Fix for mobile cut-off */
    overflow-y: auto;
    /* Enable scroll */
    display: flex;
    flex-direction: column;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: 0.2s;
}

/* Admin Styles */
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 20px;
    background: white;
    border-radius: 16px;
}

.admin-table th {
    background: #f8fafc;
    padding: 18px 24px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e2e8f0;
}

.admin-table th:first-child {
    border-top-left-radius: 16px;
}

.admin-table th:last-child {
    border-top-right-radius: 16px;
}

.admin-table td {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: #f8fafc;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
}

.status-Pending {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.status-Paid {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #6ee7b7;
}

.status-Shipped {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #93c5fd;
}

.status-Cancelled {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fca5a5;
}

.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
    margin-right: 5px;
}

.btn-edit {
    background: #eff6ff;
    color: #2563eb;
}

.btn-edit:hover {
    background: #dbeafe;
}

.btn-delete {
    background: #fef2f2;
    color: #ef4444;
}

.btn-delete:hover {
    background: #fee2e2;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.checkout-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
}

/* --- Mobile Optimization & Product Detail --- */

.product-detail-container {
    display: grid;
    grid-template-columns: 1fr 240px;
    width: 100%;
    max-width: 700px;
    margin: 20px auto;
    gap: 15px;
    background: white;
    padding: 30px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
    align-items: center;
    /* Vertically center the text and image */
}

/* Side-by-Side only for the top section */
.p-block-title_price {
    grid-column: 1;
    grid-row: 1;
}

.p-block-image_gallery {
    grid-column: 2;
    grid-row: 1;
}

/* All other blocks go full width below */
.p-block-countdown,
.p-block-checkout,
.p-block-category,
.p-block-custom-text,
.p-block-custom-image,
.p-block-custom-html {
    grid-column: 1 / span 2;
}

.detail-main-img {
    width: 100%;
    height: auto;
    max-height: 280px;
    border-radius: 12px;
    object-fit: contain;
    background: #fdfdfd;
}

.detail-title {
    font-size: 2.5rem;
    margin-bottom: 15px;
    line-height: 1.2;
}

.sale-tag {
    background: #fee2e2;
    color: #b91c1c;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.8rem;
    vertical-align: middle;
    margin-left: 10px;
    display: inline-block;
}

/* Admin Table Scroll Wrapper */
.admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* Valid property */
    width: 100%;
}

/* Mobile Responsive Rules */
@media (max-width: 900px) {
    .product-detail-container {
        margin: 5px auto;
        padding: 12px;
        border-radius: 12px;
        grid-template-columns: 1fr 130px;
        /* Pulling image closer on mobile */
        gap: 8px;
    }

    .detail-main-img {
        width: 130px !important;
        height: 130px !important;
    }

    .detail-title {
        font-size: 1.25rem !important;
        margin-bottom: 8px !important;
    }

    .p-price-section span[style*="font-size: 2.2rem"] {
        font-size: 1.5rem !important;
    }

    .p-short-desc {
        font-size: 0.85rem !important;
        line-height: 1.4 !important;
    }

    .gallery-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }

    /* Admin Mobile Adjustments */
    .admin-table th,
    .admin-table td {
        padding: 12px 15px;
        font-size: 0.8rem;
        white-space: nowrap;
        /* Forces scroll if too wide */
    }

    .sidebar {
        z-index: 1001;
        /* Ensure above everything */
    }
}