/* ===================================
   AI Color Palette Generator
   Modern CSS with Glassmorphism
   =================================== */

/* CSS Variables */
:root {
  /* Colors */
  --primary: #4F46E5;
  --primary-light: #6366F1;
  --primary-dark: #4338CA;
  --accent: #7C3AED;
  --accent-light: #8B5CF6;

  /* Neutral */
  --bg-dark: #0F0F1A;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-glass: rgba(255, 255, 255, 0.08);
  --border-glass: rgba(255, 255, 255, 0.1);

  /* Text */
  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.7);
  --text-muted: rgba(255, 255, 255, 0.5);

  /* Gradients */
  --gradient-bg: linear-gradient(135deg, #0F0F1A 0%, #1a1a2e 50%, #16213e 100%);
  --gradient-primary: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  --gradient-glow: linear-gradient(135deg, rgba(79, 70, 229, 0.4) 0%, rgba(124, 58, 237, 0.4) 100%);

  /* Shadows */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 40px rgba(79, 70, 229, 0.3);

  /* Spacing */
  --container-max: 1200px;
  --header-height: 70px;

  /* Animation */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Background Animation */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(79, 70, 229, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 60%);
  pointer-events: none;
  z-index: -1;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===================================
   HEADER
   =================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: rgba(15, 15, 26, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  z-index: 1000;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-text span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 10px;
  transition: all var(--transition-normal);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--gradient-primary);
}

/* ===================================
   MAIN CONTENT
   =================================== */
.main {
  padding-top: calc(var(--header-height) + 40px);
  min-height: 100vh;
}

/* ===================================
   HERO SECTION
   =================================== */
.hero {
  text-align: center;
  padding: 60px 0 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.hero-badge-dot {
  width: 8px;
  height: 8px;
  background: #10B981;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 20px;
}

.hero-title-gradient {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

/* ===================================
   SEARCH INPUT
   =================================== */
.search-container {
  max-width: 700px;
  margin: 0 auto;
}

.search-box {
  position: relative;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-md);
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.search-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 20px;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 1.1rem;
  color: var(--text-primary);
  font-family: inherit;
}

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

.search-button {
  padding: 14px 32px;
  background: var(--gradient-primary);
  border: none;
  border-radius: 14px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.search-button:active {
  transform: translateY(0);
}

.search-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.search-hints {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.search-hint {
  padding: 8px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 100px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-normal);
}

.search-hint:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--primary);
}

/* ===================================
   LOADING ANIMATION
   =================================== */
.loading-section {
  display: none;
  padding: 80px 0;
  text-align: center;
}

.loading-section.active {
  display: block;
}

.loading-container {
  max-width: 500px;
  margin: 0 auto;
}

.loading-animation {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 32px;
}

.loading-circle {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
}

.loading-circle:nth-child(1) {
  border-top-color: var(--primary);
  animation: spin 1.5s linear infinite;
}

.loading-circle:nth-child(2) {
  border-right-color: var(--accent);
  animation: spin 2s linear infinite reverse;
}

.loading-circle:nth-child(3) {
  width: 80%;
  height: 80%;
  top: 10%;
  left: 10%;
  border-bottom-color: var(--primary-light);
  animation: spin 1.8s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.loading-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  animation: float 2s ease-in-out infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translate(-50%, -50%) translateY(0);
  }

  50% {
    transform: translate(-50%, -50%) translateY(-8px);
  }
}

.loading-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.loading-status {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.loading-progress {
  height: 4px;
  background: var(--bg-glass);
  border-radius: 100px;
  overflow: hidden;
}

.loading-progress-bar {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 100px;
  width: 0%;
  transition: width 0.3s ease;
}

/* ===================================
   RESULTS GRID
   =================================== */
.results-section {
  display: none;
  padding: 40px 0 80px;
}

.results-section.active {
  display: block;
}

.results-header {
  text-align: center;
  margin-bottom: 40px;
}

.results-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.results-keyword {
  color: var(--accent-light);
}

.results-subtitle {
  color: var(--text-secondary);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
}

/* ===================================
   PALETTE CARD
   =================================== */
.palette-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.palette-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.palette-card-image {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
}

.palette-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.palette-card:hover .palette-card-image img {
  transform: scale(1.05);
}

.palette-card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.palette-card-content {
  padding: 20px;
}

.palette-colors {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.palette-color {
  flex: 1;
  aspect-ratio: 1;
  border-radius: 12px;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.palette-color:hover {
  transform: scale(1.1);
  z-index: 1;
  box-shadow: var(--shadow-md);
}

.palette-color::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background var(--transition-fast);
}

.palette-color:active::after {
  background: rgba(255, 255, 255, 0.3);
}

.palette-codes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.palette-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition-normal);
}

.palette-code-row:hover {
  background: rgba(0, 0, 0, 0.3);
}

