/* ================================ */
/*  RESET                           */
/* ================================ */

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

html {
  overflow: hidden;
  height: 100%;
}

body {
  height: 100%;
  overflow: hidden;
  background-color: #111;
  color: #e0e0e0;
  font-family: 'Inter', sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ================================ */
/*  LAYOUT                          */
/* ================================ */

.layout {
  display: flex;
  height: 100%;
}

/* ================================ */
/*  SIDEBAR                         */
/* ================================ */

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background-color: #151515;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
}

.sidebar__header {
  padding: 0 24px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar__logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}

.sidebar__tagline {
  font-size: 0.6875rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 1px;
  margin-top: 4px;
}

.sidebar__search {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  position: relative;
  display: flex;
  align-items: center;
}

.sidebar__search-icon {
  position: absolute;
  left: 22px;
  color: rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.sidebar__search-input {
  width: 100%;
  padding: 8px 10px 8px 32px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #e0e0e0;
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  outline: none;
  transition: border-color 0.25s ease;
}

.sidebar__search-input::placeholder {
  color: rgba(255, 255, 255, 0.15);
}

.sidebar__search-input:focus {
  border-color: rgba(255, 255, 255, 0.15);
}

.sidebar__nav {
  flex: 1;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.sidebar__nav::-webkit-scrollbar { display: none; }
.sidebar__nav { -ms-overflow-style: none; scrollbar-width: none; }

.sidebar__section {
  font-size: 0.5625rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.15);
  letter-spacing: 2px;
  text-transform: uppercase;
  padding: 14px 12px 6px;
  user-select: none;
}

.sidebar__nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  font-size: 0.6875rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.3px;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.sidebar__nav-item:hover {
  color: rgba(255, 255, 255, 0.75);
  background-color: rgba(255, 255, 255, 0.04);
}

.sidebar__nav-item--active {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.07);
}

.sidebar__nav-item--hidden { display: none; }

.sidebar__nav-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.25s ease;
}

.sidebar__nav-item:hover .sidebar__nav-icon,
.sidebar__nav-item--active .sidebar__nav-icon {
  opacity: 0.9;
}

.sidebar__no-results {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.12);
  padding: 12px;
  text-align: center;
}

.sidebar__footer {
  padding: 12px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar__about-btn {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.2);
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  cursor: pointer;
  text-align: left;
  letter-spacing: 1px;
  transition: color 0.25s ease;
}

.sidebar__about-btn:hover { color: rgba(255, 255, 255, 0.55); }

/* ================================ */
/*  MAIN                            */
/* ================================ */

.main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 48px;
  overflow-y: auto;
}

.main::-webkit-scrollbar { display: none; }
.main { -ms-overflow-style: none; scrollbar-width: none; }

.main__empty {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  width: 100%;
}

.main__empty-text {
  font-size: 0.875rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.12);
  letter-spacing: 1px;
}

/* ================================ */
/*  TOOL VIEW                       */
/* ================================ */

.tool-view {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.3s ease;
}

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

.tool-view__header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tool-view__title {
  font-weight: 600;
  font-size: 1.125rem;
  color: #fff;
}

.tool-view__desc {
  font-size: 0.75rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.3);
  line-height: 1.6;
}

.tool-view__content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ================================ */
/*  FORM                            */
/* ================================ */

.tv__label {
  font-size: 0.5625rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.tv__input {
  width: 100%;
  padding: 10px 12px;
  background-color: #0e0e0e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.tv__input::placeholder { color: rgba(255, 255, 255, 0.12); }
.tv__input:focus { border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 0 12px rgba(255, 255, 255, 0.02); }

.tv__textarea {
  width: 100%;
  padding: 10px 12px;
  background-color: #0e0e0e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  outline: none;
  resize: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.tv__textarea::placeholder { color: rgba(255, 255, 255, 0.12); }
.tv__textarea:focus { border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 0 12px rgba(255, 255, 255, 0.02); }
.tv__textarea--readonly { color: rgba(255, 255, 255, 0.4); cursor: default; }

.tv__btn {
  padding: 10px 16px;
  background-color: #fff;
  border: none;
  color: #111;
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: box-shadow 0.3s ease, transform 0.15s ease;
}

.tv__btn:hover { box-shadow: 0 0 16px rgba(255, 255, 255, 0.12), 0 0 40px rgba(255, 255, 255, 0.04); }
.tv__btn:active { transform: scale(0.98); }

.tv__btn--secondary {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
}

.tv__btn--secondary:hover {
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  background-color: transparent;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.03);
}

.tv__btn--hidden { display: none; }

.tv__message {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.25);
  min-height: 1.1em;
}

.tv__message--error {
  color: rgba(255, 255, 255, 0.7);
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.1);
}

.tv__output-area {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 20px;
}

.tv__output-area canvas,
.tv__output-area img { display: block; }

