@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&display=swap');

:root {
    --bg-color: color-mix(in srgb, var(--primary-color) 10%, #0d1117);
    --surface-color: color-mix(in srgb, var(--primary-color) 15%, #161b22);
    --primary-color: #58a6ff;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --glass-bg: rgba(22, 27, 34, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-gradient: linear-gradient(135deg, var(--primary-color), color-mix(in srgb, var(--primary-color) 50%, #8a2be2));
}

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

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

html, body {
    height: 100%;
    overflow-x: hidden;
    width: 100vw;
}

body, body.dx-viewport {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color) !important;
    color: var(--text-primary) !important;
    line-height: 1.6;
}

/* Glassmorphism Navigation */
.glass-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 800;
    font-size: 1.5rem !important;
    white-space: nowrap;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    padding: 0;
}

/* Buttons */
.btn-outline, .btn-primary, .btn-secondary {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.4);
}

.btn-primary {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(138, 43, 226, 0.4);
}

.btn-secondary {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--glass-border);
}

.btn-danger {
    background: transparent;
    border: 1px solid #ff5858;
    color: #ff5858;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.3s;
}
.btn-danger:hover {
    background: #ff5858;
    color: #fff;
}

/* Hero Section */
.hero {
    padding: 6rem 2rem;
    text-align: center;
    background: radial-gradient(circle at top, color-mix(in srgb, var(--primary-color) 15%, transparent) 0%, transparent 60%);
}

.hero h2 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* Store Layout */
.store-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.filters-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    padding: 1.5rem;
}

.mobile-only {
    display: none;
}

.filters-sidebar h3 {
    margin-bottom: 1.5rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.filter-group select, .filter-group input {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    transition: border-color 0.3s;
}

.filter-group select:focus, .filter-group input:focus {
    border-color: var(--primary-color);
}

.filter-group select option {
    background: var(--surface-color);
    color: var(--text-primary);
}

.w-100 {
    width: 100%;
}

.load-more-container {
    text-align: center;
    margin-top: 3rem;
}

.loading-indicator {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Products Section */
.store-container .products-section {
    flex-grow: 1;
    padding: 0;
    margin: 0;
    max-width: none;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    border-left: 4px solid var(--primary-color);
    padding-left: 1rem;
}

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

.product-card {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border-color: var(--primary-color);
}

.product-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
    background: #21262d;
}

.product-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.product-category {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-top: auto;
}

/* Admin Dashboard */
.admin-main {
    max-width: 95%;
    margin: 3rem auto;
    padding: 0 2rem;
}

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 2rem;
}

.login-panel {
    max-width: 400px;
    margin: 0 auto;
    text-align: center;
}

.login-panel h2 {
    margin-bottom: 1.5rem;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--glass-border);
    background: var(--surface-color);
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-msg {
    color: #ff5858;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s;
    font-family: inherit;
}

.tab.active {
    color: var(--primary-color);
    position: relative;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--glass-bg);
    border-radius: 12px;
    overflow: hidden;
}

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

.glass-table th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-secondary);
}

.glass-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    margin-top: 4rem;
    border-top: 1px solid var(--glass-border);
}

/* Product Details Page */
.product-details-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    align-items: flex-start;
}

.product-gallery {
    flex: 1 1 450px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    border-radius: 20px;
    background: transparent;
    border: none;
    box-shadow: none;
}

.main-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    background: transparent;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.main-image:hover {
    transform: scale(1.02);
}

.thumbnail-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
}

.thumbnail-container img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
}

.thumbnail-img:hover, .thumbnail-img.active {
    transform: translateY(-2px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(88, 166, 255, 0.3);
}

.product-info {
    flex: 1 1 400px;
    padding: 2.5rem;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.product-title-large {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1.2;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.product-price-large {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
}

.product-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-secondary);
}

.product-meta {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: color-mix(in srgb, var(--text-primary) 3%, transparent);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--text-primary) 10%, transparent);
}

