:root {
    --primary: #0f172a;
    /* Slate 900 */
    --primary-dark: #020617;
    /* Slate 950 */
    --accent: #f59e0b;
    /* Amber 500 */
    --accent-hover: #d97706;
    /* Amber 600 */
    --amber-light: #fef3c7;
    /* Amber 50 */
    --red: #ef4444;
    --red-dark: #cc0000;
    --bg: #f8fafc;
    /* Light Slate */
    --surface: rgba(255, 255, 255, 0.95);
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --text: #0f172a;
    --text-muted: #64748b;
    --success: #059669;
    --warning: #d97706;
    --danger: #ef4444;
    --radius: 16px;
    --page-max: 1300px;
    --page-pad: clamp(14px, 2.6vw, 28px);
    --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.04);
}

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

html,
body {
    height: 100%;
    min-height: 100%;
    overflow-x: hidden;
    overflow-x: clip;
    overscroll-behavior-x: none;
}

html {
    background: var(--primary-dark);
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', 'Cairo', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
}

[dir="rtl"] * {
    font-family: 'Cairo', sans-serif;
}

.container {
    width: min(var(--page-max), 100%);
    margin: 0 auto;
    padding: 1.5rem var(--page-pad) 3rem;
    flex: 1 0 auto;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Global Header Components */
.site-header {
    position: sticky;
    top: 0;
    z-index: 300;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.header-inner {
    width: min(var(--page-max), 100%);
    margin: 0 auto;
    padding: 10px var(--page-pad);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.logo-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    transition: transform 0.2s;
}

.logo-link:hover {
    transform: scale(1.05);
}

.logo-link img {
    height: 44px;
    display: block;
    filter: brightness(0) invert(1);
}

.header-title {
    flex: 1;
    min-width: 220px;
}

.header-title h1 {
    font-size: 1.125rem;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-title p {
    font-size: 0.81rem;
    opacity: 0.65;
    font-weight: 500;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: center;
}

.mobile-menu-toggle,
.mobile-menu-close,
.mobile-menu-backdrop {
    display: none;
}

.mobile-menu-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}

.mobile-menu-toggle span {
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 99px;
}

.mobile-menu-close {
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    align-self: flex-end;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.lang-switcher {
    display: flex;
    background: rgba(255, 255, 255, 0.08);
    padding: 3px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-btn {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn:hover {
    color: white;
}

.lang-btn.active {
    background: var(--accent);
    color: var(--primary);
}

.action-link {
    text-decoration: none;
    border-radius: 999px;
    padding: 0.45rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    white-space: nowrap;
    transition: all 0.2s;
}

.action-link:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.4);
}

.action-link.primary {
    background: var(--accent);
    color: var(--primary);
    border-color: var(--accent);
}

.action-link.primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* Main Wrapper */
.main {
    width: min(var(--page-max), 100%);
    margin: 0 auto;
    padding: 1.5rem var(--page-pad) 3rem;
    flex: 1 0 auto;
}

/* Global Footer Components */
.site-footer {
    margin-top: auto;
    width: 100%;
    flex-shrink: 0;
    background: var(--primary-dark);
    color: white;
    padding: 1.25rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.site-footer img {
    height: 28px;
    filter: brightness(0) invert(1);
    vertical-align: middle;
    margin: 0 8px 0 0;
    opacity: 0.8;
}

.site-footer span {
    font-size: 0.82rem;
    font-weight: 600;
    vertical-align: middle;
    opacity: 0.7;
}

/* Responsive Header/Footer */
@media (max-width: 760px) {
    .header-inner {
        padding: 10px 14px;
        justify-content: space-between;
    }

    .mobile-menu-toggle,
    .mobile-menu-close {
        display: inline-flex;
    }

    .mobile-menu-backdrop {
        position: fixed;
        inset: 0;
        z-index: 250;
        border: 0;
        background: rgba(2, 6, 23, 0.48);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    body.mobile-menu-open .mobile-menu-backdrop {
        display: block;
        opacity: 1;
        pointer-events: auto;
    }

    body.mobile-menu-open {
        overflow: hidden;
    }

    .header-actions {
        position: fixed;
        top: 0;
        right: 0;
        z-index: 360;
        width: min(84vw, 320px);
        height: 100vh;
        margin-left: 0;
        padding: 18px;
        background: rgba(15, 23, 42, 0.98);
        border-left: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: -16px 0 32px rgba(2, 6, 23, 0.32);
        display: none;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0.75rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        contain: layout paint style;
        transform: translateX(105%);
        visibility: hidden;
        pointer-events: none;
        transition: transform 0.24s ease;
    }

    [dir="rtl"] .header-actions {
        right: auto;
        left: 0;
        border-left: 0;
        border-right: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 16px 0 32px rgba(2, 6, 23, 0.32);
        transform: translateX(-105%);
    }

    body.mobile-menu-open .header-actions,
    [dir="rtl"] body.mobile-menu-open .header-actions {
        display: flex;
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
    }

    .header-actions .lang-switcher {
        justify-content: center;
    }

    .header-actions .action-link {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .logo-link span {
        font-size: 0.76rem !important;
        white-space: normal !important;
        max-width: 210px;
        line-height: 1.25;
    }

    .action-link {
        padding: 0.42rem 0.82rem;
    }

    .main {
        padding: 1rem 0.875rem 2rem;
    }

    .container {
        padding: 1rem 0.875rem 2rem;
    }

    .header-title h1 {
        font-size: 1rem;
    }

    .header-title p {
        font-size: 0.75rem;
    }
}

/* Base Inputs */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="file"],
textarea,
select {
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
    max-width: 100%;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--amber-light);
}

input[type="file"].is-uploading {
    opacity: 0.72;
    cursor: wait;
}

.file-upload-status {
    display: none;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    color: var(--accent-hover);
    font-size: 0.82rem;
    font-weight: 700;
}

.file-upload-status.active {
    display: inline-flex;
}

.file-upload-status::before {
    content: '';
    width: 14px;
    height: 14px;
    border-radius: 999px;
    border: 2px solid rgba(245, 158, 11, 0.25);
    border-top-color: var(--accent);
    animation: uploadSpin 0.75s linear infinite;
}

@keyframes uploadSpin {
    to {
        transform: rotate(360deg);
    }
}

textarea {
    width: 100%;
    min-height: 96px;
    resize: vertical;
}

/* Legacy styles compatibility if needed */
.btn {
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.table-wrapper,
.table-wrap,
.cat-table-wrap {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 1000px;
    min-width: 100%;
    border-collapse: collapse;
}

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

th {
    background: #f1f5f9;
    font-weight: 700;
    color: var(--primary);
}

tr:hover {
    background: #f8fafc;
}

/* =========================================================================
   Admin Specific UI Components
   ========================================================================= */

/* ── Modal ──────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 0.15s ease-out;
}

.modal {
    background: var(--surface);
    border-radius: 14px;
    width: 480px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.2s ease-out;
    border: 1px solid var(--border);
}

.modal.modal-sm {
    width: 560px;
}

.modal-head {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fafbfc;
    border-radius: 14px 14px 0 0;
}

.modal-head h3 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f1f5f9;
    color: var(--danger);
    transform: scale(1.05);
}

.modal-body {
    padding: 24px;
}

.modal-foot {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #fafbfc;
    border-radius: 0 0 14px 14px;
}

/* ── Specific Admin Components ──────── */
.cat-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: default;
    transition: all 0.15s;
    color: var(--text);
}

.cat-chip:hover {
    border-color: var(--accent);
    background: white;
}

.cat-chip-active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: white;
}

.cat-chip-active .cat-count {
    background: var(--accent);
}

.cat-chip-active .cat-actions button {
    color: white !important;
    opacity: 0.7;
}

.cat-chip .cat-count {
    background: var(--primary-light, #334155);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
}

.cat-chip .cat-actions {
    display: flex;
    gap: 2px;
    margin-left: 4px;
}

.cat-chip .cat-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    font-size: 0.8rem;
    opacity: 0.4;
    transition: opacity 0.15s;
    color: var(--text);
}

.cat-chip .cat-actions button:hover {
    opacity: 1;
    color: var(--danger);
}

.unit-badge-sm {
    font-size: 0.68rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    border: 1px solid;
    letter-spacing: 0.2px;
}

.unit-badge-sm.kg {
    color: #7c3aed;
    border-color: #ddd6fe;
    background: #f5f3ff;
}

.unit-badge-sm.sac {
    color: #0369a1;
    border-color: #bae6fd;
    background: #f0f9ff;
}

.unit-badge-sm.pc {
    color: #059669;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.unit-badge-sm.bobine {
    color: #b45309;
    border-color: #fde68a;
    background: #fffbeb;
}

.unit-badge-sm.m {
    color: #0f766e;
    border-color: #99f6e4;
    background: #f0fdfa;
}

.unit-badge-sm.box {
    color: #9333ea;
    border-color: #e9d5ff;
    background: #faf5ff;
}

.variants-container {
    padding-left: 66px;
    margin-bottom: 4px;
}

.variant-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.variant-row:hover {
    background: white;
    border-color: #cbd5e1;
}

.variant-row .v-size {
    font-weight: 700;
    min-width: 100px;
    color: var(--primary);
}

.variant-row .v-price {
    color: var(--text);
    font-weight: 600;
    min-width: 90px;
}

.variant-row .v-qty {
    color: var(--text-muted);
    min-width: 60px;
    font-weight: 500;
}

.variant-row .v-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
}

.avail-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.avail-dot.available {
    background: var(--success);
}

.avail-dot.not_available {
    background: var(--danger);
}

.avail-dot.made_to_order {
    background: var(--warning);
}

.gallery-thumbs {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.thumb-mini {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    object-fit: cover;
    background: white;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.thumb-mini:hover {
    transform: scale(1.15);
    z-index: 10;
    box-shadow: var(--shadow);
    border-color: var(--accent);
}

/* Buttons extended */
.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover {
    background: #047857;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-muted {
    background: var(--border);
    color: var(--text);
    border-color: var(--border);
}

.btn-muted:hover {
    background: #cbd5e1;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    outline: none;
    padding: 4px 8px;
    text-decoration: underline;
    font-weight: 600;
}

.btn-link:hover {
    color: var(--accent);
    box-shadow: none;
    transform: none;
}

.loading,
.helper {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
}

.badge.active {
    background: #dcfce7;
    color: #166534;
}

.badge.inactive {
    background: #f1f5f9;
    color: var(--text-muted);
}

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

/* Admin Nav Cards */
.nav-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.nav-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.nav-card .icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    color: var(--primary);
}

.nav-card .label {
    font-weight: 700;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 2px;
}

.nav-card .sublabel {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.search-wrap {
    position: relative;
    margin-bottom: 14px;
}

.search-wrap svg {
    position: absolute;
    inset-inline-start: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}

.search-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.92rem;
    font-family: inherit;
    transition: all 0.2s;
}

.search-wrap svg+.search-input {
    padding-inline-start: 38px;
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--amber-light);
}

.dashboard-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
    align-items: stretch;
}

.dashboard-filters .search-wrap {
    min-width: 0;
}

.dashboard-filters .category-filter-wrap {
    width: min(260px, 100%);
    flex: 0 0 min(260px, 100%);
}

/* Forms Structure */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
}

