 @import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

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

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --bg3: #1a1a24;
  --border: rgba(255,255,255,0.07);
  --border-hover: rgba(255,255,255,0.15);
  --accent: #6c63ff;
  --accent2: #a78bfa;
  --accent-glow: rgba(108,99,255,0.3);
  --text: #f0f0f8;
  --text2: #8888aa;
  --success: #34d399;
  --error: #f87171;
  --card: rgba(255,255,255,0.03);
  --radius: 14px;
  --radius-sm: 8px;
}

html { scroll-behavior: smooth; }

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

/* ── NAV ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2rem; height: 64px;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.2rem;
  letter-spacing: -0.02em; color: var(--text); text-decoration: none;
  display: flex; align-items: center; gap: 0.5rem;
}
.nav-logo span { color: var(--accent2); }
.nav-links { display: flex; align-items: center; gap: 0.5rem; }
.nav-links a {
  color: var(--text2); text-decoration: none; font-size: 0.9rem;
  padding: 0.4rem 0.9rem; border-radius: var(--radius-sm); transition: all 0.2s;
}
.nav-links a:hover { color: var(--text); background: var(--card); }
.nav-links a.btn-nav { background: var(--accent); color: #fff; font-weight: 500; }
.nav-links a.btn-nav:hover { background: #7c74ff; }

/* ── PAGE ── */
.page { display: none; padding-top: 64px; min-height: 100vh; }
.page.active { display: block; }

/* ── HERO ── */
.hero {
  min-height: calc(100vh - 64px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 4rem 2rem;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(108,99,255,0.15), transparent 70%);
  pointer-events: none;
}
.hero-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(108,99,255,0.12); border: 1px solid rgba(108,99,255,0.3);
  color: var(--accent2); font-size: 0.8rem; font-weight: 500;
  padding: 0.35rem 0.9rem; border-radius: 100px; margin-bottom: 1.5rem;
  animation: fadeUp 0.6s ease both;
}
.hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2.8rem, 7vw, 5.5rem); font-weight: 800;
  line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 1.5rem;
  animation: fadeUp 0.6s 0.1s ease both;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero p {
  font-size: 1.15rem; color: var(--text2); max-width: 500px;
  margin-bottom: 2.5rem; animation: fadeUp 0.6s 0.2s ease both;
}
.hero-btns {
  display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center;
  animation: fadeUp 0.6s 0.3s ease both;
}
.hero-features {
  display: flex; gap: 2rem; margin-top: 4rem; flex-wrap: wrap; justify-content: center;
  animation: fadeUp 0.6s 0.4s ease both;
}
.hero-feature { display: flex; align-items: center; gap: 0.5rem; color: var(--text2); font-size: 0.9rem; }
.hero-feature .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent2); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.75rem 1.75rem; border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif; font-size: 0.95rem; font-weight: 500;
  cursor: pointer; border: none; text-decoration: none; transition: all 0.2s; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #7c74ff; transform: translateY(-1px); box-shadow: 0 8px 24px var(--accent-glow); }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border-hover); }
.btn-ghost:hover { background: var(--card); }
.btn-outline { background: transparent; color: var(--accent2); border: 1px solid rgba(108,99,255,0.4); }
.btn-outline:hover { background: rgba(108,99,255,0.1); }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ── AUTH ── */
.auth-page {
  min-height: calc(100vh - 64px);
  display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.auth-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 20px;
  padding: 2.5rem; width: 100%; max-width: 420px; animation: fadeUp 0.5s ease both;
}
.auth-card h2 { font-family: 'Syne', sans-serif; font-size: 1.7rem; font-weight: 700; margin-bottom: 0.4rem; }
.auth-card p.subtitle { color: var(--text2); font-size: 0.9rem; margin-bottom: 2rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; font-size: 0.88rem; color: var(--text2); }
.auth-footer a { color: var(--accent2); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ── FORMS ── */
.form-group { margin-bottom: 1.1rem; }
label { display: block; font-size: 0.85rem; font-weight: 500; color: var(--text2); margin-bottom: 0.4rem; }
input[type="text"], input[type="password"], textarea, select {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: 'DM Sans', sans-serif; font-size: 0.95rem;
  padding: 0.7rem 1rem; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 120px; }

/* ── APP LAYOUT ── */
.app-layout {
  max-width: 1200px; margin: 0 auto; padding: 2rem;
  display: grid; grid-template-columns: 340px 1fr; gap: 1.5rem;
  min-height: calc(100vh - 64px);
}
.sidebar { display: flex; flex-direction: column; gap: 1rem; }
.card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; }
.card-title {
  font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700;
  margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem;
}

