/* theme variables */
:root {
  --bg-primary: #08090d;
  --bg-secondary: #0f131a;
  --bg-card: rgba(18, 24, 38, 0.65);
  --bg-card-hover: rgba(26, 35, 54, 0.8);

  --accent-cyan: #00f2fe;
  --accent-blue: #4facfe;
  --accent-pink: #ff0844;
  --accent-orange: #ffb199;
  --accent-green: #00ff87;
  --accent-purple: #7000ff;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #0f172a;

  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 242, 254, 0.35);
  --border-focus: rgba(79, 172, 254, 0.8);

  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --spring-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

button {
  background: transparent;
  border: none;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  background: rgba(15, 22, 36, 0.85);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 0.2s ease;
  color-scheme: dark;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.12);
}

option {
  background: #0f131a;
  color: var(--text-main);
}

/* layout container */
html,
body {
  width: 100%;
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ambient effects */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  pointer-events: none;
  z-index: -10;
}

.bg-glow-1 {
  background: radial-gradient(circle, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  top: -10%;
  left: -10%;
  animation: blobDrift1 18s ease-in-out infinite alternate;
}

.bg-glow-2 {
  background: radial-gradient(circle, var(--accent-purple) 0%, var(--accent-pink) 100%);
  bottom: -10%;
  right: -10%;
  animation: blobDrift2 22s ease-in-out infinite alternate;
}

@keyframes blobDrift1 {
  from { transform: translate(0, 0) scale(1); opacity: 0.10; }
  to   { transform: translate(60px, 80px) scale(1.15); opacity: 0.15; }
}

@keyframes blobDrift2 {
  from { transform: translate(0, 0) scale(1); opacity: 0.10; }
  to   { transform: translate(-80px, -60px) scale(1.2); opacity: 0.14; }
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: rgba(8, 9, 13, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  height: 72px;
}

.header-brand-group {
  display: flex;
  align-items: center;
  gap: 20px;
  padding-left: 180px;
}

.app-header .dropdown-container {
  flex-shrink: 0;
  top: 10px;
}

.header-logo {
  display: flex;
  flex-direction: column;
}

.logo-text h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-main);
}

.logo-text h1 span {
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-top: -2px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 8px 14px;
  background: rgba(15, 22, 36, 0.85);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-md);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(79, 172, 254, 0.12);
}

select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}

.code-font {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}


.bttn-header {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.bttn-header:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.bttn-header.active {
  background: rgba(255, 242, 0, 0.1);
  border-color: rgba(255, 220, 0, 0.4);
}

.bttn-header.active .icon-star {
  fill: #ffd700;
  color: #ffd700;
}

.app-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.command-bar-section {
  width: 100%;
  position: relative;
  z-index: 10;
}

.command-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  background: rgba(15, 22, 36, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4px;
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(10px);
  transition: var(--transition);
}

.command-wrapper:focus-within {
  border-color: var(--accent-blue);
  box-shadow: 0 0 20px var(--border-glow);
}

.command-icon-box {
  padding: 12px 18px;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
}

.command-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 16px;
  color: var(--text-main);
  padding: 12px 0;
}

.command-input::placeholder {
  color: var(--text-muted);
}

.clear-command-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 10px;
  margin-right: 8px;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

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

.command-shortcut-hint {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-right: 14px;
  font-family: monospace;
  pointer-events: none;
}

.suggestions-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  background: rgba(15, 22, 36, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  max-height: 320px;
  overflow-y: auto;
  z-index: 1000;
  padding: 8px;
}

.suggestion-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.suggestion-item:hover,
.suggestion-item.active {
  background: rgba(255, 255, 255, 0.06);
}