.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
    background: white;
    cursor: pointer;
}

.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--amber-light);
}

/* Product Rows / Category Card */
.category-group {
    margin-bottom: 24px;
}

.category-group-title {
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
    padding: 8px 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 8px;
    transition: box-shadow 0.15s, border-color 0.15s;
}

.product-row:hover {
    box-shadow: var(--shadow);
    border-color: #cbd5e1;
}

.product-row img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    flex-shrink: 0;
    background: white;
}

.product-row .info {
    flex: 1;
    min-width: 0;
}

.product-row .info strong {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
    line-height: 1.3;
}

.product-row .info .meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-weight: 500;
}

.product-row .actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(14px, 2vw, 20px) clamp(16px, 2.4vw, 24px);
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
    border-radius: var(--radius) var(--radius) 0 0;
    flex-wrap: wrap;
    gap: 12px;
}

.card-head h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin: 0;
}

.card-body {
    padding: clamp(16px, 2.5vw, 24px);
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    width: 100%;
}

@media (max-width: 768px) {
    table {
        width: 760px;
    }

    th,
    td {
        padding: 11px 12px;
    }

    .nav-cards {
        grid-template-columns: 1fr;
    }

    .card-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-head .btn,
    .card-head button {
        width: 100%;
    }

    .row-actions {
        justify-content: flex-start;
    }

    .row-actions .btn {
        flex: 1 1 120px;
    }

    .dashboard-filters {
        flex-direction: column;
    }

    .dashboard-filters .category-filter-wrap {
        width: 100%;
        flex-basis: auto;
    }

    .product-row {
        flex-wrap: wrap;
    }

    .product-row .info {
        flex: 1;
        min-width: 100%;
    }

    .product-row .actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 8px;
        padding-top: 8px;
        border-top: 1px solid var(--border);
    }

    .variants-container {
        padding-left: 0;
        margin-left: 14px;
        border-left: 2px solid var(--border);
        padding-left: 10px;
    }

    .variant-row {
        flex-wrap: wrap;
    }

    .variant-row .v-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
    }
}

