/* Front Page Custom Styles (Scoped) - v1.0.1 */

/* --- 1. Dashboard Status Bar (KPI HUD) --- */
.sales-dashboard-stats {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  background: #fff;
  padding: 16px 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05); /* Soft shadow */
  margin-bottom: 30px;
  flex-wrap: wrap;
  border: 1px solid rgba(79, 139, 194, 0.1); /* Subtle blue border */
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 140px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: #f0f7ff; /* Light blue bg */
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  color: var(--main-color, #4f8bc2);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 600;
  white-space: nowrap;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
}

.stat-value.highlight-red {
  color: #ef4444;
}

/* --- Variables from Main Site --- */
:root {
    /* Colors */
    --color-bg-primary: #FFFFFF;
    --color-bg-secondary: #F8FAFC;
    --color-text-primary: #1E293B;
    --color-text-secondary: #475569;
    --color-text-muted: #94A3B8;
    --color-border: #E2E8F0;
    --color-border-light: #F1F5F9;

    /* Spacing */
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
}

/* --- 2. Category Navigation (Horizontal Scroll) --- */
/* Based on sales-nav__tabs and category-nav-scroll (Backward Compatible) */
.sales-nav__tabs-wrapper,
.category-nav-scroll-wrapper {
  margin-bottom: 40px;
}

.sales-nav__tabs,
.category-nav-scroll {
    display: flex;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    overflow-x: auto;
    padding-bottom: 4px; /* Scrollbar spacing */
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-left: 4px; /* Safety padding */
}

.sales-nav__tabs::-webkit-scrollbar,
.category-nav-scroll::-webkit-scrollbar { display: none; }

.sales-nav__tab,
.cat-nav-item {
    display: flex !important; /* Force flex for old structure */
    flex-direction: row; /* New style prefers row, old was col but let's try to unify or split */
    align-items: center;
    gap: var(--space-2);
    padding: 8px 16px;
    background: var(--color-bg-secondary);
    border-radius: 99px; /* Rounded pill style */
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    
    /* Reset old styles if present */
    width: auto; 
    box-shadow: none;
}

/* Old style override specific for cat-nav-item to look like new pill */
.cat-nav-item {
    background: #F8FAFC; 
    border-radius: 99px;
    padding: 8px 16px;
    width: auto;
    flex: 0 0 auto;
}

.sales-nav__tab:hover, .sales-nav__tab.is-active,
.cat-nav-item:hover {
    background: white;
    box-shadow: var(--shadow-sm);
    color: var(--color-text-primary);
    border-color: var(--color-border);
    transform: translateY(-1px);
}

.sales-nav__icon-wrapper,
.cat-nav-icon {
    position: relative;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Adjust old icon size */
.cat-nav-icon {
    font-size: 1.5rem; /* Emoji size */
    width: auto;
    height: auto;
    margin-right: 4px;
}

.sales-nav__icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.sales-nav__icon-fallback {
    /* fallback content is usually text/emoji */
    display: none;
    font-size: 1.2em;
    line-height: 1;
}

.sales-nav__tab-text,
.cat-nav-label {
    /* Ensure text is visible */
    font-size: 0.95rem;
    font-weight: 600;
}


/* --- 3. Grid (Bento / Quick Search) --- */
/* Based on sales-nav__grid and bento-grid-container (Backward Compatible) */
.sales-nav__grid,
.bento-grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: 50px;
}

/* Old Bento override to look like new grid */
.bento-grid-container {
    grid-template-rows: auto !important; /* Reset row span */
}

@media (max-width: 900px) {
    .sales-nav__grid, .bento-grid-container { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .sales-nav__grid, .bento-grid-container { grid-template-columns: 1fr; }
}

.sales-nav__card,
.bento-card {
    display: flex;
    align-items: flex-start; /* Align top */
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--color-bg-secondary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    text-align: left;
    text-decoration: none; /* remove link underline */
    border: 1px solid transparent;
    
    /* Reset old bento specific */
    grid-row: auto !important;
    grid-column: auto !important;
    min-height: auto;
    color: inherit !important;
}

.sales-nav__card:hover,
.bento-card:hover {
    background: white;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--color-border);
}

/* Hide old bg icons in bento card to clean up */
.bento-bg-icon {
    display: none;
}

.sales-nav__card-icon,
.bento-bg-icon-replacement { /* Hypothetical class if needed */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.icon-wrapper--lg {
    width: 32px;
    height: 32px;
}
.icon-wrapper--lg .sales-nav__icon-fallback {
    font-size: 1.5rem;
}

.sales-nav__card-content,
.bento-content {
    display: flex;
    flex-direction: column;
}

/* Old bento content override */
.bento-content {
    position: static;
}

.sales-nav__card-title,
.bento-title, 
.bento-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 2px;
    line-height: 1.3;
    margin-top: 0;
}

.sales-nav__card-desc,
.bento-cta {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.3;
    background: none;
    padding: 0;
    border-radius: 0;
    backdrop-filter: none;
    margin-top: 0;
    font-weight: normal;
}


/* --- 4. Section Headers & Layout --- */
.section-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 40px 0 20px 0;
    border-bottom: 2px solid #f3f4f6;
    padding-bottom: 10px;
}
.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #111827;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-title i {
    color: var(--main-color);
}
.section-view-all {
    font-size: 0.9rem;
    color: var(--main-color);
    text-decoration: none;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto; /* Right align */
}
.section-view-all:after {
    content: "→";
    font-weight: bold;
}

/* Responsive */
@media (max-width: 768px) {
  .sales-dashboard-stats {
    padding: 12px;
    gap: 12px;
  }
  .stat-item {
     min-width: 45%; /* 2 cols */
  }
  
  /* Reset old responsive */
  .bento-card.main-feature,
  .bento-card.sub-feature-1,
  .bento-card.sub-feature-2 {
      grid-row: auto;
      grid-column: auto;
      min-height: auto;
  }
}