.suggestion-query {
  font-weight: 500;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.suggestion-query strong {
  color: var(--accent-cyan);
}

.suggestion-category {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 20px;
}

.hide {
  display: none !important;
}

/* Workspace Split Layout */
.workspace-grid {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 24px;
  min-height: 600px;
}

.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  transition: transform 0.3s var(--spring-ease), box-shadow 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.categories-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-header h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.search-category-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-cat-icon {
  position: absolute;
  left: 12px;
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}

.cat-search-input {
  width: 100%;
  background: rgba(15, 22, 36, 0.5);
  border: 1px solid var(--border-color);
  padding: 10px 12px 10px 36px;
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  font-family: inherit;
  font-size: 13px;
  transition: var(--transition);
}

.cat-search-input:focus {
  border-color: var(--accent-blue);
  background: rgba(15, 22, 36, 0.8);
}

.categories-container {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 600px;
  padding-right: 4px;
}

.categories-container::-webkit-scrollbar,
.all-units-grid::-webkit-scrollbar,
.history-list::-webkit-scrollbar {
  width: 5px;
}

.categories-container::-webkit-scrollbar-track,
.all-units-grid::-webkit-scrollbar-track,
.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.categories-container::-webkit-scrollbar-thumb,
.all-units-grid::-webkit-scrollbar-thumb,
.history-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.categories-container::-webkit-scrollbar-thumb:hover,
.all-units-grid::-webkit-scrollbar-thumb:hover,
.history-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.category-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s var(--spring-ease);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: left;
  animation: categoryEntrance 0.35s var(--spring-ease) both;
}

@keyframes categoryEntrance {
  from {
    opacity: 0;
    transform: translateX(-15px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.category-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  transform: translateX(5px);
}

.category-item.active {
  background: linear-gradient(135deg, rgba(0, 242, 254, 0.12) 0%, rgba(79, 172, 254, 0.12) 100%);
  border-color: rgba(79, 172, 254, 0.35);
  color: var(--text-main);
  font-weight: 600;
  transform: translateX(5px) scale(1.02);
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.08);
}

.category-item svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s var(--spring-ease);
}

.category-item.active svg {
  color: var(--accent-cyan);
  transform: scale(1.2);
}

.category-item:hover svg {
  transform: scale(1.15) rotate(5deg);
}

.converter-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

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

.view-mode-toggle {
  display: flex;
  background: rgba(15, 22, 36, 0.6);
  border: 1px solid var(--border-color);
  padding: 4px;
  border-radius: var(--radius-md);
  position: relative;
  width: 320px;
}

.toggle-slider {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  transition: transform 0.3s var(--spring-ease);
  z-index: 1;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.view-mode-toggle:has(#view-mode-grid.active) .toggle-slider {
  transform: translateX(100%);
}

.toggle-btn {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: transparent !important;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.2s ease, transform 0.1s ease;
  flex: 1;
}

.toggle-btn:active {
  transform: scale(0.97);
}

.toggle-btn.active {
  color: var(--text-main);
}

.toggle-btn svg {
  width: 14px;
  height: 14px;
}

.converter-content {
  animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Classical Dual Layout */
.dual-converter-layout {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.converter-card {
  flex: 1;
  padding: 24px;
  position: relative;
  overflow: hidden;
  transform: none !important;
  transition: box-shadow 0.3s ease, border-color 0.3s ease !important;
}

.converter-card:hover {
  transform: none !important;
  box-shadow: 0 0 0 1px rgba(79, 172, 254, 0.15), 0 12px 36px rgba(0, 0, 0, 0.5) !important;
}

.converter-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--text-muted);
}

.highlighted-card::before {
  background: linear-gradient(to bottom, var(--accent-cyan), var(--accent-blue));
}

.card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 700;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.unit-input-field {
  background: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 2px solid var(--border-color);
  color: var(--text-main);
  font-family: 'JetBrains Mono', monospace;
  font-size: 2.2rem;
  font-weight: 600;
  padding: 8px 0;
  width: 100%;
  outline: none;
  box-shadow: none;
  transition: var(--transition);
}

.unit-input-field:focus {
  border-color: var(--accent-blue);
  box-shadow: none;
}

.unit-input-field.read-only {
  color: var(--accent-cyan);
  border-color: transparent;
}

/* Remove default arrows for numeric input */
.unit-input-field::-webkit-outer-spin-button,
.unit-input-field::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.unit-input-field[type=number] {
  -moz-appearance: textfield;
}

.unit-select-field {
  background: rgba(15, 22, 36, 0.8);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  outline: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.unit-select-field:focus {
  border-color: var(--accent-blue);
}

.unit-info-description {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
  min-height: 18px;
}

.swap-action-container {
  display: flex;
  align-items: center;
  justify-content: center;
}

.swap-btn-circle {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(15, 22, 36, 0.8);
  border: 1px solid var(--border-color);
  color: var(--accent-cyan);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: background 0.3s var(--spring-ease), color 0.3s ease, border-color 0.3s ease,
              transform 0.4s var(--spring-ease), box-shadow 0.3s ease;
}

.swap-btn-circle:hover {
  background: var(--text-main);
  color: var(--text-dark);
  transform: rotate(180deg) scale(1.1);
  border-color: var(--text-main);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.35), 0 0 40px rgba(0, 242, 254, 0.15);
}

.swap-btn-circle:active {
  transform: rotate(180deg) scale(0.93);
}

.swap-btn-circle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.4s var(--spring-ease);
}