/* =========================================================================
   Homepage (index.php) Styles
   ========================================================================= */
.hero-slider {
    position: relative;
    max-width: 100%;
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2.5rem;
    overflow: hidden;
    overscroll-behavior-x: none;
    touch-action: pan-y;
    background: #020617;
    height: clamp(250px, 35vw, 380px);
}

.hero-slides {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100%;
    overflow: hidden;
    isolation: isolate;
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transform: scale(1.015);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    overflow: hidden;
}

.hero-slide.active {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

.hero-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-slide.active img {
    animation: kenBurns 10s ease-out forwards;
}

@keyframes kenBurns {
    from {
        transform: scale(1.0);
    }

    to {
        transform: scale(1.12);
    }
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(2, 6, 23, 0.88) 0%, rgba(2, 6, 23, 0.28) 55%, transparent 100%);
    display: flex;
    align-items: flex-end;
    padding: clamp(1.5rem, 3vw, 3rem);
}

.hero-copy {
    transform: translateY(24px);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    transition-delay: 0.25s;
}

.hero-slide.active .hero-copy {
    transform: translateY(0);
    opacity: 1;
}

.hero-copy h2 {
    color: #fff;
    font-size: clamp(1.4rem, 4vw, 2.5rem);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.hero-copy p {
    color: rgba(255, 255, 255, 0.82);
    font-size: clamp(0.88rem, 1.8vw, 1.1rem);
    font-weight: 500;
}

.hero-control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 46px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 700;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    direction: ltr;
    unicode-bidi: isolate;
}

