/* UnitsSwitch Custom Theme Design System */

:root {
  /* Font Family */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Transition durations */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.15);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
}

/* DARK THEME (DEFAULT) */
[data-theme="dark"] {
  --bg-app: #0b0f19;
  --bg-sidebar: #0f1524;
  --bg-card: rgba(22, 30, 47, 0.7);
  --bg-card-hover: rgba(26, 36, 56, 0.9);
  --bg-input: #111827;
  --bg-input-hover: #1f2937;
  --border-color: rgba(55, 65, 81, 0.4);
  --border-color-hover: rgba(99, 102, 241, 0.4);
  
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-inverse: #0b0f19;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  --primary-glow: rgba(99, 102, 241, 0.4);
  
  --accent: #a855f7;
  --accent-light: rgba(168, 85, 247, 0.15);
  --accent-gradient: linear-gradient(135deg, #6366f1, #a855f7);
  
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.1);
  --error: #f43f5e;
  --error-light: rgba(244, 63, 94, 0.1);
  
  --backdrop-blur: blur(12px);
  --scrollbar-thumb: #1e293b;
  --scrollbar-track: #0b0f19;
}

/* LIGHT THEME */
[data-theme="light"] {
  --bg-app: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-input: #ffffff;
  --bg-input-hover: #f1f5f9;
  --border-color: rgba(226, 232, 240, 0.8);
  --border-color-hover: rgba(99, 102, 241, 0.3);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;
  
  --primary: #4f46e5;
  --primary-hover: #3730a3;
  --primary-light: rgba(79, 70, 229, 0.08);
  --primary-glow: rgba(79, 70, 229, 0.25);
  
  --accent: #9333ea;
  --accent-light: rgba(147, 51, 234, 0.08);
  --accent-gradient: linear-gradient(135deg, #4f46e5, #9333ea);
  
  --success: #059669;
  --success-light: rgba(5, 150, 105, 0.08);
  --error: #e11d48;
  --error-light: rgba(225, 29, 72, 0.08);
  
  --backdrop-blur: blur(12px);
  --scrollbar-thumb: #cbd5e1;
  --scrollbar-track: #f8fafc;
}

/* Reset Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  overflow-x: hidden;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

a {
  color: inherit;
  text-decoration: none;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* App Layout Grid */
.app-layout {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* Sidebar Layout (Desktop) */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform var(--transition-normal), background-color var(--transition-normal), border-color var(--transition-normal);
}

.sidebar-brand {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-brand .logo-icon {
  font-size: 1.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-brand .logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(to right, var(--text-main), var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav {
  padding: 1.25rem 0.75rem;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-item, .nav-item-sub {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.925rem;
  border-radius: var(--radius-md);
  margin-bottom: 0.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.nav-item-sub {
  padding-left: 1.25rem;
  font-size: 0.875rem;
}

.nav-item svg {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-item:hover, .nav-item-sub:hover {
  background-color: var(--primary-light);
  color: var(--primary);
}

.nav-item:hover svg {
  color: var(--primary);
}

.nav-item.active, .nav-item-sub.active {
  background-color: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.nav-item.active svg {
  color: var(--text-inverse);
}

.nav-divider {
  border: 0;
  height: 1px;
  background-color: var(--border-color);
  margin: 1.25rem 0.75rem;
}

.sidebar-section-title {
  padding: 0 0.85rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  opacity: 0.8;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

.offline-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot-online {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.dot-offline {
  background-color: var(--error);
  box-shadow: 0 0 8px var(--error);
}

/* Main Content Layout */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: relative;
}

/* App Header Styling */
.app-header {
  height: 70px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  background-color: rgba(11, 15, 25, 0.7);
  backdrop-filter: var(--backdrop-blur);
  z-index: 90;
  transition: border-color var(--transition-normal);
}

[data-theme="light"] .app-header {
  background-color: rgba(248, 250, 252, 0.7);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-grow: 1;
  max-width: 550px;
}

.menu-toggle-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  cursor: pointer;
}

/* Universal Search Engine Style */
.search-container {
  position: relative;
  flex-grow: 1;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
}

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

.search-container input {
  width: 100%;
  padding: 0.75rem 2.5rem 0.75rem 2.75rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: all var(--transition-fast);
}

.search-container input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-clear-btn {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.95rem;
}

.search-clear-btn:hover {
  color: var(--text-main);
}

.search-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  max-height: 350px;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
}

.suggestion-item {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: background-color var(--transition-fast);
}

.suggestion-item:hover, .suggestion-item.selected {
  background-color: var(--primary-light);
  color: var(--primary);
}

.suggestion-icon {
  font-size: 1.1rem;
}

.suggestion-details {
  display: flex;
  flex-direction: column;
}

.suggestion-title {
  font-weight: 500;
  font-size: 0.875rem;
}

.suggestion-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Header Buttons */
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle-btn, .header-pinned-btn {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all var(--transition-fast);
}

.theme-toggle-btn:hover, .header-pinned-btn:hover {
  border-color: var(--border-color-hover);
  background-color: var(--bg-card-hover);
  color: var(--primary);
}

.fav-count-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background-color: var(--primary);
  color: var(--text-inverse);
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Category Chips Nav Bar */
.category-chips-bar {
  padding: 1rem 2rem 0.5rem;
  flex-shrink: 0;
}

.chips-container {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: none; /* Firefox */
}

.chips-container::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

.chip {
  padding: 0.5rem 1rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.chip:hover {
  border-color: var(--border-color-hover);
  color: var(--text-main);
}

.chip.active {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* View Container Style */
.content-viewport {
  flex-grow: 1;
  padding: 1rem 2rem 2rem;
  overflow-y: auto;
  position: relative;
}

.app-view {
  display: none;
  animation: fadeIn var(--transition-normal);
}

.app-view.active {
  display: block;
}

/* Animation Keys */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Hero Section */
.hero-section {
  background: var(--accent-gradient);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
  color: var(--text-inverse);
  box-shadow: var(--shadow-lg);
}

.hero-section::before {
  content: '';
  position: absolute;
  right: -50px;
  bottom: -50px;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 70%);
  pointer-events: none;
}

.hero-content {
  max-width: 650px;
}

.hero-content h1 {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.75rem;
  letter-spacing: -0.025em;
  color: #ffffff;
}

.hero-content p {
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 0.9;
  margin-bottom: 1.5rem;
  color: #e0e7ff;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
}

.hero-dismiss {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: #ffffff;
  opacity: 0.6;
  cursor: pointer;
  font-size: 1rem;
  transition: opacity var(--transition-fast);
}

.hero-dismiss:hover {
  opacity: 1;
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.btn-primary {
  background-color: var(--primary);
  color: var(--text-inverse);
  box-shadow: 0 4px 10px var(--primary-glow);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

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

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

.btn-full {
  width: 100%;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-icon-sm:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Dashboard Sections & Grid */
.dashboard-section {
  margin-bottom: 2.5rem;
}

.section-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.tools-count-indicator {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* Tool Card Component */
.tool-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 180px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.tool-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.tool-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.tool-card-icon {
  font-size: 1.75rem;
  background-color: var(--bg-input);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.tool-card-pin {
  background: none;
  border: none;
  color: var(--text-muted);
  opacity: 0.3;
  cursor: pointer;
  padding: 4px;
  transition: all var(--transition-fast);
}

.tool-card:hover .tool-card-pin, .tool-card-pin.pinned {
  opacity: 1;
}

.tool-card-pin.pinned {
  color: #fbbf24;
}

.tool-card-body {
  margin-top: 1rem;
}

.tool-card-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.tool-card-desc {
  font-size: 0.775rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Active Tool Workspaces Header */
.tool-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

.back-to-dashboard-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.back-to-dashboard-btn:hover {
  color: var(--primary);
}

.tool-header-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-tool-action {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-main);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-tool-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-tool-action.pinned svg {
  fill: #fbbf24;
  stroke: #fbbf24;
}

/* Tool Panel Details layout */
.tool-panel {
  max-width: 720px;
  margin: 0 auto;
}

.tool-info {
  margin-bottom: 1.5rem;
}

.tool-info h3 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.tool-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.converter-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

/* Form Controls System */
.input-group-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.input-field-wrapper, .result-field-wrapper {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.input-field-wrapper label, .result-field-wrapper label {
  font-size: 0.775rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.input-field-wrapper input, .input-field-wrapper select, .select-field {
  width: 100%;
  padding: 0.85rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  color: var(--text-main);
  font-size: 1rem;
  font-weight: 500;
  outline: none;
  transition: all var(--transition-fast);
}

.input-field-wrapper input:focus, .input-field-wrapper select:focus, .select-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.swap-action-row {
  display: flex;
  justify-content: center;
  margin: 1.25rem 0;
}

.swap-units-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-input);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-normal);
}

.swap-units-btn:hover {
  transform: rotate(180deg);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.display-result-box {
  width: 100%;
  padding: 0.85rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  word-break: break-all;
  min-height: 48px;
}

.result-copy-bar {
  margin-top: 1.5rem;
}

/* Split-layout result cards (Finance/BMI) */
.flex-card-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 2rem;
  padding: 1.5rem;
}

.card-left-inputs {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card-right-results {
  border-radius: var(--radius-md);
  padding: 1.5rem;
  color: var(--text-inverse);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-md);
}

.accent-gradient-bg {
  background: var(--accent-gradient);
}

[data-theme="light"] .card-right-results {
  color: #ffffff;
}

.result-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.summary-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.summary-sublabel {
  font-size: 0.725rem;
  opacity: 0.85;
}

.summary-value {
  font-weight: 800;
  font-size: 1.35rem;
}

.summary-divider {
  border: 0;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.2);
}

.result-summary-row.highlight .summary-label {
  font-size: 1.1rem;
}

.result-summary-row.highlight .summary-value {
  font-size: 1.85rem;
  font-weight: 800;
}

/* Slider Style */
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
  margin: 0.5rem 0;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.preset-chips {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.preset-chip {
  flex: 1;
  padding: 0.35rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
}

.preset-chip.active {
  background-color: var(--primary);
  color: var(--text-inverse);
  border-color: var(--primary);
}

/* Counter Inputs */
.counter-input {
  display: flex;
  align-items: center;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2px;
}

.counter-input input {
  border: none;
  background: none;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  width: 100%;
}

.counter-input input:focus {
  box-shadow: none;
}

.form-row {
  display: flex;
  gap: 1rem;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.checkbox-row label {
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Results Tiles grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.result-tile {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1rem;
  text-align: center;
}

.result-tile-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.result-tile-label {
  font-size: 0.725rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
}

/* Editor Style (JSON / Code tools) */
.editor-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  height: 500px;
}

.editor-header {
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  background-color: rgba(0, 0, 0, 0.05);
}

.editor-actions-left, .editor-actions-right {
  display: flex;
  gap: 0.5rem;
}

.editor-body {
  flex-grow: 1;
  position: relative;
}

.editor-body textarea {
  width: 100%;
  height: 100%;
  border: none;
  background-color: var(--bg-input);
  color: var(--text-main);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 1.25rem;
  outline: none;
  resize: none;
}

.editor-footer {
  padding: 0.65rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.idle { background-color: var(--text-muted); }
.status-indicator.success { background-color: var(--success); box-shadow: 0 0 6px var(--success); }
.status-indicator.error { background-color: var(--error); box-shadow: 0 0 6px var(--error); }

/* Split editor (Base64 / URL) */
.editor-body-split {
  display: flex;
  flex-grow: 1;
  height: 100%;
}

.editor-half {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.half-header {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  background-color: rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid var(--border-color);
}

.half-header.flex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.editor-half textarea {
  flex-grow: 1;
  width: 100%;
  border: none;
  background-color: var(--bg-input);
  color: var(--text-main);
  padding: 1rem;
  outline: none;
  resize: none;
  font-family: var(--font-sans);
  font-size: 0.95rem;
}

.editor-half:first-of-type {
  border-right: 1px solid var(--border-color);
}

.editor-middle-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
  background-color: rgba(0, 0, 0, 0.02);
  border-right: 1px solid var(--border-color);
}

/* Timezone additions */
.timezone-targets-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.timezone-targets-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tz-target-row {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  animation: fadeIn var(--transition-fast);
}

.tz-target-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tz-target-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.tz-target-time {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
}

.tz-target-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* BMI specifics */
.toggle-switch-wrapper {
  display: flex;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
}

.toggle-switch-wrapper .toggle-btn {
  flex: 1;
  padding: 0.5rem;
  font-size: 0.8rem;
  background: none;
  color: var(--text-muted);
  border: none;
  box-shadow: none;
}

.toggle-switch-wrapper .toggle-btn.active {
  background-color: var(--primary);
  color: var(--text-inverse);
}

.split-input-row {
  display: flex;
  gap: 0.5rem;
}

.bmi-score-container {
  text-align: center;
}

.bmi-score-label {
  font-size: 0.85rem;
  opacity: 0.9;
}

.bmi-score-value {
  font-size: 2.75rem;
  font-weight: 800;
  margin: 0.25rem 0;
}

.bmi-status-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  font-weight: 700;
  background-color: rgba(255,255,255,0.2);
}

.bmi-range-visual {
  margin: 1rem 0;
}

.bmi-range-bar {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(to right, #60a5fa 0%, #34d399 35%, #fbbf24 65%, #f87171 100%);
  position: relative;
}

.bmi-indicator {
  width: 14px;
  height: 14px;
  background-color: #ffffff;
  border: 2.5px solid var(--primary);
  border-radius: 50%;
  position: absolute;
  top: -3px;
  transform: translateX(-50%);
  box-shadow: var(--shadow-md);
}

.bmi-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.725rem;
  margin-top: 0.35rem;
  opacity: 0.85;
}

.bmi-feedback {
  font-size: 0.8rem;
  line-height: 1.4;
  opacity: 0.9;
  text-align: center;
}

/* File Converter design */
.file-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  background-color: rgba(0,0,0,0.02);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
}

.file-dropzone:hover, .file-dropzone.dragover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.drop-icon {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.file-dropzone:hover .drop-icon {
  color: var(--primary);
}

.dropzone-prompt .primary-text {
  font-weight: 600;
  font-size: 0.975rem;
}

.dropzone-prompt .browse-link {
  color: var(--primary);
  text-decoration: underline;
}

.dropzone-prompt .secondary-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.selected-file-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-top: 1.25rem;
  animation: fadeIn var(--transition-fast);
}

.file-meta-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.file-icon-badge {
  font-size: 1.5rem;
  background-color: var(--bg-card);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-text-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.file-name-display {
  font-weight: 600;
  font-size: 0.9rem;
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size-display {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-clear-file {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
}

.btn-clear-file:hover {
  color: var(--error);
}

.conversion-settings-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 1.5rem;
  gap: 1.5rem;
  animation: fadeIn var(--transition-fast);
}

.conversion-settings-row .settings-group {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.conversion-settings-row .settings-group label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Progress bar inside file converter */
.conversion-progress-box {
  margin-top: 1.5rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.progress-pct-text {
  color: var(--primary);
}

.progress-bar-container {
  height: 8px;
  background-color: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width var(--transition-fast);
}

.progress-subtext {
  font-size: 0.725rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Success layout inside file converter */
.conversion-success-box {
  margin-top: 1.5rem;
  border: 1px solid var(--success);
  background-color: var(--success-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.success-icon-badge {
  background-color: var(--success);
  color: #ffffff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(16,185,129,0.3);
}

.success-message-text h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.success-message-text p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.success-actions {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
}

/* Desktop Split Right side Drawer/Widget Panel */
.side-panel {
  width: 320px;
  border-left: 1px solid var(--border-color);
  background-color: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 80;
  transition: all var(--transition-normal);
}

.side-panel.collapsed {
  display: none;
}

.side-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
}

.side-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 1.25rem 0.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  position: relative;
}

.side-tab:hover {
  color: var(--text-main);
}

.side-tab.active {
  color: var(--primary);
}

.side-tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 20%;
  right: 20%;
  height: 2px;
  background-color: var(--primary);
}

.side-panel-content {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1.25rem;
}

.side-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Sidebar lists elements styling */
.side-item-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.side-item-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.side-item-icon {
  font-size: 1.1rem;
}

.side-item-title {
  font-weight: 600;
  font-size: 0.825rem;
}

.side-item-sub {
  font-size: 0.725rem;
  color: var(--text-muted);
}

.btn-remove-item {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px;
}

.btn-remove-item:hover {
  color: var(--error);
}

/* History Card items */
.history-card-item {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  animation: fadeIn var(--transition-fast);
}

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

.history-left {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.history-tool-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
}

.history-expr {
  font-weight: 600;
  font-size: 0.95rem;
}

.history-date {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Toast alert popup */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  opacity: 1;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  pointer-events: none;
}

/* PWA banner popup */
.pwa-banner {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  max-width: 450px;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 999;
  animation: slideUp var(--transition-normal);
}

.pwa-banner.hidden {
  display: none !important;
}

.pwa-banner-content {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.pwa-icon {
  font-size: 1.5rem;
  background-color: var(--primary-light);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pwa-banner-content h4 {
  font-size: 0.875rem;
  font-weight: 700;
}

.pwa-banner-content p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pwa-banner-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Empty State Styling */
.empty-state-view {
  text-align: center;
  padding: 4rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 400px;
  margin: 0 auto;
}

.empty-icon {
  font-size: 3rem;
  opacity: 0.7;
}

.empty-state-view h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.empty-state-view p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

/* Mobile Bottom Nav Bar Styling */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background-color: var(--bg-sidebar);
  border-top: 1px solid var(--border-color);
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 600;
  flex: 1;
  height: 100%;
}

.mobile-nav-item svg {
  color: var(--text-muted);
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active svg {
  color: var(--primary);
}

/* ==========================================================================
   MEDIA QUERIES (MOBILE FIRST SYSTEM)
   ========================================================================== */

/* Up to 1024px: collapse side panel drawer */
@media (max-width: 1024px) {
  .side-panel {
    display: none;
  }
}

/* Mobile devices (widths up to 768px) */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }
  
  .sidebar {
    display: none; /* hidden, bottom nav or menu toggle instead */
  }
  
  .sidebar.active {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 260px;
    z-index: 200;
    animation: fadeIn var(--transition-fast);
  }
  
  .menu-toggle-btn {
    display: block;
  }
  
  .app-header {
    padding: 0 1rem;
  }
  
  .category-chips-bar {
    padding: 0.75rem 1rem 0.25rem;
  }
  
  .content-viewport {
    padding: 0.75rem 1rem 80px; /* leaves room for bottom nav */
  }
  
  .hero-section {
    padding: 1.5rem;
  }
  
  .hero-content h1 {
    font-size: 1.35rem;
  }
  
  .hero-content p {
    font-size: 0.85rem;
  }
  
  .flex-card-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .editor-card {
    height: 400px;
  }
  
  .editor-body-split {
    flex-direction: column;
  }
  
  .editor-half:first-of-type {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .editor-middle-actions {
    flex-direction: row;
    padding: 0.5rem;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .conversion-settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  
  .mobile-nav {
    display: flex;
  }
  
  .pwa-banner {
    bottom: 75px;
    left: 1rem;
    right: 1rem;
  }
}

/* SEO Guide Sections styling */
.seo-guide-section {
  margin-top: 2.5rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-md);
}

.seo-guide-section h4 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 0.75rem;
  letter-spacing: 0.025em;
}

.seo-guide-section p {
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.seo-guide-section ul {
  font-size: 0.85rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.formulas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.formula-card {
  padding: 0.75rem 1rem;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-main);
  text-align: center;
}

/* Utility classes */
.hidden {
  display: none !important;
}