.swap-btn-circle:hover svg {
  transform: rotate(-180deg);
}

.card-copy-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.card-copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.card-copy-btn svg {
  width: 12px;
  height: 12px;
}

.formula-box {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.formula-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 700;
}

.formula-header svg {
  width: 14px;
  height: 14px;
  color: var(--accent-blue);
}

.formula-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--accent-orange);
  background: rgba(0, 0, 0, 0.2);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  word-break: break-all;
  transition: opacity 0.25s ease, transform 0.25s var(--spring-ease);
}

.formula-display.updating {
  animation: formulaFade 0.35s var(--spring-ease);
}

@keyframes formulaFade {
  0%   { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}

.grid-helper-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-helper-text svg {
  width: 14px;
  height: 14px;
  color: var(--accent-cyan);
}

.all-units-grid-container {
  max-height: 520px;
  overflow-y: auto;
  padding-right: 6px;
}

.all-units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.grid-unit-card {
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid var(--glass-border);
  transition: var(--transition);
}

.grid-unit-card:focus-within,
.grid-unit-card:hover {
  border-color: var(--accent-blue);
  box-shadow: 0 4px 20px rgba(79, 172, 254, 0.15);
}

.grid-unit-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.grid-unit-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.grid-unit-symbol {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-transform: uppercase;
}

.grid-unit-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.grid-unit-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  padding: 8px 32px 8px 10px;
  outline: none;
  transition: var(--transition);
}

.grid-unit-card:focus-within .grid-unit-input {
  border-color: var(--accent-cyan);
  background: rgba(0, 0, 0, 0.4);
}

.grid-copy-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  transition: var(--transition);
}

.grid-copy-btn:hover {
  color: var(--text-main);
}

.grid-copy-btn svg {
  width: 14px;
  height: 14px;
}

.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.sidebar-panel .card {
  overflow: hidden;
  height: max-content;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  flex: 1;
  margin-left: 10px;
}

.card-header svg {
  width: 18px;
  height: 18px;
}

.icon-accent-blue {
  color: var(--accent-blue);
}

.icon-accent-cyan {
  color: var(--accent-cyan);
}

.icon-accent-pink {
  color: var(--accent-pink);
}

.card-body {
  padding: 16px 20px;
}

.sidebar-action-btn {
  background: transparent;
  border: none;
  color: var(--accent-pink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-action-btn:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.empty-state {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
  line-height: 1.5;
}

.favorites-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.fav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-blue);
}

.fav-item-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.fav-item-info svg {
  width: 14px;
  height: 14px;
  color: var(--accent-cyan);
}

.remove-fav-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: var(--transition);
}

