/* css/style.css - modern glass, dark mode, responsive (shared across all pages) */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

:root {
  --bg-light: #f4f9fe;
  --bg-dark: #0b1120;
  --card-light: rgba(255,255,255,0.55);
  --card-dark: rgba(15, 23, 42, 0.75);
  --text-light: #0f172a;
  --text-dark: #e2e8f0;
  --primary: #4f46e5;
  --primary-light: #818cf8;
  --glass-border: rgba(255,255,255,0.25);
  --shadow: 0 25px 40px -18px rgba(0,0,0,0.25);
  --success: #10b981;
  --error: #ef4444;
}

body {
  background: linear-gradient(145deg, #e5edf7, #d6e1f0);
  color: var(--text-light);
  transition: background 0.3s, color 0.2s;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  scroll-behavior: smooth;
}

body.dark {
  background: linear-gradient(145deg, #0b111f, #121b2b);
  color: var(--text-dark);
}

/* glass utility */
.glass, .navbar, .hero, .tool-card, .info-section, footer, .back-to-top, .auth-card {
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  background: var(--card-light);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  border-radius: 2.5rem;
}

body.dark .glass, body.dark .navbar, body.dark .hero,
body.dark .tool-card, body.dark .info-section, body.dark footer,
body.dark .back-to-top, body.dark .auth-card {
  background: var(--card-dark);
  border-color: rgba(255,255,255,0.05);
}

/* layout */
body > *:not(script) {
  width: 100%;
  max-width: 1300px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 2rem;
}

/* navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 2rem;
  margin: 1.5rem 0 1rem;
  border-radius: 4rem;
  flex-wrap: wrap;
}

.logo {
  font-weight: 700;
  font-size: 1.8rem;
  background: linear-gradient(135deg, #4f46e5, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav-menu {
  display: flex;
  gap: 2.5rem;
  list-style: none;
}

.nav-menu a {
  text-decoration: none;
  font-weight: 500;
  color: inherit;
  padding: 0.4rem 0;
  border-bottom: 2px solid transparent;
  transition: 0.2s;
}

.nav-menu a:hover, .nav-menu a.active {
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.nav-actions {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.login-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1.8rem;
  border-radius: 2rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s;
  font-size: 1rem;
  text-decoration: none;
  display: inline-block;
}

.login-btn:hover {
  background: var(--primary-light);
  transform: scale(1.02);
}

.theme-toggle, .mobile-toggle {
  background: rgba(0,0,0,0.1);
  border: none;
  font-size: 1.5rem;
  padding: 0.4rem 1rem;
  border-radius: 3rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

body.dark .theme-toggle, body.dark .mobile-toggle {
  background: #1e293b;
  color: #facc15;
}

.mobile-toggle {
  display: none;
  font-size: 2rem;
  line-height: 1;
}

/* hero */
.hero {
  text-align: center;
  padding: 3rem 2rem;
  margin: 2rem 0;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
}

.gradient-text {
  background: linear-gradient(135deg, #2563eb, #9333ea, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subhead {
  font-size: 1.3rem;
  opacity: 0.8;
  max-width: 700px;
  margin: 1rem auto 0;
}

/* tool section */
.tool-section h2 {
  font-size: 2rem;
  margin: 2rem 0 1.2rem;
  font-weight: 600;
}

.tool-card {
  padding: 2.2rem;
  border-radius: 2.8rem;
  margin-bottom: 2rem;
}

/* color preview */
.color-preview {
  width: 100%;
  height: 120px;
  border-radius: 2rem;
  margin-bottom: 2rem;
  border: 3px solid rgba(255,255,255,0.3);
  transition: background 0.1s;
}

/* input group */
.input-group {
  margin-bottom: 2rem;
}

.input-group label {
  font-weight: 600;
  display: block;
  margin-bottom: 0.5rem;
}

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

.input-row input {
  flex: 1;
  padding: 1rem 1.5rem;
  border-radius: 3rem;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.25);
  font-size: 1.1rem;
  outline: none;
  color: inherit;
}

body.dark .input-row input {
  background: #1e293b;
  border-color: #334155;
  color: white;
}

.icon-btn {
  background: rgba(255,255,255,0.3);
  border: none;
  font-size: 1.5rem;
  padding: 0.8rem 1.2rem;
  border-radius: 3rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: 0.2s;
}

.icon-btn.small {
  font-size: 1.2rem;
  padding: 0.4rem 0.8rem;
}

.icon-btn:hover {
  background: rgba(255,255,255,0.5);
  transform: scale(1.05);
}

.error-message {
  color: var(--error);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  min-height: 1.2rem;
}

/* outputs */
.outputs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.output-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(0,0,0,0.1);
  padding: 0.8rem 1.5rem;
  border-radius: 3rem;
  flex-wrap: wrap;
}

body.dark .output-item {
  background: #1e293b;
}

.output-item .label {
  font-weight: 600;
  min-width: 60px;
}

.output-item code {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  background: rgba(0,0,0,0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 2rem;
  flex: 1;
}

.hint {
  text-align: center;
  opacity: 0.6;
  font-size: 0.9rem;
}

/* info sections */
.info-section {
  padding: 2rem;
  margin: 1.5rem 0;
}

.info-section h3 {
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
}

/* footer */
footer {
  padding: 1.5rem 2rem;
  margin: 2rem 0 1.5rem;
  border-radius: 4rem;
}

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

.social-links {
  display: flex;
  gap: 1.5rem;
  font-size: 1.8rem;
}

.social-links a {
  text-decoration: none;
  color: inherit;
  opacity: 0.7;
  transition: 0.2s;
}

.social-links a:hover {
  opacity: 1;
  color: var(--primary);
}

/* back to top */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: 0.2s;
  background: var(--card-light);
  color: inherit;
  z-index: 99;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

/* auth pages (signup/signin) */
.auth-section {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  margin: 2rem 0;
}

.auth-card {
  max-width: 500px;
  width: 100%;
  padding: 2.5rem;
  border-radius: 3rem;
}

.auth-card h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
  text-align: center;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-group input {
  width: 100%;
  padding: 0.9rem 1.2rem;
  border-radius: 3rem;
  border: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.2);
  font-size: 1rem;
  outline: none;
  color: inherit;
}

body.dark .form-group input {
  background: #1e293b;
  border-color: #334155;
}

.password-wrapper {
  position: relative;
}

.toggle-password {
  position: absolute;
  right: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.6;
}

.auth-btn {
  width: 100%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  border: none;
  padding: 1rem;
  border-radius: 3rem;
  font-weight: 600;
  font-size: 1.2rem;
  cursor: pointer;
  transition: 0.2s;
  margin: 1.5rem 0 1rem;
}

.auth-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 10px 20px -8px var(--primary);
}

.auth-link {
  text-align: center;
  margin-top: 1rem;
}

.auth-link a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

/* mobile */
@media (max-width: 800px) {
  .nav-menu {
    position: fixed;
    top: 90px;
    left: 2rem;
    right: 2rem;
    background: var(--card-light);
    backdrop-filter: blur(20px);
    flex-direction: column;
    align-items: center;
    padding: 2rem 0;
    gap: 1.5rem;
    border-radius: 2rem;
    transform: translateY(-150%);
    transition: transform 0.3s;
    z-index: 98;
  }
  
  body.dark .nav-menu { background: var(--card-dark); }
  .nav-menu.active { transform: translateY(0); }
  .mobile-toggle { display: inline-block; }
}

@media (max-width: 480px) {
  body > *:not(script) { padding: 0 1rem; }
  .hero h1 { font-size: 2.2rem; }
  .output-item { flex-wrap: wrap; }
}