/* 
  Phillips Stickers - Modern Premium Design 
  Refactored for Sidebar Layout & Multi-page structure.
*/

:root {
  /* Light Theme (Default) */
  --bg-body: #f8fafc;
  /* Cool gray 50 */
  --bg-card: #ffffff;
  --bg-header: #ffffff;
  --bg-sidebar: #ffffff;

  --text-main: #0f172a;
  /* Slate 900 */
  --text-muted: #64748b;
  /* Slate 500 */

  --primary: #4f46e5;
  /* Indigo 600 - more premium than standard blue */
  --primary-hover: #4338ca;
  /* Indigo 700 */
  --accent: #f59e0b;
  /* Amber 500 */
  --danger: #ef4444;
  /* Red 500 */
  --success: #10b981;
  /* Emerald 500 */

  --border: #e2e8f0;
  /* Slate 200 */
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --radius: 12px;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body.dark {
  --bg-body: #0f172a;
  /* Slate 900 */
  --bg-card: #1e293b;
  /* Slate 800 */
  --bg-header: #1e293b;
  --bg-sidebar: #1e293b;

  --text-main: #f8fafc;
  /* Slate 50 */
  --text-muted: #94a3b8;
  /* Slate 400 */

  --primary: #6366f1;
  /* Indigo 500 */
  --primary-hover: #818cf8;

  --border: #334155;
  /* Slate 700 */
}

/* GLOBAL RESET */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  margin: 0;
  padding: 0;
  background: var(--bg-body);
  color: var(--text-main);
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-hover);
}

/* HEADER */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.9);
}

body.dark .topbar {
  background: rgba(30, 41, 59, 0.9);
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-link {
  text-decoration: none;
}

/* HEADER CENTER - SEARCH */
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 2rem;
}

.search-bar {
  position: relative;
  width: 100%;
  max-width: 480px;
}

.search-bar input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 3rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-body);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  transform: scale(1.01);
}

.search-icon {
  position: absolute;
  left: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

/* CONTROLS */
.controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.icon-link,
.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 1.2rem;
  position: relative;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  transition: all 0.2s;
}

.icon-link:hover,
.icon-btn:hover {
  background: var(--bg-body);
  color: var(--primary);
  border-color: var(--border);
  transform: translateY(-2px);
}

.badge-count {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--danger);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
  border: 2px solid var(--bg-header);
}

.nav-btn {
  padding: 0.6rem 1.2rem;
  border-radius: 99px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--bg-body);
  border-color: var(--text-muted);
}

/* LAYOUT MAIN */
.layout {
  display: flex;
  flex: 1;
  max-width: 1440px;
  margin: 0 auto;
  width: 100%;
  padding: 3rem 2rem;
  gap: 3rem;
}

/* SIDEBAR FILTERS */
.sidebar-filters {
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  flex-shrink: 0;
}

.filter-group h3 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-weight: 700;
}

.categories-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cat-btn {
  text-align: left;
  padding: 0.85rem 1.25rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.2s;
}

.cat-btn:hover {
  background: var(--bg-card);
  color: var(--primary);
  border-color: var(--border);
}

.cat-btn.active {
  background: var(--primary);
  color: white;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  border-color: transparent;
}

.filter-select {
  width: 100%;
  padding: 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1em;
}

.filter-select:focus {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* PRODUCT GRID */
.product-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
  align-content: start;
}

/* CARD DESIGN */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  border: 1px solid var(--border);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
}

.card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-body);
  margin-bottom: 1.25rem;
  transition: transform 0.3s;
}

.card:hover img {
  transform: scale(1.05);
}

.card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.card .price {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 1rem;
}

.card select {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-body);
  color: var(--text-main);
  font-size: 0.9rem;
}

.card .stock {
  font-size: 0.85rem;
  color: var(--success);
  font-weight: 500;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card .stock::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
}

.card-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn-primary {
  width: 100%;
  padding: 0.85rem;
  border-radius: 10px;
  border: none;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.4);
}

.btn-secondary {
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
}

body.dark .btn-secondary {
  background: transparent;
}

.btn-secondary:hover {
  background: var(--bg-body);
  color: var(--text-main);
  border-color: var(--text-muted);
}

.badge {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  background: var(--accent);
  color: white;
  padding: 0.35rem 0.85rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.4);
  z-index: 10;
}

/* PAGE SPECIFIC: CART & WISHLIST */
.container {
  max-width: 900px;
  margin: 3rem auto;
  padding: 0 2rem;
  flex: 1;
  width: 100%;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-header h2 {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.back-link {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cart-list,
.wishlist-grid {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s;
}

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

.cart-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cart-item-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.cart-item-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.cart-item-price {
  font-weight: 700;
  color: var(--text-main);
  font-size: 1.2rem;
}

.cart-summary {
  margin-top: 3rem;
  background: var(--bg-card);
  padding: 2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.total-row {
  display: flex;
  justify-content: space-between;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 2rem;
  color: var(--text-main);
  border-bottom: 2px dashed var(--border);
  padding-bottom: 1.5rem;
}

.checkout-btn {
  width: 100%;
  padding: 1.25rem;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

.checkout-btn:hover {
  background: #059669;
  transform: translateY(-2px);
  box-shadow: 0 15px 20px -3px rgba(16, 185, 129, 0.4);
}

.empty-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  margin-top: 4rem;
  padding: 3rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
}

/* FOOTER */
.footer {
  text-align: center;
  padding: 3rem;
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: auto;
}

.footer a {
  color: var(--text-main);
  font-weight: 600;
}