/* ===== CSS Variables ===== */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --danger-color: #dc2626;
    --danger-hover: #b91c1c;
    --success-color: #16a34a;
    
    --bg-color: #f8fafc;
    --sidebar-bg: #1e293b;
    --sidebar-text: #e2e8f0;
    --card-bg: #ffffff;
    
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --sidebar-width: 250px;
}

/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari fix */
}

/* ===== Dashboard Layout ===== */
.dashboard-container {
    display: flex;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari fix */
    overflow-x: hidden;
    width: 100%;
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height - works better on mobile */
    left: 0;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.logo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.logo-subtitle {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: var(--sidebar-text);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.nav-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .nav-icon svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
  }

.sidebar-footer {
    padding: 20px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #f87171;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    width: 100%;
}

.logout-btn:hover {
    background-color: rgba(248, 113, 113, 0.1);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 32px;
    min-height: 100vh;
    min-height: 100dvh;
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    overflow-x: hidden;
}

/* ===== Filter Styles ===== */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.filter-container {
    display: flex;
    gap: 8px;
}

.filter-select {
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: white;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 160px;
    transition: border-color 0.2s ease;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-select:disabled {
    background-color: #f1f5f9;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Today's Special Filter Button */
.btn-special-filter {
    padding: 10px 14px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid #fef08a;
    border-radius: var(--radius-md);
    background-color: #fffbeb;
    color: #854d0e;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-special-filter:hover {
    background-color: #fef3c7;
    border-color: #fde047;
}

.btn-special-filter.active {
    background-color: #fef08a;
    border-color: #eab308;
    color: #713f12;
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.2);
}

/* ===== Pages ===== */
.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: #cbd5e1;
}

.btn-edit {
    background-color: #f0f9ff;
    color: var(--primary-color);
    padding: 8px 16px;
}

.btn-edit:hover {
    background-color: #e0f2fe;
}

.btn-delete {
    background-color: #fef2f2;
    color: var(--danger-color);
    padding: 8px 16px;
}

.btn-delete:hover {
    background-color: #fee2e2;
}

/* ===== Products List ===== */
.products-list {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.product-item {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.product-item:last-child {
    border-bottom: none;
}

.product-item:hover {
    background-color: #f8fafc;
}

.product-info {
    flex: 1;
    min-width: 0;
}

.product-names {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.product-name-en {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.product-name-ar {
    font-size: 14px;
    color: var(--text-secondary);
    direction: rtl;
}

.product-category {
    font-size: 12px;
    color: var(--text-secondary);
    background-color: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
}

.product-price {
    font-weight: 600;
    font-size: 16px;
    color: var(--success-color);
    margin: 0 32px;
    min-width: 80px;
    text-align: right;
}

.product-actions {
    display: flex;
    gap: 8px;
}

/* ===== Empty State ===== */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 4px;
}

.empty-subtitle {
    font-size: 14px !important;
    color: #94a3b8 !important;
}

/* ===== Links Form ===== */
.links-form {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    padding: 32px;
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 18px;
  }
  .link-icon svg {
    width: 18px;
    height: 18px;
  }

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: white;
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #94a3b8;
}

.btn-save-links {
    margin-top: 12px;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-form {
    padding: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ===== Image Upload ===== */
.full-width {
    grid-column: 1 / -1;
}

.image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.image-upload-container input[type="file"] {
    padding: 12px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    background-color: #f8fafc;
}

.image-upload-container input[type="file"]:hover {
    border-color: var(--primary-color);
    background-color: #f0f9ff;
}

.image-preview {
    width: 100%;
    max-width: 200px;
    height: 150px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
}

.image-preview-box {
    width: 120px;
    height: 120px;
    border: 1px solid #333;
    border-radius: 10px;
    overflow: hidden;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-placeholder {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== Product Thumbnail in List ===== */
.product-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    margin-right: 16px;
}

.product-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-thumbnail-placeholder {
    width: 100%;
    height: 100%;
    background-color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.section-divider {
    margin: 24px 0;
    border: 0;
    border-top: 1px solid var(--border-color);
  }

  /* ===== Carousel image cards (Restaurant tab) ===== */
.carousel-image-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    flex-shrink: 0;
    padding: 0;
    border: none;
    cursor: grab;
    background: transparent;
  }
  
  .carousel-image-card:hover {
    background: transparent;
  }

  /* ===== QR code ===== */
  .qr-wrapper {
    width: 180px;
    height: 180px;
    min-width: 180px;
    min-height: 180px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  
  .qr-wrapper canvas,
  .qr-wrapper img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
  }


  /* ===== Warning Badge ==== */
  .product-warning-badge {
    display: inline-block;
    font-size: 11px;
    color: #b45309;
    background: #fef3c7;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
    margin-inline-start: 0;
  }

  .product-warning-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    margin-top: 4px;
    font-size: 16px;
    color: #b45309;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }
  
  .product-warning-btn:hover {
    background: #fde68a;
    color: #92400e;
  }

/* ===== COMPLETE RESPONSIVE REWRITE ===== */

/* Base Product Item - Desktop */
.product-item {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
    gap: 16px;
}

.product-item:last-child {
    border-bottom: none;
}

.product-item:hover {
    background-color: #f8fafc;
}

.product-image {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
}

.product-info {
    flex: 1;
    min-width: 0; /* Critical for text truncation */
    overflow: hidden;
}

.product-names {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.product-name-en {
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
    word-break: break-word;
}

.product-name-ar {
    font-size: 14px;
    color: var(--text-secondary);
    direction: rtl;
    word-break: break-word;
}

.product-special-badge {
    background-color: #fef08a;
    color: #854d0e;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.product-category {
    font-size: 12px;
    color: var(--text-secondary);
    background-color: #f1f5f9;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 100px;
    flex-shrink: 0;
}

.product-price-old {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.product-price-special {
    font-weight: 600;
    font-size: 16px;
    color: #ca8a04;
    white-space: nowrap;
}

.product-price-regular {
    font-weight: 600;
    font-size: 16px;
    color: var(--success-color);
    white-space: nowrap;
}

.product-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* ===== iPad Air & Large Tablets (820px - 1024px) ===== */
@media (max-width: 1024px) {
    :root {
        --sidebar-width: 200px;
    }
    
    .main-content {
        padding: 24px 20px;
    }
    
    .product-price-container {
        min-width: 90px;
    }

    .filter-select {
        min-width: 140px;
    }
}

/* ===== Tablets & iPad Mini (768px - 820px) ===== */
@media (max-width: 820px) {
    :root {
        --sidebar-width: 70px;
    }
    
    /* Sidebar Collapse */
    .sidebar-header {
        padding: 16px 8px;
        text-align: center;
    }

        /* Filter */
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .filter-container {
        flex-wrap: wrap;
        width: 100%;
    }

    .filter-select {
        flex: 1;
        min-width: 120px;
    }

    .btn-special-filter {
        flex: 1;
        min-width: 120px;
        justify-content: center;
    }
    
    .logo {
        font-size: 18px;
        margin-bottom: 0;
    }
    
    .logo-subtitle {
        display: none;
    }
    
    .sidebar-nav {
        padding: 16px 8px;
    }
    
    .nav-btn {
        justify-content: center;
        padding: 12px 8px;
        gap: 0;
    }
    
    .nav-text {
        display: none;
    }
    
    .nav-icon {
        font-size: 20px;
    }
    
    .sidebar-footer {
        padding: 16px 8px;
    }
    
    .logout-btn {
        justify-content: center;
        padding: 12px 8px;
    }
    
    .logout-btn span:last-child {
        display: none;
    }
    
    /* Main Content */
    .main-content {
        padding: 20px 16px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .page-title {
        font-size: 24px;
    }
    
    /* Product Items */
    .product-item {
        padding: 14px 16px;
        gap: 12px;
    }
    
    .product-image {
        width: 55px;
        height: 55px;
    }
    
    .product-names {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }
    
    .product-name-en {
        font-size: 14px;
    }
    
    .product-name-ar {
        font-size: 13px;
    }
    
    .product-special-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .product-price-container {
        min-width: 85px;
    }
    
    .product-price-old {
        font-size: 12px;
    }
    
    .product-price-special,
    .product-price-regular {
        font-size: 15px;
    }
    
    /* Modal */
    .modal {
        max-width: 95%;
        margin: 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Links Form */
    .links-form {
        padding: 24px;
        max-width: 100%;
    }
    
    /* Checkbox */
    .checkbox-label {
        padding: 10px 14px;
        font-size: 14px;
    }
}

/* ===== Large Phones (430px - 768px) - iPhone 14 Pro Max, Plus models ===== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 60px;
    }
    
    .logo {
        font-size: 14px;
    }

        /* Filter */
    .filter-container {
        gap: 6px;
    }

    .filter-select {
        padding: 8px 10px;
        font-size: 13px;
        min-width: 0;
        flex: 1 1 calc(50% - 3px);
    }

    .btn-special-filter {
        padding: 8px 10px;
        font-size: 13px;
        flex: 1 1 100%;
    }
    
    .nav-icon {
        font-size: 18px;
    }
    
    .main-content {
        padding: 16px 12px;
    }
    
    .page-title {
        font-size: 22px;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    /* Product Items - Wrap Layout */
    .product-item {
        flex-wrap: wrap;
        padding: 12px;
        gap: 10px;
    }
    
    .product-image {
        width: 50px;
        height: 50px;
    }
    
    .product-info {
        flex: 1;
        min-width: 0;
        max-width: calc(100% - 60px - 90px); /* Total - image - price */
    }
    
    .product-names {
        display: block;
    }
    
    .product-name-en {
        font-size: 14px;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }
    
    .product-name-ar {
        font-size: 12px;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
        margin-top: 2px;
    }
    
    .product-special-badge {
        font-size: 9px;
        padding: 2px 5px;
        display: inline-block;
        margin-top: 4px;
    }
    
    .product-category {
        font-size: 11px;
        margin-top: 4px;
    }
    
    .product-price-container {
        min-width: 80px;
    }
    
    .product-price-old {
        font-size: 11px;
    }
    
    .product-price-special,
    .product-price-regular {
        font-size: 14px;
    }
    
    .product-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
    }
    
    .btn-edit,
    .btn-delete {
        padding: 8px 14px;
        font-size: 12px;
    }
    
    /* Modal - Full Screen */
    .modal {
        max-width: 100%;
        max-height: 100vh;
        max-height: 100dvh;
        margin: 0;
        border-radius: 0;
    }
    
    .modal-header {
        padding: 16px;
        position: sticky;
        top: 0;
        background: var(--card-bg);
        z-index: 10;
    }
    
    .modal-title {
        font-size: 18px;
    }
    
    .modal-form {
        padding: 16px;
    }
    
    .form-group label {
        font-size: 13px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 10px;
        position: sticky;
        bottom: 0;
        background: var(--card-bg);
        padding: 16px;
        margin: 16px -16px -16px;
        border-top: 1px solid var(--border-color);
    }
    
    .modal-actions .btn {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }
    
    /* Image Upload */
    .image-preview {
        max-width: 120px;
        height: 100px;
    }
    
    /* Checkbox */
    .checkbox-label {
        padding: 12px;
        font-size: 14px;
    }
    
    /* Links Form */
    .links-form {
        padding: 16px;
    }
    
    /* Empty State */
    .empty-state {
        padding: 40px 16px;
    }
    
    .empty-icon {
        font-size: 40px;
    }
}

/* ===== Medium Phones (393px - 430px) - iPhone 14, 13, 12 ===== */
@media (max-width: 430px) {
    :root {
        --sidebar-width: 55px;
    }
    
    .logo {
        font-size: 12px;
    }

        /* Filter */
    .header-actions {
        gap: 10px;
    }

    .filter-container {
        gap: 6px;
    }

    .filter-select {
        padding: 8px;
        font-size: 12px;
        flex: 1 1 calc(50% - 3px);
    }

    .btn-special-filter {
        padding: 8px;
        font-size: 11px;
    }
    
    .nav-btn {
        padding: 10px 6px;
    }
    
    .nav-icon {
        font-size: 17px;
    }
    
    .main-content {
        padding: 14px 10px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .btn {
        padding: 9px 14px;
        font-size: 12px;
    }
    
    /* Product Items */
    .product-item {
        padding: 10px;
        gap: 8px;
    }
    
    .product-image {
        width: 45px;
        height: 45px;
    }
    
    .product-thumbnail-placeholder {
        font-size: 20px;
    }
    
    .product-info {
        max-width: calc(100% - 55px - 75px);
    }
    
    .product-name-en {
        font-size: 13px;
    }
    
    .product-name-ar {
        font-size: 11px;
    }
    
    .product-special-badge {
        font-size: 8px;
        padding: 1px 4px;
    }
    
    .product-category {
        font-size: 10px;
        padding: 2px 5px;
    }
    
    .product-price-container {
        min-width: 70px;
    }
    
    .product-price-old {
        font-size: 10px;
    }
    
    .product-price-special,
    .product-price-regular {
        font-size: 13px;
    }
    
    .btn-edit,
    .btn-delete {
        padding: 7px 10px;
        font-size: 11px;
    }
    
    /* Checkbox */
    .checkbox-label {
        padding: 10px;
        font-size: 13px;
        gap: 8px;
    }
    
    .checkbox-custom {
        width: 18px;
        height: 18px;
    }
}

/* ===== Small Phones (375px - 393px) - iPhone SE, X, 11 Pro ===== */
@media (max-width: 393px) {
    :root {
        --sidebar-width: 50px;
    }
    
    .sidebar-header {
        padding: 10px 4px;
    }
    
    .logo {
        font-size: 12px;
    }

        /* Filter */
    .filter-select {
        padding: 7px 6px;
        font-size: 11px;
    }

    .btn-special-filter {
        padding: 7px 6px;
        font-size: 10px;
    }
    
    .sidebar-nav {
        padding: 10px 4px;
    }
    
    .nav-btn {
        padding: 8px 4px;
    }
    
    .nav-icon {
        font-size: 16px;
    }
    
    .sidebar-footer {
        padding: 10px 4px;
    }
    
    .main-content {
        padding: 12px 8px;
    }
    
    .page-header {
        gap: 10px;
    }
    
    .page-title {
        font-size: 18px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    /* Product Items */
    .product-item {
        padding: 10px 8px;
        gap: 6px;
    }
    
    .product-image {
        width: 42px;
        height: 42px;
    }
    
    .product-thumbnail-placeholder {
        font-size: 18px;
    }
    
    .product-info {
        max-width: calc(100% - 50px - 65px);
    }
    
    .product-name-en {
        font-size: 12px;
    }
    
    .product-name-ar {
        font-size: 10px;
    }
    
    .product-special-badge {
        font-size: 7px;
        padding: 1px 3px;
    }
    
    .product-category {
        font-size: 9px;
        padding: 1px 4px;
    }
    
    .product-price-container {
        min-width: 60px;
    }
    
    .product-price-old {
        font-size: 9px;
    }
    
    .product-price-special,
    .product-price-regular {
        font-size: 12px;
    }
    
    .btn-edit,
    .btn-delete {
        padding: 6px 8px;
        font-size: 10px;
    }
    
    /* Modal */
    .modal-header {
        padding: 14px 12px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .modal-form {
        padding: 12px;
    }
    
    .form-group {
        margin-bottom: 14px;
    }
    
    .form-group label {
        font-size: 12px;
        margin-bottom: 6px;
    }
    
    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 10px;
        font-size: 16px;
    }
    
    /* Image Upload */
    .image-preview {
        max-width: 100px;
        height: 80px;
    }
    
    .image-upload-container input[type="file"] {
        padding: 10px;
        font-size: 12px;
    }
    
    /* Checkbox */
    .checkbox-label {
        padding: 8px 10px;
        font-size: 12px;
        gap: 6px;
    }
    
    .checkbox-custom {
        width: 16px;
        height: 16px;
    }
    
    .checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
        font-size: 11px;
    }
    
    /* Links Form */
    .links-form {
        padding: 12px;
    }
    
    /* Empty State */
    .empty-state {
        padding: 30px 12px;
    }
    
    .empty-icon {
        font-size: 36px;
    }
    
    .empty-state p {
        font-size: 13px;
    }
}

/* ===== Extra Small Phones (320px and below) - iPhone SE 1st gen ===== */
@media (max-width: 320px) {
    :root {
        --sidebar-width: 45px;
    }
    
    .logo {
        font-size: 14px;
    }

        /* Filter */
    .filter-container {
        gap: 4px;
    }

    .filter-select {
        padding: 6px 4px;
        font-size: 10px;
    }

    .btn-special-filter {
        padding: 6px 4px;
        font-size: 9px;
    }
    
    .nav-icon {
        font-size: 14px;
    }
    
    .main-content {
        padding: 10px 6px;
    }
    
    .page-title {
        font-size: 16px;
    }
    
    .btn {
        padding: 7px 10px;
        font-size: 11px;
    }
    
    /* Product Items */
    .product-item {
        padding: 8px 6px;
        gap: 4px;
    }
    
    .product-image {
        width: 38px;
        height: 38px;
    }
    
    .product-thumbnail-placeholder {
        font-size: 16px;
    }
    
    .product-info {
        max-width: calc(100% - 45px - 55px);
    }
    
    .product-name-en {
        font-size: 11px;
    }
    
    .product-name-ar {
        font-size: 9px;
    }
    
    .product-special-badge {
        display: none;
    }
    
    .product-category {
        font-size: 8px;
    }
    
    .product-price-container {
        min-width: 50px;
    }
    
    .product-price-old {
        font-size: 8px;
    }
    
    .product-price-special,
    .product-price-regular {
        font-size: 11px;
    }
    
    .btn-edit,
    .btn-delete {
        padding: 5px 6px;
        font-size: 9px;
    }
    
    /* Checkbox */
    .checkbox-label {
        padding: 8px;
        font-size: 11px;
    }
}

/* ===== Login Page Responsive ===== */
@media (max-width: 480px) {
    .login-page {
        padding: 16px;
    }
    
    .login-card {
        padding: 24px 20px;
    }
    
    .login-logo {
        font-size: 28px;
    }
    
    .login-subtitle {
        font-size: 12px;
    }
    
    .login-form input {
        padding: 14px;
        font-size: 16px;
    }
    
    .btn-login {
        padding: 14px 16px;
        font-size: 15px;
    }
}

@media (max-width: 375px) {
    .login-card {
        padding: 20px 16px;
    }
    
    .login-logo {
        font-size: 24px;
    }
    
    .login-header {
        margin-bottom: 24px;
    }
}/* ===== Login Page ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.login-form input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background-color: white;
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.login-form input::placeholder {
    color: #94a3b8;
}

.form-error {
    color: var(--danger-color);
    font-size: 14px;
    margin-bottom: 16px;
    min-height: 20px;
}

.form-success {
    color: var(--success-color, #16a34a);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.45;
}

.btn-login {
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ===== Today's Special Checkbox ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    padding: 12px 16px;
    background-color: #fefce8;
    border: 1px solid #fef08a;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.checkbox-label:hover {
    background-color: #fef9c3;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Special Price Group Highlight */
.special-price-group label {
    color: #ca8a04 !important;
}

.special-price-group input {
    border-color: #fef08a !important;
    background-color: #fefce8 !important;
}

.special-price-group input:focus {
    border-color: #eab308 !important;
    box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.1) !important;
}

/* ===== Product List - Special Badge ===== */
.product-special-badge {
    background-color: #fef08a;
    color: #854d0e;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
}

/* ===== Product Price - Special Styling ===== */
.product-price-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin: 0 32px;
    min-width: 100px;
}

.product-price-old {
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: line-through;
}

.product-price-special {
    font-weight: 600;
    font-size: 16px;
    color: #ca8a04;
}

.product-price-regular {
    font-weight: 600;
    font-size: 16px;
    color: var(--success-color);
}

/* Responsive adjustments for special price */
@media (max-width: 480px) {
    .product-price-container {
        margin: 0;
        min-width: 70px;
    }
    
    .product-price-old {
        font-size: 11px;
    }
    
    .product-price-special,
    .product-price-regular {
        font-size: 14px;
    }
}

/* ===== Stats Bar ===== */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background-color: var(--bg-elevated);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Mobile tweak */
@media (max-width: 480px) {
    .stats-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.btn-duplicate {
    background-color: #f0f4ff;
    color: #3154ff;
}

.btn-duplicate:hover {
    background-color: #dbe4ff;
}

.header-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-bulk-delete {
    background-color: #ffe3e3;
    color: #c92a2a;
}

.btn-bulk-delete:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-bulk-delete:not(:disabled):hover {
    background-color: #ffc9c9;
}

.product-select-wrapper {
    display: flex;
    align-items: flex-start;
    padding-right: 4px;
}

.product-select-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    min-width: 220px;
    max-width: 320px;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: toast-in 0.2s ease-out;
}

.toast-success {
    background-color: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.toast-error {
    background-color: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 16px;
    cursor: pointer;
    margin-left: 10px;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Confirm modal sizing */
.confirm-modal {
    max-width: 380px;
}

/* Confirm header */
.confirm-header {
    border-bottom: none;
    padding-bottom: 8px;
}

.confirm-header .modal-title {
    font-size: 18px;
}

/* Confirm body */
.confirm-body {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px 12px 24px;
}

.confirm-icon {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background-color: #fef2f2;
    color: #b91c1c;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.confirm-body p {
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
}

/* Confirm actions */
.confirm-actions {
    justify-content: flex-end;
    padding: 12px 24px 20px 24px;
}

/* Rich confirm message content */
.confirm-message {
    display: flex;
    flex-direction: column;
    gap: 12px;
    font-size: 13px;
    color: var(--text-primary);
}

.confirm-intro {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.confirm-section {
    margin-top: 4px;
}

.confirm-section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #64748b;
    margin-bottom: 4px;
}

.confirm-url-box {
    padding: 6px 8px;
    border-radius: 6px;
    background-color: #0f172a;
    border: 1px solid #1e293b;
    overflow-wrap: anywhere;
}

.confirm-url-box code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    color: #e5e7eb;
}

.confirm-url-box--new {
    background-color: #022c22;
    border-color: #059669;
}

.confirm-list {
    margin: 4px 0 0 18px;
    padding: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.confirm-list li {
    margin-bottom: 2px;
}

/* ===== Pagination ===== */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    margin-top: 16px;
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.page-size-select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--card-bg);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
}

.page-size-select:hover {
    border-color: var(--primary-color);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-pagination {
    padding: 8px 16px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.btn-pagination:hover:not(:disabled) {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.btn-pagination:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-page-info {
    padding: 0 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ===== Pagination Responsive ===== */
@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 12px;
    }

    .pagination-info {
        justify-content: space-between;
        width: 100%;
        flex-wrap: wrap;
        gap: 12px;
    }

    .pagination-controls {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 6px;
    }

    .btn-pagination {
        padding: 8px 12px;
        font-size: 13px;
        flex: 1;
        min-width: 60px;
    }

    .pagination-page-info {
        padding: 0 8px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .pagination-container {
        padding: 12px;
        gap: 10px;
    }

    .pagination-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .pagination-info span {
        font-size: 13px;
    }

    .page-size-select {
        width: 100%;
        padding: 8px;
        font-size: 13px;
    }

    .pagination-controls {
        gap: 4px;
    }

    .btn-pagination {
        padding: 8px 10px;
        font-size: 12px;
        min-width: 50px;
    }

    /* Hide text on very small buttons, show only icons */
    .btn-pagination:first-of-type,
    .btn-pagination:last-of-type {
        min-width: 40px;
        padding: 8px 6px;
    }

    .pagination-page-info {
        padding: 0 6px;
        font-size: 12px;
        order: -1; /* Move page info to top on mobile */
        width: 100%;
        text-align: center;
        margin-bottom: 8px;
    }
}

@media (max-width: 375px) {
    .pagination-controls {
        gap: 3px;
    }

    .btn-pagination {
        padding: 6px 8px;
        font-size: 11px;
        min-width: 45px;
    }

    /* Shorten button text on very small screens */
    #firstPageBtn::before {
        content: '««';
    }
    
    #firstPageBtn {
        font-size: 0;
        min-width: 35px;
        padding: 8px 4px;
    }
    
    #firstPageBtn::before {
        content: '««';
        font-size: 14px;
    }

    #lastPageBtn {
        font-size: 0;
        min-width: 35px;
        padding: 8px 4px;
    }
    
    #lastPageBtn::after {
        content: '»»';
        font-size: 14px;
    }

    #prevPageBtn {
        font-size: 0;
        min-width: 35px;
        padding: 8px 4px;
    }
    
    #prevPageBtn::before {
        content: '«';
        font-size: 14px;
    }

    #nextPageBtn {
        font-size: 0;
        min-width: 35px;
        padding: 8px 4px;
    }
    
    #nextPageBtn::after {
        content: '»';
        font-size: 14px;
    }
}

/* ===== Loading Indicator ===== */
.loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-indicator p {
    margin: 0;
    font-size: 14px;
}

/* ===== Language switcher (Phase 7) ===== */
.btn-lang {
    flex: 1;
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    background: transparent;
    color: inherit;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background .2s, border-color .2s;
}
.btn-lang:hover {
    background: rgba(255,255,255,0.1);
    border-color: rgba(255,255,255,0.5);
}
.btn-lang.active {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.6);
}


/* Language switcher: stacked on tablet/phone */
@media (max-width: 1024px) {
    .language-switcher {
      padding: 10px 12px;
    }
  
    /* Hide the "Language" label to save space */
    .language-switcher .lang-label {
      display: none !important;
    }
  
    /* Stack buttons vertically */
    .language-switcher > div {
      display: flex;
      flex-direction: column;
      gap: 6px;
      width: 100%;
    }
  
    .btn-lang {
      flex: none;
      width: 100%;
      padding: 8px 0;         /* a bit bigger, touch‑friendly */
      font-size: 13px;
      text-align: center;
    }
  }
  
  /* Optionally tighten a bit more on very small phones */
  @media (max-width: 480px) {
    .language-switcher {
      padding: 8px 10px !important;
    }
  
    .language-switcher > div {
      gap: 4px !important;
    }
  
    .btn-lang {
      padding: 7px 0 !important;
      font-size: 12px;
    }
  }

  @media (max-width: 430px) {
    .language-switcher > div {
      flex-direction: column !important;
    }
    .btn-lang {
      width: 100% !important; 
    }
  }

/* ===== RTL + Arabic support ===== */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap');

[dir="rtl"] {
    font-family: 'Noto Sans Arabic', 'Inter', sans-serif;
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

[dir="rtl"] .toast-container {
    right: auto;
    left: 20px;
}
[dir="rtl"] .toast-close {
    margin-left: 0;
    margin-right: 10px;
}

.auth-switch { margin-top: 1rem; text-align: center; }
.auth-switch a { color: var(--primary-color, #2563eb); text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

/* Hide until business type is resolved */
.business-type-gated {
    display: none;
  }