/* =============================================
   RainShine Mobile — Design System
   ============================================= */

:root {
  --primary:        #1E40AF;
  --primary-dark:   #1E3A8A;
  --primary-light:  #3B82F6;
  --secondary:      #F97316;
  --secondary-dark: #EA580C;
  --success:        #10B981;
  --danger:         #EF4444;
  --warning:        #F59E0B;
  --cream:          #FFFDD9;
  --cream-dark:     #F5F0B0;
  --gray-50:        #F9FAFB;
  --gray-100:       #F3F4F6;
  --gray-200:       #E5E7EB;
  --gray-300:       #D1D5DB;
  --gray-500:       #6B7280;
  --gray-700:       #374151;
  --gray-900:       #111827;
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg:      0 10px 30px rgba(0,0,0,0.12);
  --radius:         0.5rem;
  --radius-lg:      0.75rem;
  --radius-xl:      1rem;
  --transition:     200ms ease-in-out;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; }

html { font-size: 16px; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Roboto Flex', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--gray-900);
  background: #fff;
  margin: 0;
  padding: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

/* --- Splash Screen --- */
.rs-splash {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  background: var(--cream);
  gap: 2rem;
}
.rs-splash-logo { height: 70px; width: auto; }
.rs-splash-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Blazor Error UI --- */
#blazor-error-ui {
  background: #ffebee;
  border-top: 3px solid #ef5350;
  color: #b71c1c;
  display: none;
  font-size: 0.875rem;
  padding: 0.75rem 1rem;
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 9999;
}
#blazor-error-ui .reload { color: #1E40AF; font-weight: 600; }
#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* --- Layout --- */
.page { display: flex; flex-direction: column; min-height: 100dvh; }
.page > main { flex: 1; }
.sidebar { display: none; }

/* --- Announcement bar --- */
.announcement-bar {
  background: var(--primary-dark);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.375rem 1rem;
  text-align: center;
  letter-spacing: 0.02em;
}

/* --- Top navbar --- */
.rs-navbar {
  background: var(--cream);
  border-bottom: 2px solid var(--cream-dark);
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 8px rgba(30,64,175,0.06);
}
.rs-navbar .navbar-brand img { height: 44px; width: auto; }
.rs-navbar .nav-link {
  color: var(--gray-700) !important;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  transition: color var(--transition), background var(--transition);
}
.rs-navbar .nav-link:hover,
.rs-navbar .nav-link.active {
  color: var(--primary) !important;
  background: rgba(30,64,175,0.06);
}
.rs-navbar .navbar-toggler {
  border: none;
  color: var(--primary);
  font-size: 1.4rem;
  padding: 0.3rem 0.5rem;
}
.rs-navbar .navbar-toggler:focus { box-shadow: none; }

/* Search in navbar */
.rs-search-form { max-width: 320px; }
.rs-search-form .form-control {
  border: 1.5px solid var(--gray-300);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  font-size: 0.9rem;
}
.rs-search-form .form-control:focus {
  border-color: var(--primary);
  box-shadow: none;
}
.rs-search-form .btn-search {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 0.45rem 0.85rem;
  transition: background var(--transition);
}
.rs-search-form .btn-search:hover { background: var(--primary-dark); }

/* --- Hero Banner --- */
.rs-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--primary-light) 100%);
  color: #fff;
  padding: 3.5rem 1.5rem 3rem;
  text-align: center;
}
.rs-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('https://images.unsplash.com/photo-1607082348824-0a96f2a4b9da?w=1200&q=60&fit=crop') center/cover no-repeat;
  opacity: 0.18;
}
.rs-hero-content { position: relative; z-index: 1; max-width: 600px; margin: 0 auto; }
.rs-hero h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 700; margin-bottom: 0.75rem; text-shadow: 0 2px 12px rgba(0,0,0,0.3); }
.rs-hero p { font-size: 1.05rem; opacity: 0.92; margin-bottom: 1.5rem; }
.rs-hero .btn-hero {
  background: var(--secondary);
  color: #fff;
  border: none;
  padding: 0.7rem 1.8rem;
  border-radius: var(--radius-xl);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: background var(--transition), transform var(--transition);
  box-shadow: 0 4px 15px rgba(249,115,22,0.4);
}
.rs-hero .btn-hero:hover { background: var(--secondary-dark); transform: translateY(-2px); }

