/* Add CSS variables for theme colors */
:root {
  --theme-color: #0077b6;
  --theme-color-light: rgba(0, 119, 182, 0.1);
  --theme-color-dark: #005f8e;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f5f9fc;
  color: #333;
  line-height: 1.6;
  padding: 20px;
}

header {
  text-align: center;
  padding: 2rem 0;
  background: linear-gradient(135deg, #0077b6, #00b4d8);
  color: white;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.container-fluid {
  max-width: 1100px;
  margin: 0 auto;
}

#resumeForm, #previewContainer, #resumePreview {
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
}

.form-section {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

.form-section h3 {
  color: #023e8a;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f0;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--theme-color, #0077b6);
  outline: none;
  box-shadow: 0 0 0 2px rgba(0,119,182,0.2);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

/* Template Grid */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.template-card {
  border: 2px solid #ddd;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.3s, border-color 0.3s, transform 0.2s;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 300px;
  position: relative;
}

.template-card.selected, .template-card:focus {
  border-color: #ff9800;
  box-shadow: 0 4px 16px rgba(255,152,0,0.12);
  outline: none;
  transform: translateY(-4px) scale(1.03);
}

.template-card:hover {
  border-color: #ff9800;
  box-shadow: 0 4px 16px rgba(255,152,0,0.18);
  transform: translateY(-2px) scale(1.01);
}

.template-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #f0f0f0;
  border-bottom: 1px solid #eee;
  display: block;
}

.template-card span {
  display: block;
  padding: 1rem 0.5rem 0.5rem 0.5rem;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 500;
  color: #333;
  flex: 1;
}

.template-card.premium {
  position: relative;
}

.template-card.premium::after {
  content: "⭐ Premium";
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ffd700;
  color: #000;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
}

/* Color Grid */
.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.color-option {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.3s;
  border: 2px solid transparent;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.selected {
  border-color: #ffd600 !important;
  box-shadow: 0 0 0 2px #ffd600 !important;
  transform: scale(1.1);
  z-index: 2;
}

/* Resume Preview */
.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid #eee;
}

.preview-actions {
  display: flex;
  gap: 10px;
}

.resume-header {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--theme-color);
  background: #fff;
}

.resume-header .profile-img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--theme-color);
}

.header-content {
  flex: 1;
}

.header-content h2 {
  color: var(--theme-color);
  margin: 0 0 10px 0;
  font-size: 24px;
}

.contact-info {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.contact-info span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.social-links {
  display: flex;
  gap: 10px;
}

.social-link {
  color: var(--theme-color);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--theme-color);
  border-radius: 4px;
  font-size: 14px;
}

.social-link:hover {
  background: var(--theme-color);
  color: white;
}

.resume-section {
  margin-bottom: 20px;
  background: #fff;
  border-left: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0 0 1.2rem 0;
}

.resume-section h3 {
  color: var(--theme-color);
  border-bottom: 2px solid var(--theme-color-light);
  padding-bottom: 5px;
  margin-bottom: 15px;
  background: none;
}

.resume-section.bg-accent {
  background: var(--theme-color-light, #e0f7fa);
  border-radius: 6px;
  padding: 1.2rem 1.5rem 1.2rem 1.2rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
}

.education-table, .experience-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.2rem;
  table-layout: fixed;
  border-left: none;
  border-radius: 0;
  overflow: hidden;
}

.education-table th, .education-table td, .experience-table th, .experience-table td {
  padding: 8px;
  border: 1px solid #ddd;
  word-break: break-word;
}

.education-table th, .experience-table th {
  background: var(--theme-color-light);
  color: var(--theme-color);
  border-bottom: 2px solid var(--theme-color);
}

.experience-item,
.project-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #eee;
}

.experience-item h4,
.project-item h4 {
  color: var(--theme-color);
  margin: 0 0 5px 0;
}

.experience-header {
  margin-bottom: 0.5rem;
}

.experience-header h4 {
  color: var(--theme-color);
  margin-bottom: 0.25rem;
}

.company,
.tech {
  color: #666;
  font-size: 14px;
  margin: 0 0 5px 0;
}

.experience-description p {
  margin: 0.5rem 0;
}

.skills-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.technical-skills h4,
.soft-skills h4 {
  color: var(--theme-color);
  margin-bottom: 10px;
}

.skills-container ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.skills-container li {
  background: var(--theme-color-light);
  color: var(--theme-color);
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 14px;
}

