/* --- Global Variables --- */
:root {
    --ds-app-bg: #f4f5f8;
    --ds-brand-accent: #04C366; /* New primary accent color */
    --ds-brand-accent2: #000000; /* New primary accent2 color */
    --ds-brand-text: #000000; /* Dark text for contrast on bright green */
    --ds-primary-white: #ffffff;
    --ds-text-dark: #1f2937;
    --ds-text-muted: #6b7280;
    --ds-border: #d7d7d7;
    
    /* Functional Colors */
    --ds-alert-red: #ff3b30;
}

/* --- App Container --- */
.ds-app-container {
    max-width: 600px; 
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--ds-app-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 15px 40px rgba(0,0,0,0.08);
}

/* --- Header & Search Bar --- */
.ds-app-header {
    background: white;
    padding: 5px 20px 0 20px;
}

.ds-brand-logo {
    color: var(--ds-brand-text);
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.ds-search-pill {
    display: flex;
    align-items: center;
    background: var(--ds-primary-white);
    border-radius: 50px;
    border:2px solid var(--ds-brand-accent2);
    padding: 2px 16px;
    gap: 12px;
    margin-top:10px;
    margin-bottom: 10px;
}

.ds-search-icon {
    width: 20px;
    height: 20px;
    color: var(--ds-text-muted);
}

.ds-search-pill input {
    flex-grow: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--ds-text-dark);
    outline: none;
    border:none;
    box-shadow:none ;
}

.ds-search-pill input::placeholder {
    color: #9ca3af;
}

.ds-filter-icon-btn {
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--ds-brand-accent2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ds-filter-icon-btn svg {
    width: 20px;
    height: 20px;
}

/* --- Underlined Tabs --- */
.ds-tabs-container {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scrollbar-width: none; 
    background: var(--ds-primary-white);
    margin: 0 -20px; 
    padding: 0 20px;
    border-bottom: 1px solid var(--ds-border);
}

.ds-tabs-container::-webkit-scrollbar {
    display: none; 
}

.ds-tab {
    padding: 16px 4px;
    font-size: 15px;
    font-family:almarai;
    font-weight: 600;
    color: var(--ds-text-muted);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    user-select: none;
    transition: color 0.2s;
}
a.ds-tab {
    text-decoration: none !important;
}

/* Hide radio visually but keep it interactive for mobile taps */
.ds-tab input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    cursor: pointer;
}

.ds-tab:hover {
    color: var(--ds-brand-accent);
}

.ds-tab.active {
    color: var(--ds-brand-accent);
    font-weight: 700;
    font-size:17px;
}

.ds-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--ds-brand-accent);
    border-radius: 3px 3px 0 0;
}

/* --- Content Wrapper & Loader --- */
.ds-content-wrapper {
    position: relative;
    min-height: 200px;
}

.ds-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(244, 245, 248, 0.7); /* Slightly darker for better contrast */
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.ds-loader-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: none; /* Appears instantly so fast-loads aren't missed */
}

/* New sticky wrapper keeps the spinner in the viewport */
.ds-spinner-wrapper {
    position: sticky;
    top: 150px; 
    display: flex;
    justify-content: center;
    width: 100%;
    padding-top: 40px; 
}

.ds-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--ds-border);
    border-top: 4px solid var(--ds-brand-accent);
    border-radius: 50%;
    animation: ds-spin 1s linear infinite;
}

@keyframes ds-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- Product List --- */
.ds-product-list {
    margin:15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* --- Card Design --- */
.ds-card {
    background: var(--ds-primary-white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid var(--ds-border);
}

/* Card Image Area */
.ds-card-img-wrap {
    position: relative;
    padding: 12px 12px 0 12px;
}

.ds-card-img-wrap img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    background: var(--ds-app-bg);
}

.ds-no-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    background: var(--ds-app-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ds-text-muted);
    font-weight: 500;
}

/* Top Left Availability Badge */
.ds-avail-badge {
    position: absolute;
    top: 22px;
    left: 22px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.ds-avail-badge svg {
    width: 14px;
    height: 14px;
}

.ds-bg-brand { 
    background: var(--ds-primary-white); 
    color: var(--ds-brand-accent); 
    border:1px solid var(--ds-border);
}

.ds-bg-red { 
    background: var(--ds-alert-red); 
    color: var(--ds-primary-white); 
    border:1px solid var(--ds-alert-red);

}

/* Card Content Details */
.ds-card-body {
    padding: 16px;
}

/* Wrapper for the title */
.ds-title-row {
    margin-bottom: 12px;
}

.ds-title {
    margin: 0;
    font-size: 18px;
    font-weight: 800;
    color: var(--ds-text-dark);
    line-height: 1.3;
}

/* Call to Action Button - Moved to Bottom */
.ds-action-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    background: var(--ds-brand-accent);
    color: var(--ds-primary-white);
    padding: 7px 14px; 
    border-radius: 8px; 
    font-size: 15px; 
    font-weight: 800;
    text-decoration: none !important;
    transition: opacity 0.2s;
    margin-top: 10px; 
}

.ds-action-btn:hover {
    opacity: 0.85;
}

/* --- Consolidated Info Row (Price, Qty, Location) --- */
.ds-info-row {
    display: flex;
    flex-wrap: wrap; /* Allows wrapping on smaller screens to prevent clipping */
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
    font-size: 14px;
    color: var(--ds-text-dark);
}

.ds-info-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ds-info-item .ds-icon {
    width: 18px;
    height: 18px;
    color: var(--ds-brand-accent);
    flex-shrink: 0;
}

.ds-info-val {
    color: var(--ds-text-dark);
    white-space: nowrap;
}

/* Make numbers stand out */
.ds-info-val.ds-bold {
    font-weight: 800;
    font-size: 15px; 
}

/* Softer color for location */
.ds-location-item .ds-info-val {
    color: var(--ds-text-dark);
    font-weight: 800;
}

/* Dot divider between items */
.ds-info-divider {
    color: #d1d5db;
    font-size: 14px;
    line-height: 1;
}

/* --- Pagination --- */
.ds-pagination {
    padding: 0 20px 30px 20px;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.ds-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    background: var(--ds-primary-white);
    border: 1px solid var(--ds-border);
    border-radius: 8px;
    color: var(--ds-text-dark);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.ds-pagination .page-numbers.current {
    background: var(--ds-brand-accent);
    color: var(--ds-brand-text);
    border-color: var(--ds-brand-accent);
}

.ds-no-results {
    text-align: center;
    padding: 40px 20px;
    background: var(--ds-primary-white);
    border-radius: 12px;
    color: var(--ds-text-muted);
}