.palette-code-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.palette-code-value {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.palette-code-copy {
  font-size: 14px;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.palette-code-row:hover .palette-code-copy {
  opacity: 1;
}

/* ===================================
   TOAST NOTIFICATION
   =================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  padding: 16px 24px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
  min-width: 280px;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

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

@keyframes fadeOut {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.toast-icon {
  font-size: 20px;
}

.toast-success .toast-icon {
  color: #10B981;
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
}

/* ===================================
   CONTACT PAGE
   =================================== */
.contact-section {
  padding: 60px 0 80px;
  max-width: 600px;
  margin: 0 auto;
}

.contact-header {
  text-align: center;
  margin-bottom: 40px;
}

.contact-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.contact-description {
  color: var(--text-secondary);
}

.contact-form {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 40px;
}

.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.form-label .required {
  color: #EF4444;
  margin-left: 4px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 14px 18px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: all var(--transition-normal);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='rgba(255,255,255,0.5)'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 20px;
  padding-right: 48px;
  cursor: pointer;
}

.form-select option {
  background: var(--bg-dark);
  color: var(--text-primary);
}

.form-textarea {
  min-height: 150px;
  resize: vertical;
}

.form-error {
  font-size: 0.8rem;
  color: #EF4444;
  margin-top: 6px;
  display: none;
}

.form-group.error .form-input,
.form-group.error .form-select,
.form-group.error .form-textarea {
  border-color: #EF4444;
}

.form-group.error .form-error {
  display: block;
}

.form-submit {
  width: 100%;
  padding: 16px 32px;
  background: var(--gradient-primary);
  border: none;
  border-radius: 14px;
  color: white;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.form-submit:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.form-submit:active {
  transform: translateY(0);
}

.form-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Success Message */
.contact-success {
  display: none;
  text-align: center;
  padding: 60px 40px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
}

.contact-success.active {
  display: block;
}

.contact-success-icon {
  width: 80px;
  height: 80px;
  background: rgba(16, 185, 129, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 24px;
}

.contact-success-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.contact-success-message {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.contact-success-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-normal);
}

.contact-success-button:hover {
  background: var(--bg-card);
  border-color: var(--primary);
}

/* ===================================
   FOOTER
   =================================== */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border-glass);
  text-align: center;
}

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

.footer-heart {
  color: #EF4444;
}

.footer-links {
  margin-top: 12px;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--text-primary);
}

/* ===================================
   PRIVACY POLICY PAGE
   =================================== */
.privacy-section {
  padding: 60px 0 80px;
  max-width: 800px;
  margin: 0 auto;
}

.privacy-header {
  text-align: center;
  margin-bottom: 48px;
}

.privacy-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.privacy-description {
  color: var(--text-secondary);
  line-height: 1.8;
}

.privacy-content {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 40px;
}

.privacy-block {
  margin-bottom: 32px;
}

.privacy-block:last-child {
  margin-bottom: 0;
}

.privacy-subtitle {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.privacy-text {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 12px;
}

.privacy-text:last-child {
  margin-bottom: 0;
}

.privacy-text a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

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

.privacy-back {
  text-align: center;
  margin-top: 40px;
}

.privacy-back-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-normal);
}

.privacy-back-button:hover {
  background: var(--bg-card);
  border-color: var(--primary);
}

@media (max-width: 768px) {
  .privacy-content {
    padding: 24px;
  }

  .privacy-subtitle {
    font-size: 1.1rem;
  }
}

/* ===================================
   API KEY MODAL
   =================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  padding: 24px;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-dark);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 40px;
  max-width: 480px;
  width: 100%;
  animation: modalIn 0.3s ease;
}

@keyframes modalIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  text-align: center;
  margin-bottom: 24px;
}

.modal-icon {
  width: 64px;
  height: 64px;
  background: var(--gradient-primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
}

.modal-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 8px;
}

.modal-form {
  margin-bottom: 16px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
}

.modal-button {
  flex: 1;
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  border: none;
}

.modal-button-primary {
  background: var(--gradient-primary);
  color: white;
}

.modal-button-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.modal-button-secondary {
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-primary);
}

.modal-button-secondary:hover {
  background: var(--bg-card);
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 768px) {
  .header .container {
    padding: 0 16px;
  }

  .logo-text {
    font-size: 1.1rem;
  }

  .nav-link {
    padding: 8px 14px;
    font-size: 0.85rem;
  }

  .hero {
    padding: 40px 0 30px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .search-box {
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }

  .search-icon {
    display: none;
  }

  .search-input {
    width: 100%;
    text-align: center;
  }

  .search-button {
    width: 100%;
    justify-content: center;
  }

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

  .contact-form {
    padding: 24px;
  }

  .modal {
    padding: 24px;
  }

  .toast-container {
    left: 16px;
    right: 16px;
  }

  .toast {
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .palette-colors {
    gap: 6px;
  }

  .palette-card-content {
    padding: 16px;
  }
}