:root {
  --primary: #2563EB;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --bg-color: #ffffff;
  --bg-secondary: #f8fafc;
  --text-color: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.1);
  --navbar-bg: rgba(255,255,255,0.95);
  --accordion-bg: #ffffff;
  --input-bg: #ffffff;
}

[data-bs-theme="dark"] {
  --bg-color: #0f172a;
  --bg-secondary: #1e293b;
  --text-color: #f1f5f9;
  --text-muted: #94a3b8;
  --border-color: #334155;
  --card-bg: #1e293b;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.3);
  --navbar-bg: rgba(15,23,42,0.95);
  --accordion-bg: #1e293b;
  --input-bg: #0f172a;
}

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

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  transition: background 0.3s, color 0.3s;
  overflow-x: hidden;
}

/* Navbar */
.navbar {
  background: var(--navbar-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s;
  padding: 12px 0;
  z-index: 1030;
}
.navbar-brand {
  font-weight: 800;
  color: var(--primary) !important;
  font-size: 1.3rem;
}
.nav-link {
  color: var(--text-color) !important;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--primary) !important; }
#darkModeToggle {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-color: var(--border-color);
  color: var(--text-color);
}
#darkModeToggle:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Hero */
.hero-section {
  position: relative;
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  overflow: hidden;
  padding-top: 80px;
}
[data-bs-theme="dark"] .hero-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.hero-content { position: relative; z-index: 2; }
.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: var(--text-color);
  line-height: 1.15;
  margin-bottom: 1rem;
}
.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 540px;
  line-height: 1.7;
}
.hero-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-buttons .btn {
  border-radius: 12px;
  font-weight: 600;
  transition: all 0.3s;
}
.hero-buttons .btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}
.hero-buttons .btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(37,99,235,0.3);
}
.hero-buttons .btn-outline-primary {
  border-color: var(--primary);
  color: var(--primary);
}
.hero-buttons .btn-outline-primary:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}
.hero-stats {
  display: flex;
  gap: 40px;
}
.stat-item { text-align: center; }
.stat-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
}
.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 400px;
}
.hero-illustration {
  position: relative;
  width: 320px;
  height: 400px;
}
.main-illustration {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 260px;
  background: var(--card-bg);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  z-index: 2;
}
.main-illustration i {
  font-size: 3rem;
  color: var(--primary);
}
.illustration-cv {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 120px;
}
.cv-line {
  height: 6px;
  background: var(--primary-light);
  border-radius: 3px;
  width: 100%;
}
.cv-line.short { width: 65%; }