.product-meta p {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-size: 1rem;
    margin-bottom: 0;
}

.product-meta strong {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
}

.product-meta span {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
}

/* Scroll to Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--accent-gradient);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: transform 0.3s;
}

.scroll-top-btn:hover {
    transform: translateY(-5px);
}

.scroll-top-btn svg {
    width: 24px;
    height: 24px;
    margin-top: 4px;
}

/* Light Mode Theme */
body.light-mode {
    --bg-color: color-mix(in srgb, var(--primary-color) 10%, #f6f8fa);
    --surface-color: color-mix(in srgb, var(--primary-color) 15%, #ffffff);
    --text-primary: #24292e;
    --text-secondary: #586069;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(0, 0, 0, 0.1);
}

/* Light mode: fix KPI values to dark text instead of white */
body.light-mode .kpi-value {
    color: var(--text-primary);
}

/* Light mode: offer product name */
body.light-mode .offer-product-name {
    color: var(--text-primary);
}

/* Light mode: admin nav */
body.light-mode .admin-nav {
    background: rgba(255, 255, 255, 0.9) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* Light mode: DevExtreme DataGrid */
body.light-mode .dx-datagrid,
body.light-mode .dx-datagrid-header-panel,
body.light-mode .dx-datagrid-content {
    background-color: var(--surface-color) !important;
    color: var(--text-primary) !important;
    border-color: var(--glass-border) !important;
}

body.light-mode .dx-row > td,
body.light-mode .dx-data-row > td,
body.light-mode .dx-header-row > td {
    background-color: var(--surface-color) !important;
    color: var(--text-primary) !important;
    border-bottom-color: var(--glass-border) !important;
}

body.light-mode .dx-row.dx-column-lines > td {
    border-right-color: var(--glass-border) !important;
}

body.light-mode .dx-header-row > td {
    background-color: color-mix(in srgb, var(--primary-color) 10%, #f0f2f5) !important;
    font-weight: 700;
}

body.light-mode .dx-datagrid-rowsview .dx-row-alt > td,
body.light-mode .dx-datagrid-rowsview .dx-row-alt > tr > td {
    background-color: rgba(0, 0, 0, 0.025) !important;
}

body.light-mode .dx-datagrid-rowsview .dx-selection > td,
body.light-mode .dx-datagrid-rowsview .dx-selection > tr > td {
    background-color: color-mix(in srgb, var(--primary-color) 15%, transparent) !important;
    color: var(--text-primary) !important;
}

body.light-mode .dx-searchbox input,
body.light-mode .dx-texteditor-input,
body.light-mode .dx-texteditor {
    background-color: #ffffff !important;
    color: var(--text-primary) !important;
    border-color: var(--glass-border) !important;
}

body.light-mode .dx-button-normal {
    background-color: #ffffff !important;
    color: var(--text-primary) !important;
    border-color: var(--glass-border) !important;
}

body.light-mode .dx-button-success {
    background-color: var(--primary-color) !important;
    color: #ffffff !important;
}

body.light-mode .dx-toolbar {
    background-color: var(--surface-color) !important;
    border-color: var(--glass-border) !important;
}

body.light-mode .dx-popup-wrapper .dx-popup-content,
body.light-mode .dx-popup-wrapper .dx-popup-title {
    background-color: var(--surface-color) !important;
    color: var(--text-primary) !important;
}

body.light-mode .dx-form-group-caption,
body.light-mode .dx-field-item-label-text {
    color: var(--text-secondary) !important;
}

body.light-mode .dx-tabpanel .dx-tab,
body.light-mode .dx-tabs .dx-tab {
    background-color: #f0f2f5 !important;
    color: var(--text-secondary) !important;
}

body.light-mode .dx-tabpanel .dx-tab.dx-tab-selected,
body.light-mode .dx-tabs .dx-tab.dx-tab-selected {
    background-color: var(--primary-color) !important;
    color: #ffffff !important;
}

body.light-mode .dx-scrollview-content,
body.light-mode .dx-scrollable-content {
    background-color: var(--surface-color) !important;
}

body.light-mode .dx-selectbox-popup-wrapper .dx-list-item,
body.light-mode .dx-dropdownlist-popup-wrapper .dx-list-item {
    color: var(--text-primary) !important;
    background-color: #ffffff !important;
}

body.light-mode .dx-list-item.dx-state-hover,
body.light-mode .dx-list-item.dx-state-focused {
    background-color: color-mix(in srgb, var(--primary-color) 10%, transparent) !important;
}

/* Light mode: glass panels */
body.light-mode .glass-panel {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

/* Light mode: chart panels */
body.light-mode .chart-panel {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

/* Light mode: KPI cards */
body.light-mode .kpi-card {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
}

/* Light mode: action button */
body.light-mode .action-btn {
    background: rgba(255, 255, 255, 0.9) !important;
    border-color: rgba(0, 0, 0, 0.1) !important;
    color: var(--text-primary) !important;
}

body.light-mode .action-btn:hover {
    background: color-mix(in srgb, var(--primary-color) 8%, #fff) !important;
}

/* Light mode: tabs */
body.light-mode .tab {
    color: var(--text-secondary);
}

body.light-mode .tab.active,
body.light-mode .tab:hover {
    color: var(--primary-color);
}

/* Light mode: offers table */
body.light-mode .offers-list-container {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.08) !important;
}

body.light-mode .offers-table td {
    color: var(--text-primary) !important;
    border-bottom-color: rgba(0, 0, 0, 0.06) !important;
}

body.light-mode .offers-table tr:hover td {
    background: rgba(0, 0, 0, 0.02) !important;
}

/* Light mode: scrollbar */
body.light-mode ::-webkit-scrollbar-track {
    background: #f0f2f5;
}

body.light-mode ::-webkit-scrollbar-thumb {
    background: #c5c9d0;
}

/* Light mode: DevExtreme chart backgrounds */
body.light-mode .dxc-chart,
body.light-mode .dxc-pie-chart {
    background-color: transparent !important;
}



/* Prevent grid scroll from bubbling up */
.dx-scrollable-container {
    overscroll-behavior: contain !important;
}
.dx-datagrid {
    overscroll-behavior: contain !important;
}

.color-chip {
    padding: 0.6rem 1.2rem;
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: all 0.2s ease;
    font-family: inherit;
}

.color-chip:hover {
    border-color: var(--text-secondary);
}

.color-chip.active {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 15%, transparent);
    color: var(--text-primary);
    box-shadow: 0 0 10px color-mix(in srgb, var(--primary-color) 20%, transparent);
}

/* Quick View Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content.quick-view-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    background: var(--surface-color);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease forwards;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
}

.modal-close:hover {
    color: var(--text-primary);
}

.quick-view-layout {
    display: flex;
    gap: 2rem;
}

.qv-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    overflow: hidden;
}

.qv-image-container img {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
}

.qv-details-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (max-width: 768px) {
    .quick-view-layout {
        flex-direction: column;
    }
    .qv-image-container img {
        max-height: 300px;
    }
}

.analytics-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 20px;
    margin-top: 20px;
    width: 100%;
}

.chart-panel {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    min-width: 0; /* Prevents flex/grid blowouts */
    width: 100%;
}

/* For responsive bottom row (Sales by Region & Payment Methods) */
.analytics-dashboard-grid .bottom-row {
    grid-column: 1 / -1; /* Spans all 3 columns */
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
}

@media (max-width: 1100px) {
    .analytics-dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .analytics-dashboard-grid .bottom-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .analytics-dashboard-grid {
        grid-template-columns: 1fr;
    }
    .analytics-dashboard-grid .bottom-row {
        grid-template-columns: 1fr;
    }
}

/* Homepage Quick Actions */
.quick-actions-section {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.quick-actions-section h4,
.kpi-section h4,
.offers-section h4 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 1.2rem;
    font-weight: 600;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1.8rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.3s ease;
}

.action-btn i {
    font-size: 2rem;
    color: var(--primary-color);
}

.action-btn:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: 0 8px 20px rgba(88, 166, 255, 0.2);
    background: color-mix(in srgb, var(--primary-color) 8%, var(--glass-bg));
}

/* KPI Summary Cards */
.kpi-section {
    margin-bottom: 2rem;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.kpi-card {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 120px;
    transition: all 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.15);
}

.kpi-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    margin-top: 0.5rem;
}

.kpi-value.kpi-text {
    font-size: 1.3rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

/* Offers Summary List */
.offers-section {
    margin-bottom: 2rem;
}

.offers-list-container {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    overflow-x: auto;
}

.offers-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 600px;
}

.offers-table th {
    color: var(--text-secondary);
    font-weight: 600;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
}

.offers-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.95rem;
    vertical-align: middle;
}

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

.offers-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.offer-product-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.offer-product-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    background: #2a2a2a;
    border: 1px solid var(--glass-border);
}

