/* ==========================================================================
   KIOTSO TOOLS — APPLICATION WORKSPACE & COMPONENT EXTENSIONS
   Style: Neo-Brutalism Modernist / Swiss Tech Grid Architecture
   ========================================================================== */

/* Hero Search & Header Enhancements */
.hero-search-box {
  background: var(--paper-card);
  border: var(--border-thick);
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius-lg);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 680px;
  margin: 0 auto;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.hero-search-box:focus-within {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-xl);
}

.hero-search-input {
  border: none;
  outline: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  width: 100%;
}

.hero-search-input::placeholder {
  color: var(--ink-muted);
}

/* Category Nav Pills */
.category-pills {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.category-pill {
  padding: 8px 18px;
  border: var(--border-main);
  border-radius: var(--radius-pill);
  background: var(--paper-card);
  color: var(--ink);
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.category-pill:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-sm);
}

.category-pill.active {
  background: var(--purple);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.category-pill.active .pill-count {
  background: #ffffff;
  color: var(--purple);
}

.pill-count {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

/* Tool Card Enhancements */
.tool-card {
  background: var(--paper-card);
  border: var(--border-main);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  cursor: pointer;
  position: relative;
}

.tool-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: var(--shadow-lg);
}

.tool-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
}

.tool-icon-wrapper {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  border: var(--border-main);
  box-shadow: var(--shadow-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
}

.tool-card-body h3 {
  font-size: 19px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-card-body p {
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1.5px dashed var(--line);
  padding-top: 16px;
  margin-top: auto;
}

.fav-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  transition: transform var(--transition-fast);
  color: var(--ink-muted);
}

.fav-btn:hover {
  transform: scale(1.2);
}

.fav-btn.active {
  color: #ff3b30;
}

/* Modal Workspace */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 15, 29, 0.65);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease, visibility 200ms ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: var(--paper);
  border: var(--border-thick);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: min(1000px, 95vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.98);
  transition: transform 250ms var(--ease-neo);
}

.modal-overlay.active .modal-container {
  transform: translateY(0) scale(1);
}

.modal-header {
  background: var(--paper-card);
  border-bottom: var(--border-main);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.modal-title-group h2 {
  font-size: 22px;
}

.modal-close-btn {
  position: static;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: var(--border-main);
  border-radius: var(--radius-pill);
  background: var(--paper);
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  transition: all var(--transition-fast);
}

.modal-close-btn:hover {
  background: var(--yellow);
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-sm);
}

.modal-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1;
}

/* Tool Interactive Elements */
.tool-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 840px) {
  .tool-grid-layout {
    grid-template-columns: 1fr;
  }
}

.neo-label {
  display: block;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 8px;
}

.neo-textarea,
.neo-input,
.neo-select {
  width: 100%;
  border: var(--border-main);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-family: var(--font-main);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper-card);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.neo-textarea:focus,
.neo-input:focus,
.neo-select:focus {
  outline: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--purple);
}

.neo-textarea-mono,
.neo-input-mono {
  font-family: var(--font-mono);
  font-size: 13.5px;
}

/* Stat Box Component */
.stat-box {
  background: var(--paper-card);
  border: var(--border-main);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
  text-align: center;
}

.stat-box-num {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 800;
  color: var(--purple);
}

.stat-box-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Progress Bar Component */
.progress-bar-container {
  margin-top: 12px;
}

.progress-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.progress-bar-track {
  height: 10px;
  border: var(--border-thin);
  border-radius: var(--radius-pill);
  background: var(--paper);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--purple);
  border-radius: var(--radius-pill);
  transition: width 200ms ease, background 200ms ease;
}

.progress-bar-fill.warning {
  background: var(--orange);
}

.progress-bar-fill.danger {
  background: #ff3b30;
}

/* Toast Notification System */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast-neo {
  pointer-events: auto;
  background: var(--ink);
  color: #ffffff;
  border: var(--border-main);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 14px;
  animation: toastSlideIn 250ms var(--ease-neo);
}

.toast-neo-icon {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-pill);
  background: var(--mint);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}