/* --- 5. Featured / Recommendations Section --- */
.featured-header {
    margin-bottom: 20px;
}

.featured-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
}

/* Main Large Card */
.featured-main-card {
    position: relative;
    display: block;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); /* Stronger shadow */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
    min-height: 340px; /* Ensure height */
}
.featured-main-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
}

.featured-main-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.featured-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 40%, rgba(0,0,0,0) 100%);
    z-index: 1;
}

/* Badges */
.featured-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: #FFD700; /* Gold */
    color: #000;
    font-weight: 800;
    font-size: 0.85rem;
    padding: 4px 12px;
    border-radius: 4px;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.featured-discount {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #ef4444; /* Red */
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 4px 10px;
    border-radius: 99px;
    z-index: 2;
}

/* Main Content */
.featured-main-content {
    position: relative;
    z-index: 2;
    padding: 24px;
    color: #fff;
}

.featured-score-tag {
    display: inline-block;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.featured-main-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 8px 0;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    /* Multi-line ellipsis */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.featured-main-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: #fca5a5; /* Light red/pinkish */
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Side Column Widgets */
.featured-side-col {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.featured-widget-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.featured-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 10px;
}

.featured-widget-header h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.widget-emoji {
    font-size: 1.2rem;
}

/* Widget List Layout */
.featured-widget-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.widget-list-item {
    display: flex;
    gap: 12px;
    text-decoration: none;
    align-items: center;
    transition: transform 0.2s;
}

.widget-list-item:hover {
    transform: translateX(4px);
}

.widget-item-thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.widget-item-info {
    flex: 1;
}

.widget-item-title {
    font-size: 0.95rem;
    margin: 0 0 4px 0;
    line-height: 1.4;
    color: #334155;
    font-weight: 600;
}

.widget-item-price {
    font-size: 0.9rem;
    color: #0ea5e9;
    font-weight: 700;
}

/* Widget Grid Layout (2-Column Compact) */
.featured-widget-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px; /* Adjust gap as needed */
}

.widget-grid-item {
    text-decoration: none;
    display: flex;
    flex-direction: row; /* Keep image and info side-by-side */
    gap: 8px;
    align-items: center;
    transition: transform 0.2s;
    background: #fff;
    /* Optional: Add background or border if needed for card-like feel, 
       but user requested "compactly gathered" which usually implies clean look */
}

.widget-grid-item:hover {
    transform: translateY(-2px);
    opacity: 0.8;
}

.widget-grid-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.widget-grid-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.widget-grid-title {
    font-size: 0.85rem;
    margin: 0 0 2px 0;
    line-height: 1.2;
    color: #334155;
    font-weight: 600;
    /* Allow up to 2 lines */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal; /* Override nowrap from previous edit */
}

/* Widget Price Styles */
.widget-item-original,
.widget-grid-original {
    text-decoration: line-through;
    color: #94a3b8;
    font-size: 0.8em;
    font-weight: 400;
    margin-right: 4px;
}

.widget-grid-price {
    font-size: 0.9rem;
    color: #0ea5e9;
    font-weight: 700;
    display: flex;
    align-items: center;
    flex-wrap: wrap; /* Handle long prices */
    line-height: 1.2;
}

.widget-grid-cart-icon {
    display: none; 
}

/* --- Slider Styles --- */

/* Main Slider Wrapper (Left Column) */
.featured-main-wrapper {
    display: grid;
    grid-template-areas: "stack";
    position: relative;
    /* Ensure it fills the space if needed, though content usually dictates height */
}

/* Widget Slider Wrapper (Right Column Widgets) */
.widget-slider-container {
    display: grid;
    grid-template-areas: "stack";
    position: relative;
    /* Ensure minimum height to prevent jumping if content varies slightly? 
       For now, let content dictate. */
}

/* Slides Common */
.slider-slide {
    grid-area: stack;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    pointer-events: none;
    width: 100%;
    
    /* Ensure widgets structure remains intact */
    display: flex; /* Defaults for lists/grids inside might need this or block */
}

/* Specific resets for visual layout inside slides */
.slider-slide.featured-main-card {
    display: block; /* The main card is a block link */
}
.slider-slide.featured-widget-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.slider-slide.featured-widget-grid {
    display: grid; 
    grid-template-columns: repeat(2, 1fr); /* Re-apply grid definition */
    gap: 15px;
}

.slider-slide.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 1; /* Bring to front */
}

/* Slider Indicators (Main Card) */
.slider-indicators {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 2;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255,255,255,0.5);
    border-radius: 50%;
    transition: background-color 0.3s;
}

.indicator-dot.active {
    background-color: #fff;
    transform: scale(1.2);
}

/* Footer Link */
.widget-footer {
    margin-top: auto;
    padding-top: 15px;
    text-align: right;
}

.widget-view-all {
    font-size: 0.9rem;
    color: #64748b;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.widget-view-all:hover {
    color: #0ea5e9;
}

/* Responsive */
@media (max-width: 768px) {
    .featured-grid {
        grid-template-columns: 100% !important; /* Ensure single column */
        gap: 20px;
    }
    .featured-main-card {
        min-height: 280px;
    }
}

/* Featured Price Diff & Trend Info */
.featured-price-diff {
    display: inline-block;
    font-size: 0.9rem;
    color: #a7f3d0; /* Soft green */
    font-weight: 600;
    margin-left: 8px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.featured-trend-info {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.8rem;
    color: #e2e8f0;
}

.trend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.5);
    padding: 4px 8px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

.trend-badge-record {
    background: #FF0000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}
