@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;600;700&family=Space+Grotesk:wght@700&display=swap');

/* ========== BASE ========== */
*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; }
.font-outfit { font-family: 'Outfit', sans-serif; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.dark ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ========== ANIMATIONS ========== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes pulse-ring { 0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.3); } 50% { box-shadow: 0 0 0 8px rgba(99,102,241,0); } }
@keyframes spin { to { transform: rotate(360deg); } }

.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }
.animate-fade-in-up { animation: fadeInUp 0.5s ease-out forwards; }
.animate-spin { animation: spin 1s linear infinite; }

/* ========== GLOBAL GRIMONT HEADER ========== */
.grimont-global-header {
  width: 100%; z-index: 1000; position: sticky; top: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.08); padding: 14px 0;
  font-family: 'Outfit', 'Inter', sans-serif; color: #e2e8f0;
  box-shadow: 0 4px 30px rgba(0,0,0,0.15);
}
.grimont-global-header * { box-sizing: border-box; }
.grimont-global-header .ggh-container {
  max-width: 1152px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; justify-content: space-between; align-items: center;
}
.ggh-left { display: flex; align-items: center; gap: 1.5rem; }
.ggh-logo-group { display: flex; align-items: center; gap: 0.875rem; text-decoration: none; transition: transform 0.2s ease; }
.ggh-logo-group:hover { transform: scale(1.02); }
.ggh-logo-box {
  width: 40px; height: 40px; background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  color: white; font-weight: bold; font-size: 1.25rem; border: 1px solid rgba(255,255,255,0.15);
  box-shadow: 0 0 20px rgba(37,99,235,0.25); flex-shrink: 0;
}
.ggh-logo-text { font-family: 'Space Grotesk', monospace; font-weight: 800; font-size: 1.2rem; color: white; letter-spacing: 0.05em; display: none; }
.ggh-logo-text span { color: #00f2ff; }
@media (min-width: 640px) { .ggh-logo-text { display: block; } }
.ggh-separator { width: 1px; height: 36px; background-color: rgba(255,255,255,0.1); display: none; }
@media (min-width: 768px) { .ggh-separator { display: block; } }
.ggh-app-info { display: flex; flex-direction: column; justify-content: center; }
.ggh-app-title-group { display: flex; align-items: center; gap: 0.6rem; }
.ggh-app-icon-container {
  width: 32px; height: 32px; border-radius: 8px; background: rgba(30,41,59,1);
  border: 1px solid rgba(255,255,255,0.1); display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #60a5fa; box-shadow: 0 2px 10px rgba(0,0,0,0.2); flex-shrink: 0;
}
.ggh-app-name { font-weight: 700; color: white; font-size: 1.05rem; margin: 0; padding: 0; letter-spacing: 0.02em; }
.ggh-app-desc { font-size: 0.8rem; color: #94a3b8; max-width: 600px; display: none; margin: 4px 0 0 0; padding: 0; line-height: 1.4; font-weight: 300; }
@media (min-width: 1024px) { .ggh-app-desc { display: block; } }
.ggh-right { display: flex; align-items: center; gap: 1rem; }
.ggh-right button {
  background: rgba(30,41,59,0.6) !important; border: 1px solid rgba(255,255,255,0.1) !important;
  color: #cbd5e1 !important; width: 40px !important; height: 40px !important;
  border-radius: 50% !important; display: flex !important; align-items: center !important; justify-content: center !important;
  cursor: pointer !important; transition: all 0.2s ease !important; padding: 0 !important;
}
.ggh-right button:hover {
  background: rgba(30,41,59,1) !important; color: white !important;
  border-color: rgba(255,255,255,0.2) !important; transform: translateY(-1px) !important;
}

/* ========== TEMPLATE CARDS ========== */
.template-card {
  cursor: pointer; transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  border: 2px solid transparent; position: relative; overflow: hidden;
}
.template-card::before {
  content: ''; position: absolute; inset: 0; opacity: 0;
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08));
  transition: opacity 0.3s ease;
}
.template-card:hover::before { opacity: 1; }
.template-card:hover {
  transform: translateY(-3px);
  border-color: rgba(99,102,241,0.4);
  box-shadow: 0 12px 40px rgba(99,102,241,0.12);
}
.template-card.active {
  border-color: #6366f1;
  box-shadow: 0 0 0 2px rgba(99,102,241,0.2), 0 8px 30px rgba(99,102,241,0.15);
}
.dark .template-card { border-color: rgba(71,85,105,0.5); }
.dark .template-card:hover { border-color: rgba(129,140,248,0.5); }
.dark .template-card.active { border-color: #818cf8; }

/* ========== GLASS CARD ========== */
.glass-card {
  background: rgba(255,255,255,0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.3); border-radius: 1rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}
.dark .glass-card {
  background: rgba(30,41,59,0.6); border-color: rgba(71,85,105,0.4);
  box-shadow: 0 4px 24px rgba(0,0,0,0.2);
}

/* ========== STEP INDICATOR ========== */
.step-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white; font-weight: 700; font-size: 0.8rem; flex-shrink: 0;
}