.remove-fav-btn:hover {
  color: var(--accent-pink);
}

.remove-fav-btn svg {
  width: 14px;
  height: 14px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

.history-item {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-color);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--accent-cyan);
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
}

.history-item-math {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-from {
  color: var(--text-main);
  font-weight: 500;
}

.history-arrow {
  color: var(--accent-blue);
  padding: 0 4px;
}

.history-to {
  color: var(--accent-cyan);
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}

.quick-tip-content {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
}

.quick-tip-content code {
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  color: var(--accent-orange);
}

.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 22, 36, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent-cyan);
  color: var(--text-main);
  padding: 14px 24px;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 242, 254, 0.2);
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-notification svg {
  color: var(--accent-cyan);
  width: 20px;
  height: 20px;
}

.toast-notification span {
  font-size: 14px;
  font-weight: 600;
}

.footer {
  margin-top: auto;
  padding: 40px 0 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.footer a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: var(--transition);
}

.footer a:hover {
  text-decoration: underline;
  color: var(--accent-cyan);
}

@media (max-width: 1200px) {
  .workspace-grid {
    grid-template-columns: 240px 1fr;
  }

  .sidebar-panel {
    grid-column: span 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .info-panel-card {
    grid-column: span 2;
  }
}

@media (max-width: 900px) {
  .header-brand-group {
    gap: 100px;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-panel {
    grid-column: span 1;
    grid-template-columns: 1fr;
  }

  .info-panel-card {
    grid-column: span 1;
  }

  .categories-container {
    max-height: 200px;
  }

  .dual-converter-layout {
    flex-direction: column;
  }

  .swap-action-container {
    transform: rotate(90deg);
    padding: 8px 0;
  }
}

@media (max-width: 600px) {
  .app-header {
    flex-direction: column;
    height: auto;
    gap: 16px;
    padding: 16px;
  }

  .app-header .dropdown-container {
    position: static;
  }

  .header-brand-group {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    padding-left: 0;
  }

  .app-container {
    padding: 16px;
  }

  .toggle-btn {
    flex: 1;
    justify-content: center;
  }
}

/* Custom Calculator Extension Styles */

/* Color Space CSS layout */
.colorspace-layout {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 20px;
  margin-bottom: 20px;
}

.color-swatch-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
}

.color-swatch {
  width: 100%;
  height: 160px;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.color-picker-wrapper {
  margin-top: 20px;
  position: relative;
  width: 100%;
  text-align: center;
}

.color-picker-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.color-picker-label:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-blue);
}

.color-picker-field {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 38px;
  cursor: pointer;
}

.color-inputs-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.color-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.color-field-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.color-input-with-action {
  position: relative;
  display: flex;
}

.color-input-with-action .form-input {
  flex: 1;
  padding-right: 44px;
  font-size: 14px;
}

.code-font {
  font-family: 'JetBrains Mono', monospace !important;
}

.field-action-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  transition: var(--transition);
}

.field-action-btn:hover {
  color: var(--accent-cyan);
}

.color-sliders-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 20px;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.slider-header span:nth-child(2) {
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent-cyan);
}

.color-range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  outline: none;
  background: rgba(255, 255, 255, 0.05);
}

.color-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  border: 2px solid var(--accent-blue);
  transition: var(--transition);
}

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

.range-r {
  background: linear-gradient(to right, #000, #ff0844);
}

.range-g {
  background: linear-gradient(to right, #000, #00ff87);
}

.range-b {
  background: linear-gradient(to right, #000, #00f2fe);
}


/* IP Subnetting CSS layout */
.subnet-layout-card {
  padding: 24px;
}

.subnet-inputs {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.subnet-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subnet-field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.subnet-validation-error {
  color: #ff0844;
  background: rgba(255, 8, 68, 0.08);
  border: 1px solid rgba(255, 8, 68, 0.2);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

.subnet-results-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.15);
}

.subnet-result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  transition: var(--transition);
}

.subnet-result-row:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

.subnet-result-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.subnet-prop-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.subnet-prop-value {
  font-size: 14px;
  color: var(--text-main);
  font-weight: 600;
}


/* Download Duration Estimator widget */
.download-widget-card {
  padding: 24px;
  margin-top: 24px;
}

.download-widget-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.download-widget-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
}

.download-inputs-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.download-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.download-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.input-with-select {
  display: flex;
}

.input-with-select input {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-with-select select {
  border-left: none;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  width: 95px;
  text-align: center;
  background: rgba(20, 26, 40, 0.9);
  cursor: pointer;
}

.download-output-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  padding: 24px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-color);
  text-align: center;
}