.hero-control.prev {
    left: 1.25rem;
}

.hero-control.next {
    right: 1.25rem;
}

.hero-control:hover {
    background: var(--accent);
    color: var(--primary);
    border-color: var(--accent);
    transform: translateY(-50%) scale(1.1);
}

[dir="rtl"] .hero-control.prev {
    left: 1.25rem;
    right: auto;
}

[dir="rtl"] .hero-control.next {
    right: 1.25rem;
    left: auto;
}

.hero-dots {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.hero-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.hero-dot.active {
    background: var(--accent);
    width: 28px;
}

.hero-fallback {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 16px;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 60%);
}

.hero-fallback h2 {
    font-size: 1.1rem;
    margin-bottom: 0;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 2rem 0 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--border-light);
}

.section-head h3 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-head h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: var(--accent);
    border-radius: 99px;
}

.section-head span {
    background: var(--amber-light);
    color: var(--accent-hover);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.category-card {
    display: block;
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.category-image-wrap {
    width: 100%;
    overflow: hidden;
}

.category-image {
    width: 100%;
    height: 100%;
    background: #f1f5f9;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.category-card:hover .category-image {
    transform: scale(1.08);
}

.category-image.mosaic {
    display: grid;
    gap: 2px;
    background: #fff;
}
.category-image.mosaic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}
.category-card:hover .category-image.mosaic img {
    transform: scale(1.08);
}
.mosaic-2 { grid-template-columns: 1fr 1fr; }
.mosaic-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mosaic-3 img:first-child { grid-row: 1 / -1; }
.mosaic-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.category-body {
    padding: 1rem 1.1rem;
}

.category-name {
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--primary);
}

.category-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.collections-wrap {
    margin-top: 3rem;
}

.collection-block {
    background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.collection-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.collection-head h4 {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--primary);
}

.collection-head p {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.product-card {
    display: block;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow-sm);
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}

.product-image-wrap {
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #f1f5f9;
    transition: transform 0.5s ease;
}

.product-card:hover .product-image {
    transform: scale(1.07);
}

.product-body {
    padding: 1rem 1rem 1.1rem;
}

