:root {
  --bg: #fafafa;
  --text: #1a1a1a;
  --text-soft: #666;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --border: #e5e7eb;
  --radius: 24px;
  --container: 1100px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

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

body { 
  font-family: 'Plus Jakarta Sans', sans-serif; 
  background-color: var(--bg); 
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: var(--container); margin: 0 auto; padding: 0 2rem; }

/* Navigation */
nav {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.nav-content { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 800; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 0.5rem; }
.logo span { color: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 2.5rem; }
.nav-item { position: relative; }
.nav-link { text-decoration: none; color: var(--text-soft); font-size: 0.9375rem; font-weight: 600; transition: color 0.2s; display: flex; align-items: center; gap: 0.35rem; }
.nav-link:hover, .nav-link.active { color: var(--text); }

/* Dropdown */
.dropdown {
  position: absolute;
  top: calc(100% + 1rem);
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  min-width: 240px;
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s var(--ease);
}
.nav-item:hover .dropdown { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.dropdown-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; text-decoration: none; color: var(--text); border-radius: 8px; transition: background 0.2s; }
.dropdown-item:hover { background: var(--bg); }
.dropdown-item .icon { font-size: 1.125rem; color: var(--accent); display: flex; align-items: center; }
.dropdown-item .title { font-weight: 700; font-size: 0.875rem; display: block; }
.dropdown-item .desc { font-size: 0.75rem; color: var(--text-soft); display: block; }

.nav-cta {
  padding: 0.7rem 1.5rem;
  background: var(--text);
  color: white;
  text-decoration: none;
  border-radius: 100px;
  font-weight: 700;
  font-size: 0.875rem;
  transition: all 0.2s;
}
.nav-cta:hover { opacity: 0.9; transform: translateY(-1px); }

/* Layout */
.main-layout { padding: 4rem 0 8rem; }
.tool-header { text-align: center; margin-bottom: 4rem; max-width: 800px; margin-inline: auto; }
.tool-header .badge {
  display: inline-block;
  padding: 0.35rem 1rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 100px;
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
}
.tool-header h1 { font-size: 3.5rem; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 1rem; }
.tool-header h1 span { color: var(--accent); }
.tool-header p { color: var(--text-soft); font-size: 1.125rem; }

/* Tool UI */
.extractor-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 16px;
  padding: 4rem 2rem;
  text-align: center;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.drop-icon {
  width: 64px; height: 64px;
  background: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.5rem;
  color: var(--accent);
  box-shadow: var(--shadow);
}
.drop-zone h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; }
.drop-zone p { color: var(--text-soft); font-size: 0.9375rem; }

/* Results Area */
.results-area {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 3rem;
  align-items: start;
}

.image-preview-container {
  position: relative;
  background: var(--bg);
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  padding: 1rem;
}
.image-preview-container img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  display: block;
  object-fit: contain;
  max-height: 500px;
}
.btn-reset {
  position: absolute;
  top: 1.5rem; right: 1.5rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}
.btn-reset:hover { background: white; color: #ef4444; transform: scale(1.05); }

/* Palette UI */
.section-title h3 { font-size: 1.125rem; font-weight: 700; margin-bottom: 1rem; color: var(--text); }

.dominant-color {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg);
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}
.dominant-color:hover { border-color: var(--text); background: white; }
.color-swatch {
  width: 60px; height: 60px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.1);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
.color-details { display: flex; flex-direction: column; flex-grow: 1; }
.color-hex { font-weight: 700; font-size: 1.125rem; font-family: monospace; text-transform: uppercase; }
.color-rgb { font-size: 0.875rem; color: var(--text-soft); font-family: monospace; }
.copy-btn {
  background: transparent; border: none; color: var(--text-soft); cursor: pointer; padding: 0.5rem; border-radius: 8px; transition: 0.2s;
}
.dominant-color:hover .copy-btn { color: var(--text); background: var(--border); }

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
}
.palette-item {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}
.palette-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--text); }
.palette-swatch { width: 100%; aspect-ratio: 1; border-bottom: 1px solid var(--border); }
.palette-info { padding: 0.75rem; text-align: center; }
.palette-hex { font-size: 0.875rem; font-weight: 700; font-family: monospace; text-transform: uppercase; }

.btn-primary {
  width: 100%; padding: 1rem; background: var(--text); color: white; border: none; border-radius: 12px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 0.5rem; transition: 0.2s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

/* Toast */
.toast {
  position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px);
  background: #1a1a1a; color: white; padding: 0.75rem 1.5rem; border-radius: 100px;
  font-weight: 600; font-size: 0.875rem; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
  opacity: 0; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); z-index: 2000;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Footer */
footer { padding: 6rem 0; background: #111; color: white; border-top: 1px solid #333; margin-top: 4rem; }
.footer-content { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 4rem; margin-bottom: 4rem; }
.footer-brand .logo { color: white; margin-bottom: 1.5rem; }
.footer-brand p { color: #999; font-size: 0.9375rem; line-height: 1.6; max-width: 300px; }
.footer-col h4 { font-size: 1rem; font-weight: 700; margin-bottom: 1.5rem; }
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 0.75rem; }
.footer-col ul li a { color: #999; text-decoration: none; font-size: 0.9375rem; transition: color 0.2s; }
.footer-col ul li a:hover { color: white; }
.footer-bottom { padding-top: 3rem; border-top: 1px solid #333; display: flex; justify-content: space-between; align-items: center; color: #666; font-size: 0.875rem; }
.footer-socials { display: flex; gap: 1.5rem; }
.footer-socials a { color: inherit; text-decoration: none; transition: color 0.2s; }
.footer-socials a:hover { color: white; }

/* Mobile */
.mobile-only { display: none; }
.menu-toggle { display: none; flex-direction: column; gap: 6px; cursor: pointer; padding: 0.5rem; z-index: 1001; }
.menu-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: 0.3s; }
.menu-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 991px) {
  .desktop-only { display: none; }
  .mobile-only { display: flex; }
  .menu-toggle { display: flex; }
  .nav-links {
    position: fixed; top: 0; right: -100%; width: 100%; height: 100vh; background: white;
    flex-direction: column; align-items: center; justify-content: center; padding: 2rem; gap: 2rem; transition: 0.4s var(--ease); z-index: 1000;
  }
  .nav-links.active { right: 0; }
  .dropdown { position: static; transform: none !important; opacity: 1 !important; visibility: visible !important; box-shadow: none; border: none; padding: 0; height: 0; overflow: hidden; transition: height 0.3s var(--ease); width: 100%; display: flex; flex-direction: column; align-items: center; }
  .nav-item.active .dropdown { height: auto; padding-top: 1rem; }
  .nav-item.active .chevron { transform: rotate(180deg); }
  .tool-header h1 { font-size: 2.5rem; }
  
  .results-area { grid-template-columns: 1fr; gap: 2rem; }
  
  .footer-content { grid-template-columns: 1fr; text-align: center; }
  .footer-brand { align-items: center; }
  .footer-bottom { flex-direction: column; gap: 1.5rem; }
}