/* ── SLIDE COUNT & LANG BUTTONS ── */
.slide-count-selector, .lang-selector {
  display: flex; gap: 0.4rem; margin-top: 0.3rem;
}
.count-btn, .lang-btn {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text2);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem; font-weight: 600;
  padding: 0.5rem 0.25rem;
  cursor: pointer; transition: all 0.2s; text-align: center;
}
.count-btn:hover, .lang-btn:hover { border-color: var(--accent); color: var(--text); }
.count-btn.active, .lang-btn.active {
  background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700;
}

/* ── PROGRESS ── */
.progress-label {
  display: flex; justify-content: space-between;
  font-size: 0.8rem; color: var(--text2); margin-bottom: 0.4rem;
}
.progress-track { height: 4px; background: var(--bg3); border-radius: 2px; overflow: hidden; }
.progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px; width: 0%; transition: width 0.5s ease;
}

/* ── TEMPLATE GRID ── */
.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin-bottom: 1rem; }
.template-option {
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.6rem; cursor: pointer; transition: all 0.2s; text-align: center;
}
.template-option:hover { border-color: var(--border-hover); }
.template-option.selected { border-color: var(--accent); background: rgba(108,99,255,0.08); }
.template-preview {
  height: 48px; border-radius: 4px; margin-bottom: 0.4rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 600; letter-spacing: 0.05em;
}
.t-dark .template-preview  { background: #0f172a; color: #e2e8f0; border: 1px solid #334155; }
.t-light .template-preview { background: #f8fafc; color: #1e293b; border: 1px solid #e2e8f0; }
.t-ocean .template-preview { background: linear-gradient(135deg, #0c4a6e, #0ea5e9); color: #fff; }
.t-forest .template-preview { background: linear-gradient(135deg, #14532d, #22c55e); color: #fff; }
.t-sunset .template-preview { background: linear-gradient(135deg, #7c2d12, #f97316); color: #fff; }
.t-royal .template-preview  { background: linear-gradient(135deg, #3b0764, #a855f7); color: #fff; }
.template-name { font-size: 0.75rem; color: var(--text2); }

/* ── TEMPLATE TOOLTIP ── */
.template-tooltip { margin-top: 0.75rem; animation: fadeUp 0.2s ease; }
.tip-slide { border-radius: var(--radius-sm); padding: 0.75rem; position: relative; overflow: hidden; }
.tip-bar { width: 4px; height: 100%; position: absolute; left: 0; top: 0; }
.tip-title { font-size: 0.75rem; font-weight: 700; margin-bottom: 0.35rem; padding-left: 0.5rem; }
.tip-line { height: 1px; margin: 0.3rem 0 0.3rem 0.5rem; width: 60%; }
.tip-bullet { font-size: 0.65rem; padding: 0.1rem 0 0.1rem 0.5rem; }
.tip-img { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); width: 50px; height: 45px; border-radius: 4px; }

/* ── PREVIEW AREA ── */
.preview-area { display: flex; flex-direction: column; gap: 1rem; }
.preview-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
}
.preview-header h2 { font-family: 'Syne', sans-serif; font-size: 1.2rem; font-weight: 700; }
.slide-count-badge {
  font-size: 0.85rem; color: var(--text2); background: var(--bg3);
  padding: 0.25rem 0.75rem; border-radius: 100px; border: 1px solid var(--border);
}
.drag-hint {
  font-size: 0.78rem; color: var(--text2); background: var(--bg3);
  padding: 0.2rem 0.6rem; border-radius: 100px; border: 1px solid var(--border);
}
.slides-container { display: flex; flex-direction: column; gap: 0.75rem; flex: 1; }

/* ── SLIDE CARD ── */
.slide-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color 0.2s; animation: fadeUp 0.4s ease both;
}
.slide-card:hover { border-color: var(--border-hover); }

.slide-card-inner {
  display: grid; position: relative;
  min-height: 160px; overflow: hidden;
  border-radius: calc(var(--radius) - 1px);
}
/* Layouts */
.layout-right  { grid-template-columns: 1fr 220px; }
.layout-right .slide-img    { grid-column: 2; grid-row: 1/3; }
.layout-right .slide-content{ grid-column: 1; grid-row: 1; padding: 1.25rem; }
.layout-right .slide-actions{ grid-column: 1; grid-row: 2; padding: 0 1.25rem 0.75rem; }

.layout-left   { grid-template-columns: 180px 1fr; }
.layout-left .slide-img    { grid-column: 1; grid-row: 1/3; }
.layout-left .slide-content{ grid-column: 2; grid-row: 1; padding: 1.25rem; }
.layout-left .slide-actions{ grid-column: 2; grid-row: 2; padding: 0 1.25rem 0.75rem; }

.layout-full-bg { grid-template-columns: 1fr; }
.layout-full-bg .slide-img     { position: absolute; inset: 0; z-index: 0; opacity: 0.18; }
.layout-full-bg .slide-content { position: relative; z-index: 1; padding: 1.25rem; }
.layout-full-bg .slide-actions { position: relative; z-index: 1; padding: 0 1.25rem 0.75rem; }

.layout-top { grid-template-columns: 1fr; grid-template-rows: 120px auto auto; }
.layout-top .slide-img     { grid-row: 1; height: 120px; }
.layout-top .slide-content { grid-row: 2; padding: 1.25rem; }
.layout-top .slide-actions { grid-row: 3; padding: 0 1.25rem 0.75rem; }

.layout-collage { grid-template-columns: 1fr; }
.layout-collage .slide-content { padding: 1.25rem; }
.layout-collage .slide-actions { padding: 0 1.25rem 0.75rem; }

/* Image containers */
.slide-img { overflow: hidden; background: var(--bg3); }
.slide-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s; }
.slide-card:hover .slide-img img { transform: scale(1.03); }
.slide-icon-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 2.5rem; background: rgba(108,99,255,0.08);
}

/* Slide content */
.slide-header { display: flex; align-items: center; gap: 0.75rem; padding-bottom: 0.6rem; }
.slide-number {
  width: 26px; height: 26px; background: rgba(108,99,255,0.15); color: var(--accent2);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}
.slide-title-text { font-family: 'Syne', sans-serif; font-weight: 600; font-size: 0.95rem; flex: 1; }
.slide-bullets { list-style: none; margin-top: 0.5rem; }
.slide-bullets li { display: flex; align-items: flex-start; gap: 0.4rem; color: var(--text2); font-size: 0.85rem; padding: 0.2rem 0; }
.bullet-dot { color: var(--accent2); flex-shrink: 0; font-size: 0.8rem; }

/* Slide actions */
.slide-actions {
  display: flex; align-items: center; gap: 0.4rem;
  opacity: 0; transition: opacity 0.2s;
}
.slide-card:hover .slide-actions { opacity: 1; }
.action-btn {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text2); font-size: 0.78rem; padding: 0.3rem 0.55rem;
  cursor: pointer; transition: all 0.15s; line-height: 1;
}
.action-btn:hover { background: var(--border-hover); color: var(--text); border-color: var(--border-hover); }
.action-btn.danger:hover { background: rgba(248,113,113,0.15); color: var(--error); border-color: var(--error); }
.action-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* Drag */
.slide-card.dragging { opacity: 0.4; transform: scale(0.98); }
.slide-card.drag-over { border-color: var(--accent) !important; box-shadow: 0 0 0 2px var(--accent-glow); }

/* ── HISTORY ── */
.history-item {
  padding: 0.6rem 0.75rem; border-radius: var(--radius-sm);
  cursor: pointer; transition: background 0.15s; border: 1px solid transparent;
}
.history-item:hover { background: var(--bg3); border-color: var(--border); }
.history-title { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.2rem; }
.history-meta { font-size: 0.75rem; color: var(--text2); }

/* ── EDIT MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.75); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg2); border: 1px solid var(--border-hover); border-radius: 18px;
  padding: 2rem; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  transform: translateY(16px); transition: transform 0.25s ease;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.modal-header h3 { font-family: 'Syne', sans-serif; font-size: 1.2rem; font-weight: 700; }
.modal-close {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text2);
  font-size: 0.9rem; padding: 0.3rem 0.6rem; border-radius: 6px; cursor: pointer; transition: all 0.15s;
}
.modal-close:hover { background: var(--border-hover); color: var(--text); }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 4rem 2rem; background: var(--bg2);
  border: 1px dashed var(--border-hover); border-radius: var(--radius); min-height: 300px; flex: 1;
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }
.empty-state h3 { font-family: 'Syne', sans-serif; font-size: 1.1rem; margin-bottom: 0.5rem; }
.empty-state p { color: var(--text2); font-size: 0.9rem; }

/* ── LOADING ── */
.loading-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2), var(--accent));
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  border-radius: 2px; margin-bottom: 1rem;
}
.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.2); border-top-color: #fff;
  border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block;
}

/* ── TOAST ── */
#toast-container {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.toast {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem; font-size: 0.875rem;
  display: flex; align-items: center; gap: 0.5rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4); animation: slideIn 0.3s ease; max-width: 320px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--error); }

/* ── PROJECTS ── */
.projects-page { max-width: 900px; margin: 0 auto; padding: 2rem; }
.projects-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.projects-header h1 { font-family: 'Syne', sans-serif; font-size: 1.8rem; font-weight: 700; }
.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.project-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem; cursor: pointer; transition: all 0.2s;
}
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
.project-card h3 { font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.project-meta { font-size: 0.8rem; color: var(--text2); display: flex; align-items: center; gap: 0.4rem; }
.project-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }

/* ── KEYFRAMES ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .app-layout { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.5rem; }
  .hero-btns { flex-direction: column; align-items: center; }
  nav { padding: 0 1rem; }
  .nav-links a:not(.btn-nav) { display: none; }
}