.product-name {
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.35;
    min-height: 2.35em;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.product-price {
    font-size: 0.85rem;
    color: var(--accent-hover);
    font-weight: 800;
}

.product-unit {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
    background: var(--border-light);
    border-radius: 999px;
    padding: 2px 8px;
}

.state {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
    background: #fafcff;
}

@media (max-width: 640px) {
    .hero-slider {
        height: clamp(220px, 56vw, 300px);
        border-radius: 20px;
    }

    .categories-grid,
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .category-body,
    .product-body {
        padding: 0.8rem;
    }

    .category-name,
    .product-name {
        font-size: 0.82rem;
    }

    .category-meta,
    .product-unit {
        font-size: 0.68rem;
    }

    .hero-control {
        width: 38px;
        height: 38px;
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        font-size: 0.95rem;
    }

    .hero-control.prev {
        left: 0.85rem;
    }

    .hero-control.next {
        right: 0.85rem;
    }

    .hero-control:hover {
        transform: translateY(-50%);
    }
}

/* =========================================================================
   Category & Product Shared Styles
   ========================================================================= */
.crumb {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    font-size: 0.82rem;
    margin-bottom: 12px;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.crumb a {
    text-decoration: none;
    color: var(--accent-hover);
    font-weight: 700;
}

/* =========================================================================
   Category (category.php) Styles
   ========================================================================= */
.category-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    border-radius: 22px;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    margin-bottom: 2rem;
    color: white;
}

.category-hero h2 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
}

.category-hero p {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    font-weight: 500;
}

/* =========================================================================
   Product (product.php) Styles
   ========================================================================= */
.product-hero {
    background: linear-gradient(135deg, var(--surface) 0%, #f8fbff 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    margin-bottom: 16px;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 14px;
}

.hero-info h2 {
    font-size: 1.12rem;
    margin-bottom: 4px;
}

.hero-info p {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.hero-meta {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.meta-chip {
    background: #eef2f7;
    color: var(--text-muted);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 0.76rem;
    font-weight: 700;
}

.gallery-wrap {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.main-image {
    width: 100%;
    object-fit: cover;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f3f6fb;
}

.thumbs {
    display: flex;
    gap: 6px;
    overflow: auto;
}

.thumb {
    width: 66px;
    height: 52px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    background: #f3f6fb;
}

.thumb.active {
    border-color: var(--primary);
}

.content-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 12px;
}

.product-table-wrap {
    overflow-x: auto;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.product-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    min-width: 650px;
}

.product-table-wrap th {
    text-align: left;
    padding: 10px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: #fafbfc;
}

.product-table-wrap td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.product-table-wrap tr:last-child td {
    border-bottom: none;
}

.availability {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
}

.availability::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.availability.available {
    color: var(--success);
}

.availability.available::before {
    background: var(--success);
}

.availability.not_available {
    color: var(--danger);
}

.availability.not_available::before {
    background: var(--danger);
}

.availability.made_to_order {
    color: var(--warning);
}

.availability.made_to_order::before {
    background: var(--warning);
}

.qty-input {
    width: 62px;
    border: 1.5px solid var(--border);
    border-radius: 0;
    padding: 6px 8px;
    font-size: 0.82rem;
    outline: none;
    text-align: center;
}

.qty-input:focus {
    border-color: var(--primary);
}

.qty-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: white;
}

.qty-stepper .qty-input {
    border: 0;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

.qty-btn {
    width: 34px;
    border: 0;
    background: var(--border-light);
    color: var(--primary);
    font-weight: 900;
    cursor: pointer;
    font-size: 1rem;
}

.qty-btn:active {
    background: var(--amber-light);
}

.order-info {
    font-size: 0.83rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.order-form-group {
    margin-bottom: 10px;
}

.order-form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 700;
}

.order-form-group input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.84rem;
    outline: none;
}

.order-form-group input:focus {
    border-color: var(--primary);
}

.summary {
    margin-top: 10px;
    background: #f8fbff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px;
    font-size: 0.84rem;
}

.msg {
    margin-top: 10px;
    border-radius: 9px;
    padding: 8px 10px;
    font-size: 0.83rem;
    font-weight: 700;
    display: none;
}

.msg.ok {
    display: block;
    background: #dcfce7;
    color: #166534;
}

.msg.err {
    display: block;
    background: #fee2e2;
    color: #991b1b;
}

@media (max-width: 760px) {
    .content-grid {
        grid-template-columns: 1fr;
    }

    .product-hero {
        grid-template-columns: 1fr;
    }
}