@keyframes toastSlideIn {
  from {
    transform: translateY(20px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Canvas & Image Workspace */
.canvas-preview-box {
  background: var(--paper-card);
  border: var(--border-main);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.canvas-preview-box canvas {
  max-width: 100%;
  height: auto;
  border: var(--border-thin);
  border-radius: var(--radius-sm);
}

/* Quick Action Toolbar */
.action-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Hero Headline Rotator — CSS Grid Stack Overlay (0px Shift Guarantee) */
.hero-rotator-h1 {
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  gap: 0.18em;
  line-height: 1.25;
  width: 100%;
}

.dynamic-rotator-wrapper {
  display: inline-grid;
  grid-template-columns: 1fr;
  align-items: center;
  justify-items: start;
  line-height: 1;
}

.rotator-item {
  grid-area: 1 / 1;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 300ms var(--ease-neo), transform 300ms var(--ease-neo), visibility 300ms var(--ease-neo);
  pointer-events: none;
  white-space: nowrap;
}

.rotator-item.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

/* ==========================================================================
   MOBILE & RESPONSIVE ADVANCED OVERRIDES (CONSOLIDATED)
   ========================================================================== */

/* ─── Breakpoint: ≤ 768px (Tablet & Small Desktop) ─── */
@media (max-width: 768px) {
  /* Category Pills Horizontal Scroll */
  .category-pills {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start !important;
    padding-bottom: 8px !important;
    margin-top: 16px !important;
    margin-inline: -12px !important;
    padding-inline: 12px !important;
    scrollbar-width: none;
  }
  .category-pills::-webkit-scrollbar {
    display: none;
  }
  .category-pill {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    padding: 7px 14px !important;
    font-size: 12.5px !important;
  }

  /* Modal Workspace Overlay */
  .modal-overlay {
    padding: 8px !important;
  }
  .modal-container {
    width: 100% !important;
    max-height: 94vh !important;
    border-radius: var(--radius-lg) !important;
  }
  .modal-header {
    padding: 12px 16px !important;
  }
  .modal-title-group {
    gap: 10px !important;
  }
  .modal-title-group h2 {
    font-size: 16px !important;
    line-height: 1.25 !important;
  }
  .modal-close-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 16px !important;
    flex-shrink: 0 !important;
  }
  .modal-body {
    padding: 16px 14px !important;
  }
  .tool-grid-layout {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  canvas {
    max-width: 100% !important;
    height: auto !important;
  }
  .canvas-preview-box {
    padding: 14px !important;
  }

  /* Feature Bar */
  .feature-bar-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .feature-bar-item {
    padding: 10px 14px !important;
    justify-content: flex-start !important;
  }
  .feature-bar-divider {
    border-left: none !important;
    border-right: none !important;
    border-top: 1.5px dashed var(--line);
    border-bottom: 1.5px dashed var(--line);
    padding-block: 12px !important;
  }
}

/* ─── Breakpoint: ≤ 640px (Mobile) ─── */
@media (max-width: 640px) {
  /* Header Navigation */
  header .shell {
    height: 60px !important;
  }
  .wordmark {
    font-size: 18px !important;
  }
  .brand-subtag {
    font-size: 10px !important;
    padding: 2px 6px !important;
  }
  .hide-mobile {
    display: none !important;
  }

  /* Hero Section & Rotator */
  .section-spacer {
    padding-top: 28px !important;
    padding-bottom: 24px !important;
  }
  .hero-rotator-h1 {
    flex-direction: column !important;
    gap: 6px !important;
    font-size: 27px !important;
    text-align: center !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1.25 !important;
    white-space: normal !important;
  }
  .dynamic-rotator-wrapper {
    display: inline-grid !important;
    justify-items: center !important;
  }
  .rotator-item {
    text-align: center !important;
  }
  .text-sub {
    font-size: 15px !important;
    margin-bottom: 20px !important;
  }

  /* Search Box */
  .hero-search-box {
    padding: 10px 14px !important;
    max-width: 100% !important;
    gap: 8px !important;
  }
  .hero-search-input {
    font-size: 15px !important;
  }

  /* Tool Catalog Cards */
  .grid-3 {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .tool-card {
    padding: 18px 16px !important;
  }
  .tool-card-body h3 {
    font-size: 17px !important;
  }
  .tool-card-body p {
    font-size: 13px !important;
    margin-bottom: 14px !important;
  }
}

/* Feature Bar Base Styles */
.feature-bar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  gap: 24px;
}

.feature-bar-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.feature-bar-item:hover {
  transform: translateY(-2px);
  background: var(--paper);
}

.feature-bar-divider {
  border-left: 1.5px dashed var(--line);
  border-right: 1.5px dashed var(--line);
}

.feature-bar-icon {
  font-size: 28px;
  transition: transform 250ms var(--ease-neo);
}

.feature-bar-item:hover .feature-bar-icon {
  transform: scale(1.25) rotate(6deg);
}

.feature-bar-title {
  font-size: 15px;
  font-weight: 800;
  display: block;
  color: var(--ink);
}

/* Keyboard Matrix Styling */
.keyboard-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.kb-row {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.kb-key {
  height: 42px;
  min-width: 38px;
  padding: 0 8px;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 var(--ink);
  user-select: none;
  transition: all 100ms ease;
}

.kb-key.tested {
  background: var(--purple-light);
  color: var(--purple);
  border-color: var(--purple);
}

.kb-key.active {
  background: var(--mint);
  color: var(--ink);
  transform: translateY(2px);
  box-shadow: 0 0 0 var(--ink);
}

.kb-key.wide-15 { min-width: 58px; }
.kb-key.wide-20 { min-width: 78px; }
.kb-key.wide-25 { min-width: 98px; }
.kb-key.wide-space { flex: 1; max-width: 320px; }

/* Signature Pad Workspace */
.sig-pad-wrapper {
  position: relative;
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  touch-action: none;
}

.sig-pad-canvas {
  width: 100%;
  height: 260px;
  display: block;
  cursor: crosshair;
  background: #ffffff;
}

.sig-pad-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
}

/* Countdown Flip Cards */
.countdown-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.countdown-box {
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 16px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.countdown-num {
  font-size: 32px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--purple);
  line-height: 1.1;
}

.countdown-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* BMI Meter Gauge */
.bmi-meter-track {
  height: 18px;
  border-radius: 9px;
  background: linear-gradient(to right, #38bdf8 0%, #38bdf8 25%, #22c55e 25%, #22c55e 55%, #eab308 55%, #eab308 70%, #ef4444 70%, #ef4444 85%, #991b1b 85%, #991b1b 100%);
  position: relative;
  margin: 18px 0 10px 0;
  border: 2px solid var(--ink);
}

.bmi-meter-needle {
  position: absolute;
  top: -8px;
  width: 6px;
  height: 34px;
  background: var(--ink);
  border-radius: 3px;
  transform: translateX(-50%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: left 300ms ease;
}

/* Age Life Stats Grid */
.age-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.age-stat-card {
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  box-shadow: 2px 2px 0 var(--ink);
}

.age-stat-val {
  font-size: 18px;
  font-weight: 900;
  font-family: var(--font-mono);
  color: var(--purple);
}

.age-stat-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* Proxy Checker Suite */
.proxy-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.proxy-summary-card {
  background: var(--paper-card);
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  box-shadow: 2px 2px 0 var(--ink);
}

.proxy-summary-val {
  font-size: 24px;
  font-weight: 900;
  font-family: var(--font-mono);
  line-height: 1.1;
}

.proxy-summary-lbl {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-top: 4px;
}

.proxy-table-wrapper {
  max-height: 380px;
  overflow-y: auto;
  border: 2px solid var(--ink);
  border-radius: var(--radius-md);
  background: var(--paper-card);
  box-shadow: 3px 3px 0 var(--ink);
}

.proxy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}

.proxy-table th {
  position: sticky;
  top: 0;
  background: var(--paper-card);
  border-bottom: 2px solid var(--ink);
  padding: 10px 12px;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  z-index: 2;
}

.proxy-table td {
  padding: 8px 12px;
  border-bottom: 1px dashed var(--line);
  vertical-align: middle;
}

.proxy-table tr:hover td {
  background: rgba(124, 58, 237, 0.05);
}

.proxy-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 800;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--ink);
}

.proxy-status-live {
  background: var(--mint);
  color: #064e3b;
}

.proxy-status-dead {
  background: var(--pink);
  color: #881337;
}

.proxy-progress-bar-track {
  height: 8px;
  background: var(--line);
  border-radius: 4px;
  overflow: hidden;
  margin: 10px 0;
  border: 1px solid var(--ink);
}

.proxy-progress-bar-fill {
  height: 100%;
  background: var(--purple);
  width: 0%;
  transition: width 150ms ease;
}