/* ========== CHIP MULTI-SELECT ========== */
.chip-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  padding: 0.45rem 1rem; border-radius: 9999px; cursor: pointer;
  font-size: 0.825rem; font-weight: 500;
  border: 1.5px solid #e2e8f0; background: white;
  transition: all 0.2s ease; user-select: none; white-space: nowrap;
}
.chip:hover { border-color: #a5b4fc; background: #eef2ff; color: #4f46e5; }
.chip.selected { background: #6366f1; color: white; border-color: #6366f1; }
.chip.selected:hover { background: #4f46e5; }
.dark .chip { background: #1e293b; border-color: #475569; color: #cbd5e1; }
.dark .chip:hover { border-color: #818cf8; background: rgba(99,102,241,0.1); color: #a5b4fc; }
.dark .chip.selected { background: #6366f1; border-color: #6366f1; color: white; }

/* ========== SELECT STYLED ========== */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.6rem center; background-repeat: no-repeat; background-size: 1.5em;
  padding-right: 2.5rem;
}

/* ========== REPORT SECTION ========== */
.report-section {
  background: white; border-radius: 1rem; padding: 1.5rem 2rem;
  border: 1px solid #e2e8f0; transition: box-shadow 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04); margin-bottom: 1rem;
}
.report-section:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.06); }
.dark .report-section { background: #1e293b; border-color: #334155; }
.dark .report-section:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.3); }
.report-section h3 {
  font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.1rem;
  margin-bottom: 0.75rem; padding-bottom: 0.6rem;
  border-bottom: 2px solid #e8edff; display: flex; align-items: center; gap: 0.5rem;
  color: #3730a3;
}
.dark .report-section h3 { border-bottom-color: #312e81; color: #a5b4fc; }

/* Script tabs */
.script-tab {
  padding: 0.5rem 1.25rem; border-radius: 9999px; cursor: pointer;
  font-size: 0.875rem; font-weight: 500;
  border: 1.5px solid #e2e8f0; background: transparent;
  transition: all 0.2s ease; color: #64748b;
}
.script-tab:hover { border-color: #818cf8; color: #4f46e5; background: #eef2ff; }
.script-tab.active { background: #6366f1; color: white; border-color: #6366f1; }
.dark .script-tab { border-color: #475569; color: #94a3b8; }
.dark .script-tab:hover { border-color: #818cf8; color: #a5b4fc; background: rgba(99,102,241,0.1); }
.dark .script-tab.active { background: #6366f1; border-color: #6366f1; color: white; }

/* ========== EDITABLE ========== */
[contenteditable="true"] {
  outline: none; border-radius: 4px; padding: 2px 4px; margin: -2px -4px;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  min-height: 1em; display: inline-block; width: 100%;
}
[contenteditable="true"]:hover { background: rgba(99,102,241,0.04); }
[contenteditable="true"]:focus {
  background: rgba(99,102,241,0.06);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.2);
}
.dark [contenteditable="true"]:hover { background: rgba(129,140,248,0.06); }
.dark [contenteditable="true"]:focus { background: rgba(129,140,248,0.1); box-shadow: 0 0 0 2px rgba(129,140,248,0.2); }

.editable-hint {
  font-size: 0.7rem; color: #94a3b8; font-style: italic;
  display: flex; align-items: center; gap: 0.3rem; margin-top: 0.5rem;
}
.dark .editable-hint { color: #64748b; }

/* ========== OBJECTION CARDS ========== */
.objection-card {
  border-radius: 0.75rem; overflow: hidden;
  border: 1px solid #e2e8f0; transition: all 0.25s ease;
}
.dark .objection-card { border-color: #334155; }
.objection-header {
  padding: 0.875rem 1.25rem; display: flex; align-items: center; gap: 0.75rem;
  background: #fff7ed; cursor: pointer; font-weight: 600; font-size: 0.9rem;
  color: #c2410c; transition: background 0.2s ease;
}
.dark .objection-header { background: rgba(194,65,12,0.12); color: #fb923c; }
.objection-header:hover { background: #ffedd5; }
.dark .objection-header:hover { background: rgba(194,65,12,0.18); }
.objection-body {
  padding: 1rem 1.25rem; background: white;
  border-top: 1px solid #fed7aa; display: none;
  font-size: 0.9rem; line-height: 1.6; color: #374151;
}
.dark .objection-body { background: #1e293b; border-top-color: rgba(194,65,12,0.2); color: #d1d5db; }
.objection-card.open .objection-body { display: block; }
.objection-card.open .objection-header { background: #ffedd5; }
.dark .objection-card.open .objection-header { background: rgba(194,65,12,0.2); }

/* ========== BADGES ========== */
.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.2rem 0.65rem; border-radius: 9999px;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
}
.badge-indigo { background: #eef2ff; color: #4338ca; }
.badge-violet { background: #f5f3ff; color: #6d28d9; }
.badge-emerald { background: #d1fae5; color: #065f46; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-rose { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.dark .badge-indigo { background: rgba(67,56,202,0.2); color: #a5b4fc; }
.dark .badge-violet { background: rgba(109,40,217,0.2); color: #c4b5fd; }
.dark .badge-emerald { background: rgba(6,95,70,0.2); color: #6ee7b7; }
.dark .badge-amber { background: rgba(146,64,14,0.2); color: #fcd34d; }
.dark .badge-rose { background: rgba(153,27,27,0.2); color: #fca5a5; }
.dark .badge-blue { background: rgba(30,64,175,0.2); color: #93c5fd; }

/* ========== SOURCE LINK ========== */
.source-link {
  display: inline-flex; align-items: center; gap: 0.375rem;
  color: #6366f1; font-size: 0.78rem; text-decoration: none;
  transition: all 0.2s ease; padding: 0.2rem 0.5rem; border-radius: 0.375rem;
  font-weight: 500;
}
.source-link:hover { background: rgba(99,102,241,0.08); text-decoration: underline; }
.dark .source-link { color: #a5b4fc; }
.dark .source-link:hover { background: rgba(129,140,248,0.1); }

/* ========== LOADING ========== */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 0.5rem;
}
.dark .skeleton {
  background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
  background-size: 200% 100%;
}

/* ========== PRINT / EXPORT ========== */
@media print {
  .grimont-global-header, .no-print { display: none !important; }
  .report-section { break-inside: avoid; }
  body { background: white !important; color: #1e293b !important; }
}
.no-transitions * { transition: none !important; animation: none !important; }

/* ========== EXPORT ZONE ========== */
#export-zone {
  background: white;
  font-family: 'Inter', sans-serif;
}
.dark #export-zone { background: #0f172a; }

/* ========== GENERATE BUTTON ========== */
#generate-btn {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  box-shadow: 0 4px 15px rgba(99,102,241,0.35);
  transition: all 0.2s ease;
}
#generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99,102,241,0.45);
}
#generate-btn:active { transform: translateY(0); }

/* ========== EXPORT INDIVIDUAL BUTTONS ========== */
.export-btn-png {
  transition: all 0.2s ease;
}
.export-btn-png:hover { transform: translateY(-1px); }

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
  .report-section { padding: 1rem 1.25rem; }
}