.floating-card {
  position: absolute;
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 3;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-color);
  animation: float 3s ease-in-out infinite;
}
.floating-card i { font-size: 1.2rem; color: var(--primary); }
.floating-card.card-1 { top: 10%; right: -10%; animation-delay: 0s; }
.floating-card.card-2 { bottom: 20%; left: -10%; animation-delay: 0.5s; }
.floating-card.card-3 { bottom: 5%; right: 10%; animation-delay: 1s; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.hero-shape {
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 100px;
  background: var(--bg-color);
  clip-path: ellipse(70% 100% at 50% 100%);
}

/* Section Styles */
.section-padding { padding: 100px 0; }
.section-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}
.section-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Template Cards */
.template-card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  border: 2px solid transparent;
  cursor: pointer;
}
.template-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}
.template-card.active {
  border-color: var(--primary);
}
.template-preview {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.template-mini {
  width: 100%;
  height: 100%;
  display: flex;
  gap: 8px;
}
.template-mini .mini-sidebar {
  width: 25%;
  border-radius: 4px;
}
.template-mini .mini-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.template-mini .mini-header {
  height: 30px;
  border-radius: 4px;
}
.template-mini .mini-line {
  height: 6px;
  background: rgba(0,0,0,0.1);
  border-radius: 3px;
}
.bg-template-1 { background: linear-gradient(135deg, #dbeafe, #eff6ff); }
.bg-template-2 { background: #f8f9fa; }
.bg-template-3 { background: #f1f5f9; }
.bg-template-4 { background: linear-gradient(135deg, #ede9fe, #fce7f3); }
.bg-template-5 { background: linear-gradient(135deg, #1e293b, #334155); }
.bg-template-6 { background: linear-gradient(135deg, #1a2332, #2a3446); }
.bg-template-7 { background: linear-gradient(135deg, #dcfce7, #f0fdf4); }
.bg-template-8 { background: linear-gradient(135deg, #1e1e2e, #2a2a3e); }
.bg-template-9 { background: linear-gradient(135deg, #800020, #a04555); }
.bg-template-10 { background: linear-gradient(135deg, #1a1a2e, #2d1b20); }
.bg-template-11 { background: linear-gradient(135deg, #0f172a, #1e293b); }
.bg-template-12 { background: linear-gradient(135deg, #0a0a0a, #1a1a1a); }
.bg-template-13 { background: linear-gradient(135deg, #475569, #64748b); }
.bg-template-14 { background: linear-gradient(135deg, #5d4037, #795548); }
.bg-template-15 { background: linear-gradient(135deg, #4f46e5, #6366f1); }
[data-bs-theme="dark"] .bg-template-2,
[data-bs-theme="dark"] .bg-template-3,
[data-bs-theme="dark"] .bg-template-5 { background: #1e293b; }
[data-bs-theme="dark"] .template-mini .mini-line { background: rgba(255,255,255,0.1); }

.template-info {
  padding: 16px;
}
.template-info h5 {
  font-weight: 700;
  font-size: 1rem;
}
.template-info p {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Form Container */
#builder .row {
  align-items: stretch;
}
#builder .row > [class*="col-"] {
  display: flex;
  flex-direction: column;
}
.form-container {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.form-container::-webkit-scrollbar { width: 6px; }
.form-container::-webkit-scrollbar-track { background: transparent; }
.form-container::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

.accordion-item {
  background: var(--accordion-bg);
  border: 1px solid var(--border-color);
  margin-bottom: 8px;
  border-radius: 12px !important;
  overflow: hidden;
}
.accordion-button {
  background: var(--accordion-bg);
  color: var(--text-color);
  font-weight: 600;
  border: none;
  padding: 14px 18px;
}
.accordion-button:not(.collapsed) {
  background: var(--primary-light);
  color: var(--primary);
}
[data-bs-theme="dark"] .accordion-button:not(.collapsed) {
  background: rgba(37,99,235,0.15);
}
.accordion-button:focus { box-shadow: none; }
.accordion-body { padding: 18px; }

.form-label { font-weight: 500; font-size: 0.88rem; color: var(--text-color); }
.form-control, .form-select {
  background: var(--input-bg);
  color: var(--text-color);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  transition: all 0.2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
  background: var(--input-bg);
  color: var(--text-color);
}
.form-control.is-invalid { border-color: #dc3545; }

/* Photo Upload */
.photo-upload-wrapper { display: flex; flex-direction: column; align-items: center; }
.photo-preview {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px dashed var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  overflow: hidden;
  background: var(--bg-secondary);
}
.photo-preview:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-preview i { font-size: 2rem; color: var(--text-muted); }
.photo-preview span { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

/* Tag Input */
.tag-input-container { width: 100%; }
.tag-input-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--input-bg);
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 44px;
  cursor: text;
  transition: border-color 0.2s;
}
.tag-input-wrapper:focus-within { border-color: var(--primary); }
.tag-input {
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-color);
  flex: 1;
  min-width: 100px;
  padding: 4px;
  font-size: 0.9rem;
}
.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  animation: tagIn 0.2s ease;
}
.tag-badge i {
  cursor: pointer;
  font-size: 0.75rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.tag-badge i:hover { opacity: 1; }

@keyframes tagIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.suggestion-tag {
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 0.8rem;
}
.suggestion-tag:hover {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
}

/* Preview Container */
.preview-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.preview-toolbar {
  background: var(--card-bg);
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}
.preview-container {
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  overflow-y: auto;
  flex: 1;
  margin-top: 12px;
}
.cv-preview {
  width: 100%;
  position: relative;
}
.cv-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  color: var(--text-muted);
}

/* Toast */
.toast-container { z-index: 9999; }
.toast-custom {
  background: var(--card-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  animation: slideIn 0.3s ease;
}
@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.toast-custom.success { border-left: 4px solid #22c55e; }
.toast-custom.error { border-left: 4px solid #ef4444; }
.toast-custom.info { border-left: 4px solid var(--primary); }
.toast-custom i.success { color: #22c55e; }
.toast-custom i.error { color: #ef4444; }
.toast-custom i.info { color: var(--primary); }

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

/* Ad Slots */
.ad-slot {
  background: var(--card-bg);
  border: 1px dashed var(--border-color);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  user-select: none;
  flex-direction: column;
  gap: 4px;
}
.ad-slot-full { margin: 24px 0; min-height: 100px; }
.ad-slot .ad-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.4;
}
.ad-slot .ad-placeholder { font-size: 0.85rem; opacity: 0.5; }
.ad-slot-inline { margin-top: 16px; min-height: 80px; }
@media (max-width: 768px) {
  .ad-slot-full { margin: 16px 0; }
  .ad-slot { min-height: 70px; padding: 14px; }
}

/* Footer */
.footer { background: #0f172a !important; }

/* Scroll animations */
[data-aos] { opacity: 0; transition: all 0.6s ease; }
[data-aos].aos-animate { opacity: 1; }

/* Responsive */
@media (max-width: 991.98px) {
  .hero-visual { min-height: 300px; }
  .hero-illustration { transform: scale(0.8); }
  #builder .row { min-height: auto; }
  #builder .row > [class*="col-"] { display: block; }
  .form-container { max-height: none; overflow: visible; flex: none; }
  .preview-wrapper { flex: none; overflow: visible; }
  .section-padding { padding: 60px 0; }
}
@media (max-width: 767.98px) {
  .hero-illustration { transform: scale(0.7); }
  .hero-visual { min-height: 250px; }
  .hero-stats { gap: 24px; }
  .floating-card { display: none; }
  .preview-toolbar { flex-direction: column; align-items: stretch !important; }
  .preview-toolbar > div:last-child { flex-wrap: wrap; }
  .preview-toolbar select, .preview-toolbar button { flex: 1; }
}
@media (max-width: 575.98px) {
  .hero-title { font-size: 1.75rem; }
  .hero-buttons .btn { width: 100%; }
  .section-title { font-size: 1.5rem; }
  .form-container { padding: 16px; }
}

/* Print Styles */
@media print {
  .navbar, .hero-section, #templates, .form-container,
  .preview-toolbar, .preview-wrapper, .footer, #loadingOverlay, .toast-container,
  #builder .row > .col-lg-5, .ad-slot { display: none !important; }
  .preview-container { box-shadow: none; border: none; border-radius: 0; overflow: visible; flex: none; margin-top: 0; }
  .cv-preview { min-height: auto; }
  #builder { padding: 0; }
  #builder .row { min-height: auto; }
  .col-lg-7 { max-width: 100%; flex: 0 0 100%; }
}