.duration-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 700;
}

.duration-readout {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 1.5px;
  margin-bottom: 8px;
  text-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
}

.duration-description {
  font-size: 12px;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.5;
}


/* ============================================
   UTILITY
   ============================================ */
.hide {
  display: none !important;
}

/* ============================================
   COLOR SPACE CONVERTER VIEW
   ============================================ */
.colorspace-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.color-swatch-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  background: #00f2fe;
  box-shadow: 0 10px 40px rgba(0, 242, 254, 0.25);
  transition: background 0.25s ease, box-shadow 0.25s ease;
  min-height: 120px;
}

.color-picker-wrapper {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-picker-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.color-picker-field {
  width: 100%;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  cursor: pointer;
  padding: 2px;
}

.color-inputs-panel {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.color-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-field-group label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.color-input-with-action {
  display: flex;
  gap: 0;
}

.color-input-with-action input {
  flex: 1;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.field-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-left: none;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  color: var(--text-muted);
  padding: 0 12px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
}

.field-action-btn:hover {
  background: rgba(0, 242, 254, 0.1);
  color: var(--accent-cyan);
}

.color-sliders-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.slider-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.color-range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 99px;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.color-range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text-main);
  border: 3px solid rgba(0, 0, 0, 0.35);
  cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.range-r {
  background: linear-gradient(to right, #000, #ff0000);
}

.range-g {
  background: linear-gradient(to right, #000, #00ff00);
}

.range-b {
  background: linear-gradient(to right, #000, #0000ff);
}

/* ============================================
   IP SUBNET CALCULATOR VIEW
   ============================================ */
.subnet-layout-card {
  padding: 28px;
}

.subnet-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.subnet-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subnet-field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ============================================
   ADDITIONAL MEDIA QUERIES
   ============================================ */
@media (max-width: 900px) {
  .colorspace-layout {
    grid-template-columns: 1fr;
  }

  .subnet-inputs {
    grid-template-columns: 1fr;
  }

  .download-inputs-layout {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   PREMIUM ANIMATIONS & MICRO-INTERACTIONS
   ============================================ */

/* Page entrance reveals */
.app-header {
  animation: headerEntrance 0.5s var(--smooth-ease) both;
}

.command-bar-section {
  animation: slideDownEntrance 0.6s var(--spring-ease) both;
  animation-delay: 0.1s;
}

.categories-panel {
  animation: panelEntranceLeft 0.7s var(--smooth-ease) both;
  animation-delay: 0.15s;
}

.converter-panel {
  animation: panelEntranceCenter 0.7s var(--smooth-ease) both;
  animation-delay: 0.2s;
}

.sidebar-panel {
  animation: panelEntranceRight 0.7s var(--smooth-ease) both;
  animation-delay: 0.25s;
}

@keyframes headerEntrance {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes slideDownEntrance {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes panelEntranceLeft {
  from {
    transform: translateX(-30px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes panelEntranceCenter {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes panelEntranceRight {
  from {
    transform: translateX(30px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Swapping animations for Conversion Cards */
@keyframes swapSlideLeft {
  0% { transform: translateX(0) scale(1); opacity: 1; }
  50% { transform: translateX(calc(100% + 82px)) scale(0.96); opacity: 0.8; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes swapSlideRight {
  0% { transform: translateX(0) scale(1); opacity: 1; }
  50% { transform: translateX(calc(-100% - 82px)) scale(0.96); opacity: 0.8; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}

.swapping-left {
  animation: swapSlideLeft 0.5s var(--smooth-ease) both;
}

.swapping-right {
  animation: swapSlideRight 0.5s var(--smooth-ease) both;
}

/* Calculation result update text glow */
.unit-input-field.read-only {
  transition: text-shadow 0.3s ease, color 0.3s ease;
}

.unit-input-field.read-only.updated {
  animation: valuePulse 0.4s ease-out;
}

@keyframes valuePulse {
  0% {
    color: var(--accent-cyan);
    text-shadow: 0 0 0px rgba(0, 242, 254, 0);
  }
  30% {
    color: #fff;
    text-shadow: 0 0 15px var(--accent-cyan), 0 0 30px var(--accent-cyan);
  }
  100% {
    color: var(--accent-cyan);
    text-shadow: 0 0 0px rgba(0, 242, 254, 0);
  }
}

/* Grid input updates */
.grid-unit-input {
  transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

.grid-unit-input.updated {
  animation: gridInputPulse 0.4s ease-out;
}

@keyframes gridInputPulse {
  0% {
    box-shadow: 0 0 0 rgba(0, 242, 254, 0);
    border-color: var(--border-color);
  }
  30% {
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
    border-color: var(--accent-cyan);
  }
  100% {
    box-shadow: 0 0 0 rgba(0, 242, 254, 0);
    border-color: var(--border-color);
  }
}

/* Copied micro-interaction styling */
.card-copy-btn, .grid-copy-btn, .field-action-btn {
  transition: all 0.3s var(--spring-ease);
}

.card-copy-btn.copied, .grid-copy-btn.copied, .field-action-btn.copied {
  animation: copyPulse 0.5s var(--spring-ease);
  color: var(--accent-green) !important;
  border-color: rgba(0, 255, 135, 0.3) !important;
  background: rgba(0, 255, 135, 0.08) !important;
}

@keyframes copyPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Dynamic Cards stagger reveal for grid view */
.grid-unit-card {
  opacity: 0;
  animation: popInCard 0.4s var(--spring-ease) forwards;
}

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

/* Command Bar suggestions dropdown animated open */
.suggestions-dropdown:not(.hide) {
  animation: suggestionsSlideDown 0.35s var(--spring-ease) forwards;
  transform-origin: top center;
}

@keyframes suggestionsSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px) scaleY(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

/* Toast spring bounce override */
.toast-notification.show {
  animation: toastBounceIn 0.5s var(--spring-ease) forwards;
}

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

/* Favorites and History items entry / exit */
.fav-item, .history-item {
  animation: listItemEntrance 0.35s var(--spring-ease) both;
}

@keyframes listItemEntrance {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fav-item.removing, .history-item.removing {
  animation: listItemExit 0.35s var(--smooth-ease) forwards !important;
}

@keyframes listItemExit {
  from {
    opacity: 1;
    transform: scale(1) translateX(0);
    max-height: 80px;
    margin-bottom: 8px;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  to {
    opacity: 0;
    transform: scale(0.9) translateX(-30px);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-top: none;
    border-bottom: none;
  }
}

/* Header Dropdown Dark Mode Overrides */
.app-header .dropdown-menu {
  background: rgba(15, 22, 36, 0.95) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid var(--border-color) !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6) !important;
  transition: opacity 0.35s var(--spring-ease), transform 0.35s var(--spring-ease), visibility 0.35s !important;
}

.app-header .dropdown-category {
  color: var(--text-muted) !important;
  border-top-color: var(--border-color) !important;
}

.app-header .dropdown-item {
  color: var(--text-muted) !important;
  transition: all 0.25s var(--spring-ease) !important;
}

.app-header .dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--accent-cyan) !important;
  transform: translateX(6px) !important;
}

.app-header .dropdown-item svg {
  color: inherit !important;
}