/* ===================================================================
   CBX INDUSTRIAL DESIGN SYSTEM
   Based on web-v2/design-system-complete.html
   =================================================================== */

:root {
  /* Core Industrial Palette */
  --steel-900: #0d1117;
  --steel-850: #131920;
  --steel-800: #161b22;
  --steel-700: #21262d;
  --steel-600: #30363d;
  --steel-500: #484f58;
  --steel-400: #6e7681;
  --steel-300: #8b949e;
  --steel-200: #c9d1d9;
  --steel-100: #f0f6fc;

  /* Signal Colors - Reserved for specific states */
  --warning-amber: #ffb700;  /* Focus/Active only */
  --danger-red: #ff3838;
  --success-green: #00c853;
  --info-blue: #2979ff;
  --power-orange: #ff6d00;

  /* Subtle Gradients */
  --brushed-metal-subtle: linear-gradient(180deg, #30363d 0%, #2a2f36 100%);
  --pressed-metal-subtle: linear-gradient(180deg, #1a1e24 0%, #1f2329 100%);
  --chrome-hint: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 50%, rgba(0,0,0,0.05) 100%);

  /* Typography */
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;
  --font-condensed: 'IBM Plex Sans Condensed', 'IBM Plex Sans', system-ui, sans-serif;
  --font-sans-jp: 'IBM Plex Sans JP', 'IBM Plex Sans', system-ui, sans-serif;

  /* Multi-layer Shadows */
  --shadow-inset-subtle: inset 0 1px 2px rgba(0,0,0,0.3);
  --shadow-inset-deep: inset 0 2px 4px rgba(0,0,0,0.6), inset 0 1px 2px rgba(0,0,0,0.4);
  --shadow-raised: 0 2px 4px rgba(0,0,0,0.2), 0 4px 8px rgba(0,0,0,0.15), 0 0 1px rgba(0,0,0,0.5);
  --shadow-raised-hover: 0 4px 8px rgba(0,0,0,0.3), 0 8px 16px rgba(0,0,0,0.2), 0 0 1px rgba(0,0,0,0.5);
  --shadow-pressed: inset 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 2px rgba(0,0,0,0.3);
  --shadow-glow-amber: 0 0 20px rgba(255,183,0,0.4);
  --shadow-glow-red: 0 0 20px rgba(255,56,56,0.4);
  --shadow-glow-green: 0 0 15px rgba(0,200,83,0.3);
  --shadow-glow-focus: 0 0 0 2px rgba(255,183,0,0.3);

  /* Animation Timing */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ===================================================================
   RESET & BASE
   =================================================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--steel-900);
  color: var(--steel-200);
  min-height: 100vh;
  position: relative;
  line-height: 1.5;
}

/* Subtle noise texture */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='noise'%3E%3CfeTurbulence baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23noise)' opacity='0.02'/%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.3;
  z-index: 0;
}

/* ===================================================================
   APP BAR
   =================================================================== */

z-app-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--steel-800);
  border-bottom: 1px solid var(--steel-700);
  box-shadow: var(--shadow-raised);
  position: sticky;
  top: 0;
  z-index: 100;
}

z-app-bar-label {
  font-family: var(--font-condensed);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--steel-100);
  letter-spacing: -0.01em;
}

z-spacer {
  flex: 1;
}

/* ===================================================================
   SEARCH BAR
   =================================================================== */

z-search-field {
  position: relative;
  width: 300px;
  display: flex;
  align-items: center;
}

z-search-field input {
  width: 100%;
  padding: 0.5rem 2.5rem;
  background: var(--steel-700);
  border: 1px solid var(--steel-600);
  border-radius: 20px;
  color: var(--steel-200);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  transition: all var(--transition-normal);
  -webkit-appearance: none;
}

z-search-field input:focus {
  outline: none;
  background: var(--steel-600);
  border-color: var(--warning-amber);
  box-shadow: var(--shadow-glow-focus);
}

z-search-field input::placeholder {
  color: var(--steel-500);
}

.z-search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--steel-400);
}

.z-search-field-clear-button {
  position: absolute;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  background: var(--steel-500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  transition: all var(--transition-normal);
}

.z-search-field-clear-button:hover {
  background: var(--steel-400);
}

/* ===================================================================
   DROPDOWN BUTTONS
   =================================================================== */

z-dropdown-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--brushed-metal-subtle);
  border: 1px solid var(--steel-600);
  border-radius: 3px;
  color: var(--steel-200);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: all var(--transition-fast);
}

z-dropdown-button:hover {
  background: var(--steel-600);
  border-color: var(--steel-500);
}

z-dropdown-button:focus-visible {
  outline: 2px solid var(--warning-amber);
  outline-offset: 2px;
}

z-dropdown-button.z-open {
  background: var(--steel-600);
  border-color: var(--warning-amber);
  color: var(--warning-amber);
}