/* --- Section headers --- */
.rs-section-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.rs-section-title::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, var(--primary-light), transparent);
  margin-left: 0.75rem;
}

/* --- Category pills --- */
.rs-categories { display: flex; gap: 0.5rem; overflow-x: auto; padding-bottom: 0.5rem; scrollbar-width: none; }
.rs-categories::-webkit-scrollbar { display: none; }
.rs-category-pill {
  flex-shrink: 0;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--gray-200);
  background: #fff;
  color: var(--gray-700);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.rs-category-pill:hover,
.rs-category-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* --- Product Card --- */
.rs-card {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  background: #fff;
  height: 100%;
}
.rs-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.rs-card-img-wrap {
  position: relative;
  overflow: hidden;
  background: var(--gray-50);
  aspect-ratio: 1 / 1;
}
.rs-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.rs-card:hover .rs-card-img { transform: scale(1.05); }
.rs-card-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background: var(--secondary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.rs-card-body { padding: 0.75rem; }
.rs-card-brand { font-size: 0.72rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-bottom: 0.2rem; }
.rs-card-title { font-size: 0.9rem; font-weight: 600; color: var(--gray-900); margin-bottom: 0.3rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rs-card-price { font-size: 1rem; font-weight: 700; color: var(--primary); }
.rs-card-rating { font-size: 0.75rem; color: var(--warning); display: flex; align-items: center; gap: 0.2rem; }
.rs-card-rating span { color: var(--gray-500); font-weight: 400; }

/* --- Product Detail --- */
.rs-detail-img-wrap {
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--gray-50);
  aspect-ratio: 1 / 1;
  max-height: 420px;
}
.rs-detail-img { width: 100%; height: 100%; object-fit: contain; }
.rs-detail-brand { font-size: 0.8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }
.rs-detail-price { font-size: 2rem; font-weight: 800; color: var(--primary); line-height: 1; }
.rs-stock-badge { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; font-weight: 600; padding: 0.35rem 0.75rem; border-radius: var(--radius-xl); }
.rs-stock-in  { background: #D1FAE5; color: #065F46; }
.rs-stock-out { background: #FEE2E2; color: #991B1B; }

/* --- Star rating --- */
.rs-stars { display: inline-flex; gap: 0.15rem; }
.rs-stars i { font-size: 0.9rem; }
.rs-stars .filled { color: var(--warning); }
.rs-stars .empty  { color: var(--gray-300); }

/* --- Review card --- */
.rs-review {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.rs-review-name { font-weight: 600; font-size: 0.9rem; }
.rs-review-date { font-size: 0.78rem; color: var(--gray-500); }
.rs-review-comment { font-size: 0.88rem; color: var(--gray-700); margin-top: 0.4rem; }

/* --- Write review form --- */
.rs-review-form {
  background: linear-gradient(135deg, #EFF6FF 0%, #FFFDE7 100%);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid rgba(30,64,175,0.08);
}
.rs-star-selector { display: flex; gap: 0.5rem; }
.rs-star-selector i { font-size: 1.6rem; cursor: pointer; transition: color var(--transition), transform var(--transition); }
.rs-star-selector i:hover,
.rs-star-selector i.filled { color: var(--warning); }
.rs-star-selector i:hover { transform: scale(1.15); }
.rs-star-selector i.empty { color: var(--gray-300); }

/* --- Filter bar --- */
.rs-filter-bar { background: var(--gray-50); padding: 1rem; border-radius: var(--radius-xl); margin-bottom: 1.5rem; }

/* --- Pagination --- */
.rs-pagination { display: flex; justify-content: center; gap: 0.3rem; flex-wrap: wrap; margin-top: 2rem; }
.rs-page-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: #fff;
  color: var(--gray-700);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.rs-page-btn:hover { border-color: var(--primary); color: var(--primary); }
.rs-page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.rs-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Breadcrumb --- */
.rs-breadcrumb { font-size: 0.83rem; color: var(--gray-500); margin-bottom: 1.25rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.rs-breadcrumb a { color: var(--primary); text-decoration: none; }
.rs-breadcrumb a:hover { text-decoration: underline; }
.rs-breadcrumb .sep { color: var(--gray-300); }

/* --- Trust badges (home) --- */
.rs-trust-badges { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; padding: 1.5rem 1rem; background: var(--gray-50); }
.rs-trust-item { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; font-size: 0.8rem; color: var(--gray-700); font-weight: 500; min-width: 80px; }
.rs-trust-item i { font-size: 1.6rem; color: var(--primary); }

/* --- Footer --- */
.rs-footer {
  background: var(--gray-900);
  color: var(--gray-300);
  padding: 2rem 1.5rem 1.5rem;
  font-size: 0.85rem;
}
.rs-footer-brand { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.75rem; }
.rs-footer-brand img { height: 32px; width: auto; filter: brightness(10); opacity: 0.85; }
.rs-footer-brand span { font-weight: 700; color: #fff; font-size: 1.05rem; }
.rs-footer a { color: var(--gray-300); text-decoration: none; }
.rs-footer a:hover { color: #fff; }
.rs-footer hr { border-color: rgba(255,255,255,0.1); }

/* --- Utility --- */
.btn-primary-rs {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-xl);
  padding: 0.6rem 1.5rem;
  font-weight: 600;
  transition: background var(--transition), transform var(--transition);
}
.btn-primary-rs:hover { background: var(--primary-dark); transform: translateY(-1px); color: #fff; }
.btn-outline-rs {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-xl);
  padding: 0.55rem 1.4rem;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-outline-rs:hover { background: var(--primary); color: #fff; }

/* --- Loading spinner --- */
.rs-spinner { display: flex; justify-content: center; align-items: center; padding: 3rem; }
.rs-spinner .spinner-border { width: 2.5rem; height: 2.5rem; color: var(--primary); border-width: 3px; }

/* --- Responsive tweaks --- */
@media (max-width: 576px) {
  .rs-detail-price { font-size: 1.6rem; }
  .rs-hero h1 { font-size: 1.6rem; }
  .rs-hero { padding: 2.5rem 1rem 2rem; }
}

/* --- Toast notifications --- */
.rs-toast-container {
  position: fixed;
  bottom: 1.25rem;
  right: 1rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: min(360px, calc(100vw - 2rem));
}
.rs-toast {
  pointer-events: auto;
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: toastIn 0.25s ease;
  background: #fff;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.rs-toast-header {
  display: flex;
  align-items: center;
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  gap: 0.35rem;
}
.rs-toast-body {
  padding: 0.5rem 0.75rem 0.75rem;
  font-size: 0.85rem;
  color: var(--gray-700);
}
.rs-toast-close {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; line-height: 1; color: var(--gray-500);
  margin-left: auto; padding: 0 0.2rem;
}
.rs-toast-close:hover { color: var(--gray-900); }
.rs-toast-success .rs-toast-header { background:#D1FAE5; color:#065F46; }
.rs-toast-error   .rs-toast-header { background:#FEE2E2; color:#991B1B; }
.rs-toast-warning .rs-toast-header { background:#FEF3C7; color:#92400E; }
.rs-toast-info    .rs-toast-header { background:#DBEAFE; color:#1E40AF; }

/* --- Skeleton loading --- */
.rs-skeleton-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.rs-skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.rs-skeleton-img { height: 180px; border-radius: 0; }
.rs-skeleton-body { padding: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }
.rs-skeleton-line { height: 14px; }
.rs-skeleton-line.short { width: 45%; }
.rs-skeleton-line.half  { width: 55%; }

/* --- Count badge --- */
.rs-count-badge {
  font-size: 0.72rem;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 0.15rem 0.5rem;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* --- Trust badge sub-text --- */
.rs-trust-sub { font-size:.7rem; color:var(--gray-500); }

/* --- Skip link --- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0.5rem;
  background: var(--primary);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 var(--radius) var(--radius);
  font-weight: 600;
  z-index: 9999;
  transition: top 0.15s;
}
.skip-link:focus { top: 0; }

/* --- Error box --- */
.rs-error-box {
  text-align: center;
  padding: 3rem 2rem;
  border-radius: var(--radius-xl);
  border: 1.5px dashed var(--gray-200);
  background: var(--gray-50);
}