.offer-product-no-img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: #2a2a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.offer-product-info {
    display: flex;
    flex-direction: column;
}

.offer-product-name {
    font-weight: bold;
    color: #fff;
}

.offer-product-no {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.offer-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.offer-badge.active {
    background: rgba(76, 175, 80, 0.15);
    color: #4CAF50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.offer-badge.expired {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

.offer-link-btn {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s;
}

.offer-link-btn:hover {
    color: #fff;
}

.no-offers {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-style: italic;
}

/* ==========================================================================
   Mobile Responsive Layout Fixes (Screens under 768px)
   ========================================================================== */

/* Table Responsiveness Wrapper */
.table-responsive {
    width: 100%;
    margin-top: 1rem;
    background: transparent;
    border-radius: 8px;
}

/* Fix DevExtreme Mobile Scrolling Conflict */
.dx-datagrid, .dx-datagrid-scroll-container, .dx-scrollable-wrapper, .dx-scrollable-container {
    touch-action: pan-x pan-y !important;
}

@media (max-width: 768px) {
    /* Global Navigation & Header adjustments */
    .nav-container {
        padding: 0.75rem 1rem !important;
        flex-direction: row;
        justify-content: space-between;
    }
    
    .logo {
        font-size: 1.25rem !important;
    }
    
    .btn-outline, .btn-primary, .btn-secondary {
        padding: 0.4rem 0.8rem !important;
        font-size: 0.85rem !important;
        white-space: nowrap !important;
    }
    
    .nav-container nav {
        display: flex;
        gap: 8px;
        align-items: center;
    }

    /* Storefront Grid Layout: Stacks filters on top, products full-width below */
    .store-container {
        flex-direction: column !important;
        padding: 1rem !important;
        gap: 1.5rem !important;
    }
    
    .section-header-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.5rem;
    }
    
    .mobile-only {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
    }

    .desktop-only {
        display: none !important;
    }

    .filters-sidebar {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: -100% !important; /* LTR default */
        width: 300px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        z-index: 2000 !important;
        overflow-y: auto !important;
        margin: 0 !important;
        padding: 1.5rem !important;
        border-radius: 0 !important;
        transition: left 0.3s ease, right 0.3s ease !important;
        background: var(--surface-color) !important;
        box-shadow: 5px 0 25px rgba(0,0,0,0.5) !important;
    }
    
    .filters-sidebar.active-mobile {
        left: 0 !important;
    }
    
    [dir="rtl"] .filters-sidebar {
        left: auto !important;
        right: -100% !important;
        box-shadow: -5px 0 25px rgba(0,0,0,0.5) !important;
    }
    
    [dir="rtl"] .filters-sidebar.active-mobile {
        right: 0 !important;
        left: auto !important;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 1999;
        display: none;
        backdrop-filter: blur(2px);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .store-container .products-section {
        width: 100% !important;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)) !important;
        gap: 1.25rem !important;
    }

    /* Product Details Page stack */
    .product-details-container {
        gap: 2rem !important;
        padding: 0 1rem !important;
        margin: 1rem auto !important;
        overflow-x: hidden !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .product-gallery {
        padding: 0 !important;
        border-radius: 12px !important;
        flex: 1 1 100% !important;
        max-width: 100% !important;
    }

    .product-info {
        padding: 1.5rem !important;
        flex: 1 1 100% !important;
        border-radius: 20px !important;
        max-width: 100% !important;
    }
    
    .product-title-large {
        font-size: 1.8rem !important;
    }
    
    .main-image {
        aspect-ratio: 1 / 1 !important;
        border-radius: 16px !important;
        max-height: none !important;
    }

    /* Admin Portal Navigation wrapper */
    .admin-nav .nav-container {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.75rem !important;
        padding: 0.75rem 1rem !important;
    }
    
    .admin-nav nav {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
        width: 100% !important;
    }

    /* Admin Tab Layout: Horizontal sleek swiping instead of wrapping/overlapping */
    .tabs {
        display: flex !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        gap: 1.25rem !important;
        padding-bottom: 0.75rem !important;
        border-bottom: 1px solid var(--glass-border) !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important; /* Hide Firefox scrollbar */
        -ms-overflow-style: none !important;  /* Hide IE scrollbar */
    }
    
    .tabs::-webkit-scrollbar {
        display: none !important; /* Hide Chrome/Safari/Webkit scrollbar */
    }
    
    .tab {
        flex: 0 0 auto !important;
        font-size: 0.95rem !important;
        padding-bottom: 0.25rem !important;
    }
    
    .tab.active::after {
        bottom: -0.75rem !important;
    }

    /* Admin Dashboard Panel spaces */
    .admin-main {
        max-width: 100% !important;
        margin: 1rem auto !important;
        padding: 0 0.75rem !important;
    }
    
    .glass-panel {
        padding: 1.25rem !important;
        border-radius: 12px !important;
    }
    
    .action-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 0.75rem !important;
        margin-bottom: 1.25rem !important;
    }
    
    .action-bar button, .action-bar .btn-secondary {
        width: 100% !important;
        text-align: center !important;
    }

    /* Dashboard Home quick actions */
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    .action-btn {
        padding: 1.25rem !important;
        gap: 0.5rem !important;
        font-size: 0.85rem !important;
    }
    
    .action-btn i {
        font-size: 1.5rem !important;
    }

    /* KPI Summary Cards */
    .kpi-card {
        padding: 1rem !important;
        min-height: 100px !important;
    }
    
    .kpi-value {
        font-size: 1.45rem !important;
    }
    
    .kpi-value.kpi-text {
        font-size: 1.05rem !important;
    }
    
    /* Social post generator column stacking */
    #social-tab .glass-panel div[style*="display: flex; gap: 20px"] {
        flex-direction: column !important;
        gap: 15px !important;
    }
    #social-tab .glass-panel div[style*="flex: 0 0 150px"] {
        flex: 1 1 auto !important;
        max-width: 150px !important;
        margin: 0 auto !important;
    }
}

/* ==========================================================================
   RTL Layout Alignments
   ========================================================================== */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .section-title {
    border-right: 4px solid var(--primary-color) !important;
    padding-right: 1rem !important;
    border-left: none !important;
    padding-left: 0 !important;
}

[dir="rtl"] .product-price,
[dir="rtl"] .product-price-large {
    text-align: left !important;
}

[dir="rtl"] .kpi-card {
    text-align: right;
}

[dir="rtl"] .offers-table th,
[dir="rtl"] .offers-table td,
[dir="rtl"] .glass-table th,
[dir="rtl"] .glass-table td {
    text-align: right !important;
}

[dir="rtl"] .preview-btn {
    margin-right: 0 !important;
    margin-left: auto !important;
}

[dir="rtl"] .modal-close {
    right: auto !important;
    left: 1.5rem !important;
}
