@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap");

:root {
  --bg: #1d1e20;
  --card-bg: #2a2b2e;
  --card-hover: #333538;
  --text: #e6e6e6;
  --text-light: #ffffff;
  --text-muted: #b0b0b0;
  --accent: #ffd700;
  --accent-hover: #e6c200;
  --border: #333538;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  --transition: all 0.2s ease;
}

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

body {
  font-family: "Roboto", system-ui, sans-serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 0;
}

/* ---------- HEADER (compact, left+right) ---------- */
.header {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 0.75rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.main-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-light);
  letter-spacing: -0.5px;
  margin: 0;
  line-height: 1.2;
}

.main-title svg {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  stroke: var(--accent);
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0;
  font-weight: 400;
}

/* ---------- TOOLBAR / TABS ---------- */
.toolbar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0;
}

.tab-btn {
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: inherit;
}

.tab-btn:hover {
  border-color: var(--accent);
  color: var(--text-light);
}

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}

.tab-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- TAB CONTENT ---------- */
.tab-content {
  display: none;
  animation: fadeIn 0.25s ease;
}

.tab-content.active {
  display: block;
}

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

/* ---------- CARDS ---------- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.card-title svg {
  width: 20px;
  height: 20px;
  stroke: var(--accent);
}

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

.compact-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* ---------- COLOR CARDS ---------- */
.color-card {
  position: relative;
  height: 120px;
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.color-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.color-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.75);
  color: white;
  padding: 0.4rem;
  font-size: 0.8rem;
  text-align: center;
  font-family: "Roboto Mono", monospace;
  backdrop-filter: blur(4px);
}

/* ---------- IMAGE UPLOAD ---------- */
.image-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  transition: var(--transition);
  margin-bottom: 1rem;
}

.image-upload:hover {
  border-color: var(--accent);
  background: rgba(255, 215, 0, 0.05);
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

.upload-label p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.image-preview {
  width: 100%;
  max-height: 300px;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  display: none;
}

.image-preview img {
  width: 100%;
  height: auto;
  object-fit: contain;
  max-height: 300px;
}

/* ---------- CONTROLS ---------- */
.controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

button,
input[type="file"],
select {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 500;
  font-size: 0.85rem;
  font-family: inherit;
}

button {
  background: var(--accent);
  color: var(--bg);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

button:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

select,
input[type="text"],
.search-box {
  background: var(--card-bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  transition: var(--transition);
}

select:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
}

.search-box {
  flex: 1;
  min-width: 200px;
}

.search-box::placeholder {
  color: var(--text-muted);
}

/* ---------- SLIDERS ---------- */
input[type="range"] {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  -webkit-appearance: none;
  margin: 8px 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.slider-container {
  margin-bottom: 1rem;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.4rem 0;
}

.slider-label {
  min-width: 70px;
  color: var(--text);
  font-size: 0.85rem;
}

.value-display {
  min-width: 50px;
  padding: 0.3rem 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  text-align: center;
  font-family: "Roboto Mono", monospace;
  font-size: 0.8rem;
  color: var(--text-light);
}

.color-preview {
  width: 100%;
  height: 80px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  transition: var(--transition);
}

/* ---------- PALETTE GRID ---------- */
.palette-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.palette-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid var(--border);
  transition: var(--transition);
  position: relative;
  cursor: pointer;
}

.palette-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.palette-card::after {
  content: "Click to copy all colors";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.85);
  color: var(--text-light);
  padding: 0.4rem;
  text-align: center;
  font-size: 0.8rem;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: 0 0 var(--radius) var(--radius);
}

.palette-card:hover::after {
  opacity: 1;
}

.palette-colors {
  display: flex;
  height: 40px;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 0.75rem 0;
}

.palette-color {
  flex: 1;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}

.palette-color:hover {
  transform: scaleY(1.1);
}

.palette-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

/* ---------- COLOR TOOLS LAYOUT ---------- */
.color-tools-container {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.color-tools-container .card {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card-bg);
  color: var(--text-light);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.toast.visible {
  opacity: 1;
}

/* ---------- FOOTER (compact, matches header) ---------- */
.site-footer {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 0.75rem 1.5rem;
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer-logo:hover {
  color: var(--accent);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.footer-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: var(--transition);
  white-space: nowrap;
}

.footer-nav a:hover {
  color: var(--accent);
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.5rem;
  margin-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  gap: 0.25rem 0.5rem;
}

.footer-analytics {
  color: #666;
  font-size: 0.7rem;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .color-tools-container {
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 1rem 1rem 0;
  }

  .main-title {
    font-size: 1.5rem;
  }

  .color-card {
    height: 100px;
  }

  .grid,
  .compact-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    gap: 0.5rem;
  }

  button,
  input[type="file"],
  select {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }
  .header-left {
    align-items: center;
    text-align: center;
  }
  .toolbar {
    justify-content: center;
  }
  .main-title {
    font-size: 1.4rem;
  }

  .footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .footer-nav {
    justify-content: center;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}