/* ===================================================================
   FILTER BAR
   =================================================================== */

z-filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--steel-850);
  border-bottom: 1px solid var(--steel-700);
}

z-filter-bar-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--steel-300);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

/* ===================================================================
   ITEM BROWSER & GRID
   =================================================================== */

z-item-browser {
  display: block;
  position: relative;
  height: calc(100vh - 120px); /* Adjust based on header height */
  overflow-y: auto;
  background: var(--steel-900);
  scrollbar-width: thin;
  scrollbar-color: var(--steel-600) var(--steel-800);
}

z-item-browser::-webkit-scrollbar {
  width: 12px;
}

z-item-browser::-webkit-scrollbar-track {
  background: var(--steel-800);
}

z-item-browser::-webkit-scrollbar-thumb {
  background: var(--steel-600);
  border-radius: 6px;
  border: 2px solid var(--steel-800);
}

z-item-browser::-webkit-scrollbar-thumb:hover {
  background: var(--steel-500);
}

z-grid-view {
  display: block;
  position: relative;
  padding: 1.5rem;
}

/* ===================================================================
   COMIC CARDS
   =================================================================== */

z-comic-item {
  display: block;
  position: absolute;
  cursor: pointer;
  transition: transform var(--transition-normal);
}

z-comic-item:hover {
  transform: translateY(-4px);
  z-index: 10;
}

z-comic-item:focus-visible {
  outline: 2px solid var(--warning-amber);
  outline-offset: 4px;
  border-radius: 3px;
}

.item-thumbnail-container {
  position: relative;
  aspect-ratio: 2/3;
  background: var(--steel-700);
  border-radius: 3px;
  overflow: hidden;
  box-shadow: var(--shadow-raised);
  transition: box-shadow var(--transition-normal);
  margin-bottom: 0.75rem;
}

z-comic-item:hover .item-thumbnail-container {
  box-shadow: var(--shadow-raised-hover);
}

.item-thumbnail-link {
  display: block;
  width: 100%;
  height: 100%;
  text-decoration: none;
}

z-thumbnail-image {
  display: block;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-color: var(--steel-700);
  background-image: linear-gradient(135deg, var(--steel-600), var(--steel-700));
}

.item-title-container {
  padding: 0 0.25rem;
}

.item-title {
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--steel-100);
  line-height: 1.3;
  margin-bottom: 0.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 2.6em;
}

.item-author {
  font-size: 0.8125rem;
  color: var(--steel-300);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-author-link {
  color: var(--steel-300);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition-normal);
}

.item-author-link:hover {
  color: var(--warning-amber);
  text-decoration: underline;
}

/* Favorite indicator */
z-comic-item.favorite .item-thumbnail-container::after {
  content: '';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  background: rgba(13,17,23,0.9);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

z-comic-item.favorite .item-thumbnail-container::before {
  content: '★';
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 24px;
  height: 24px;
  color: var(--warning-amber);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

/* ===================================================================
   ICON BUTTONS
   =================================================================== */

z-carbon-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  cursor: pointer;
  opacity: 0.7;
  transition: all var(--transition-normal);
}

z-carbon-icon:hover {
  opacity: 1;
  color: var(--warning-amber);
}

z-carbon-icon svg {
  fill: currentColor;
}

/* ===================================================================
   DROPDOWN MENU
   =================================================================== */

z-dropdown-menu {
  position: absolute;
  background: var(--steel-800);
  border: 1px solid var(--steel-600);
  border-radius: 3px;
  box-shadow: var(--shadow-raised-hover);
  overflow: hidden;
  z-index: 1000;
}

z-dropdown-menu-item {
  display: block;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--steel-200);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 1px solid var(--steel-700);
}

z-dropdown-menu-item:last-child {
  border-bottom: none;
}

z-dropdown-menu-item:hover {
  background: var(--steel-600);
  color: var(--warning-amber);
}

/* ===================================================================
   SCALE SLIDER
   =================================================================== */

input[type="range"] {
  -webkit-appearance: none;
  width: 100px;
  height: 4px;
  background: var(--steel-700);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--steel-300);
  border-radius: 50%;
  cursor: pointer;
  transition: all var(--transition-normal);
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: var(--warning-amber);
  box-shadow: var(--shadow-glow-amber);
}

/* ===================================================================
   BUTTONS
   =================================================================== */

z-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

z-button:hover {
  background: var(--steel-700);
  border-radius: 3px;
}

z-button:focus-visible {
  outline: 2px solid var(--warning-amber);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */

@media (max-width: 768px) {
  z-search-field {
    width: 100%;
    max-width: 200px;
  }

  z-grid-view {
    padding: 1rem;
  }

  z-app-bar {
    padding: 0.75rem 1rem;
  }

  z-app-bar-label {
    font-size: 1.1rem;
  }
}