/* Toggle */
.tv__toggle {
  display: flex;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px;
  gap: 2px;
}

.tv__toggle-option {
  flex: 1;
  text-align: center;
  padding: 7px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.2);
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.25s ease, background-color 0.25s ease;
}

.tv__toggle-option:hover { color: rgba(255, 255, 255, 0.5); }
.tv__toggle-option--active { background-color: #fff; color: #111; }
.tv__toggle-option--active:hover { color: #111; }

/* Select */
.tv__select {
  width: 100%;
  padding: 10px 12px;
  background-color: #0e0e0e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='white' stroke-opacity='0.3' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.3s ease;
}

.tv__select:focus { border-color: rgba(255, 255, 255, 0.2); }
.tv__select option { background-color: #1a1a1a; color: #e0e0e0; }

.tv__stats {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.35);
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.9;
}

/* ================================ */
/*  COLOR CONVERTER                 */
/* ================================ */

/* Input row */
.tv__input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.tv__input-row .tv__input {
  flex: 1;
  min-width: 0;
}

/* Color swatch button */
.tv__color-swatch {
  width: 42px;
  flex-shrink: 0;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background-color: #ffffff;
  cursor: pointer;
  transition: border-color 0.25s ease;
  overflow: hidden;
}

.tv__color-swatch:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

/* Native color picker — invisible overlay */
.tv__color-picker-native {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none;
  padding: 0;
}

/* Color preview bar */
.tv__color-preview {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: none;
  transition: background-color 0.2s ease;
}

/* Separator */
.tv__separator {
  border: none;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.06);
  margin: 4px 0;
}

/* Image picker area */
.tv__image-drop {
  border: 1px dashed rgba(255, 255, 255, 0.1);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.25s ease, background-color 0.25s ease;
  position: relative;
}

.tv__image-drop:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background-color: rgba(255, 255, 255, 0.02);
}

.tv__image-drop--active {
  border-color: rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.03);
}

.tv__image-drop__text {
  font-size: 0.6875rem;
  color: rgba(255, 255, 255, 0.2);
  pointer-events: none;
}

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

/* Canvas container */
.tv__canvas-wrap {
  position: relative;
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.tv__canvas-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

/* Picked color info bar */
.tv__picked-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
}

.tv__picked-swatch {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.tv__picked-text {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.45);
  font-family: 'JetBrains Mono', monospace;
}

/* Zoom lens */
.tv__lens {
  position: absolute;
  width: 80px;
  height: 80px;
  border: 2px solid rgba(255, 255, 255, 0.5);
  pointer-events: none;
  display: none;
  image-rendering: pixelated;
  z-index: 10;
}

.tv__lens-crosshair-h,
.tv__lens-crosshair-v {
  position: absolute;
  background-color: rgba(255, 255, 255, 0.4);
}

.tv__lens-crosshair-h {
  width: 100%;
  height: 1px;
  top: 50%;
  left: 0;
  transform: translateY(-0.5px);
}

.tv__lens-crosshair-v {
  width: 1px;
  height: 100%;
  top: 0;
  left: 50%;
  transform: translateX(-0.5px);
}

/* ================================ */
/*  ABOUT                           */
/* ================================ */

.about-view {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  animation: fadeIn 0.3s ease;
}

.about-view__logo {
  font-weight: 700;
  font-size: 1.375rem;
  color: #fff;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(255, 255, 255, 0.15);
}

.about-view__version {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 2px;
}

.about-view__text {
  font-size: 0.8125rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.3);
  line-height: 1.8;
  max-width: 260px;
}

.about-view__divider {
  width: 30px;
  height: 1px;
  background-color: rgba(255, 255, 255, 0.08);
  border: none;
}

.about-view__footer {
  font-size: 0.625rem;
  color: rgba(255, 255, 255, 0.1);
  letter-spacing: 1px;
}

/* ================================ */
/*  TOAST                           */
/* ================================ */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background-color: #fff;
  color: #111;
  padding: 10px 24px;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 2000;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.15), 0 0 50px rgba(255, 255, 255, 0.04);
}

.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

@media (max-width: 640px) {
  .sidebar {
    width: 52px;
    padding: 16px 0;
  }

  .sidebar__header {
    padding: 0 0 12px;
    text-align: center;
  }

  .sidebar__logo { font-size: 0.5rem; letter-spacing: 1px; }
  .sidebar__tagline, .sidebar__section, .sidebar__search { display: none; }
  .sidebar__nav { padding: 8px 4px; }
  .sidebar__nav-item { justify-content: center; padding: 10px 4px; }
  .sidebar__nav-label { display: none; }
  .sidebar__footer { padding: 8px 4px 0; }
  .sidebar__about-btn { text-align: center; font-size: 0.5rem; padding: 6px; }
  .main { padding: 24px 16px; }
  .tool-view { max-width: 100%; }
}