.languages-list {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.language-item {
  background: var(--theme-color-light);
  padding: 5px 15px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.language {
  color: var(--theme-color);
  font-weight: 500;
}

.level {
  color: #666;
  font-size: 14px;
}

/* Template Styles */
.modern {
  font-family: 'Segoe UI', sans-serif;
  --theme-color: #0077b6;
}

.professional {
  font-family: Georgia, serif;
  --theme-color: #2c3e50;
}

.creative {
  font-family: 'Helvetica Neue', sans-serif;
  --theme-color: #e74c3c;
}

.executive {
  font-family: 'Times New Roman', serif;
  --theme-color: #34495e;
}

/* Form Rows */
.edu-row,
.exp-row,
.project-row,
.language-row {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 5px;
}

.edu-row {
  grid-template-columns: repeat(4, 1fr) auto;
}

.exp-row {
  grid-template-columns: repeat(3, 1fr) auto;
}

.project-row {
  grid-template-columns: repeat(2, 1fr) auto;
}

.language-row {
  grid-template-columns: 2fr 1fr auto;
}

.add-row-btn {
  background: #28a745;
  color: white;
  border: none;
  font-size: 20px;
  padding: 0 12px;
  border-radius: 6px;
  cursor: pointer;
  height: 40px;
  transition: background 0.3s;
}

.add-row-btn:hover {
  background: #218838;
}

/* Responsive Design */
@media (min-width: 992px) {
  .row.justify-content-center {
    flex-wrap: nowrap;
    align-items: flex-start;
  }
  .col-lg-6, .col-lg-5 {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

@media (max-width: 991px) {
  #resumeForm, #previewContainer, #resumePreview {
    max-width: 100%;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

@media (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }

  .preview-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .preview-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .experience-header {
    flex-direction: column;
  }

  .company, .duration {
    display: block;
    margin: 0.25rem 0;
  }
}

@media (max-width: 600px) {
  #resumeForm, #previewContainer, #resumePreview {
    padding: 0.7rem 0.2rem;
    font-size: 0.97rem;
  }
  .experience-table th, .experience-table td {
    font-size: 0.95rem;
    padding: 6px;
  }
  .template-grid {
    grid-template-columns: 1fr;
  }
  .template-card {
    min-height: 220px;
  }
}

/* Print Styles */
@media print {
  body * {
    visibility: hidden;
  }
  
  #resumePreview,
  #resumePreview * {
    visibility: visible;
  }
  
  #resumePreview {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    margin: 0 auto;
    min-height: 800px;
    max-width: 800px;
    border-left: 8px solid var(--theme-color);
    border-top: 8px solid var(--theme-color);
    padding: 2.5rem 2.2rem 2.2rem 2.2rem;
    box-sizing: border-box;
  }

  .resume-header {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--theme-color);
    background: #fff;
  }

  .resume-section {
    margin-bottom: 20px;
    background: #fff;
    border-left: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0 0 1.2rem 0;
  }

  .resume-section.bg-accent {
    background: var(--theme-color-light, #e0f7fa) !important;
    border-radius: 6px !important;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03) !important;
  }

  .resume-section h3 {
    color: var(--theme-color);
    border-bottom: 2px solid var(--theme-color-light);
    padding-bottom: 5px;
    margin-bottom: 15px;
    background: none;
  }

  .experience-item {
    page-break-inside: avoid;
    margin-bottom: 1rem;
  }

  .social-link {
    text-decoration: none;
    color: var(--theme-color);
  }

  .social-link::after {
    content: " (" attr(href) ")";
    font-size: 12px;
    color: #666;
  }

  .resume-header, .resume-section {
    background: #fff !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    border-left: none !important;
  }
}

.row.justify-content-center {
  flex-direction: column !important;
  align-items: center !important;
}

/* Remove save draft button styles if any */
.preview-actions .btn-info { display: none !important; }

.badge-pro {
  background: linear-gradient(90deg, var(--theme-color, #ff9800), #ff5e62);
  color: #fff;
  font-weight: bold;
  font-size: 1rem;
  padding: 0.35em 1.1em;
  border-radius: 16px;
  margin: 0.7em auto 0.3em auto;
  box-shadow: 0 2px 8px rgba(255,94,98,0.18);
  letter-spacing: 1.5px;
  z-index: 2;
  position: relative;
  text-align: center;
  width: fit-content;
  text-shadow: 0 1px 2px rgba(0,0,0,0.08);
  border: 2px solid var(--theme-color);
}

.img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 180px;
  width: 100%;
  background: #e0e0e0;
  color: #888;
  font-size: 2rem;
  border-bottom: 1px solid #eee;
}

