/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --accent-color: #f59e0b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --background-color: #f8fafc;
  --surface-color: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  --border-radius: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --background-color: #0f172a;
  --surface-color: #1e293b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: #334155;
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition);
}

/* Layout */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}

.header-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.main-content {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem;
}

/* Input Panel */
.input-panel {
  background: var(--surface-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.panel-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.template-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.template-dropdown {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.input-sections {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 1.5rem;
}

.input-section {
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--surface-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.image-preview {
  width: 100px;
  height: 100px;
  border: 2px dashed var(--border-color);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.5rem;
  overflow: hidden;
  background: var(--background-color);
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview.empty::after {
  content: "No image";
  color: var(--text-secondary);
  font-size: 0.75rem;
}

/* Dynamic Lists */
.dynamic-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dynamic-item {
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--background-color);
  position: relative;
  animation: slideIn 0.3s ease-out;
}

.dynamic-item .remove-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--danger-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.dynamic-item .remove-btn:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.skill-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--primary-color);
  color: white;
  border-radius: 20px;
  font-size: 0.875rem;
  animation: slideIn 0.3s ease-out;
}

.skill-item .remove-skill {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  margin-left: 0.25rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--background-color);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
  transform: translateY(-1px);
}

.btn-icon {
  padding: 0.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background-color);
  border: 1px solid var(--border-color);
}

.btn-icon:hover {
  background: var(--border-color);
}

/* Preview Panel */
.preview-panel {
  background: var(--surface-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.preview-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.preview-container {
  flex: 1;
  padding: 1rem;
  overflow: auto;
  background: #f0f0f0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.resume-preview {
  width: 210mm;
  min-height: 297mm;
  background: white;
  box-shadow: var(--shadow-lg);
  transform-origin: top center;
  transition: transform 0.3s ease;
  margin: 1rem;
}

/* Resume Templates */
.professional-template {
  font-family: "Inter", sans-serif;
  color: #333;
  line-height: 1.6;
}

.professional-template .resume-header {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  padding: 2rem;
  text-align: center;
}

.professional-template .profile-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  border: 4px solid white;
  overflow: hidden;
}

.professional-template .profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.professional-template .name {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.professional-template .job-title {
  font-size: 1.25rem;
  opacity: 0.9;
  margin-bottom: 1rem;
}

.professional-template .contact-info {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.professional-template .resume-body {
  padding: 2rem;
}

.professional-template .section {
  margin-bottom: 2rem;
}

.professional-template .section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2563eb;
  border-bottom: 2px solid #2563eb;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.professional-template .summary {
  font-size: 1rem;
  line-height: 1.7;
  color: #555;
}

.professional-template .experience-item,
.professional-template .education-item {
  margin-bottom: 1.5rem;
  padding-left: 1rem;
  border-left: 3px solid #e5e7eb;
}

.professional-template .item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.professional-template .item-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: #333;
}

.professional-template .item-company {
  color: #2563eb;
  font-weight: 500;
}

.professional-template .item-duration {
  color: #666;
  font-size: 0.9rem;
}

.professional-template .item-description {
  color: #555;
  margin-top: 0.5rem;
}

.professional-template .skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
}

.professional-template .skill-item {
  background: #f1f5f9;
  color: #2563eb;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  text-align: center;
  font-weight: 500;
}

/* Creative Template */
.creative-template {
  font-family: "Inter", sans-serif;
  color: #333;
  background: linear-gradient(45deg, #f59e0b, #f97316);
  color: white;
}

.creative-template .resume-header {
  background: rgba(0, 0, 0, 0.1);
  padding: 2rem;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2rem;
  align-items: center;
}

.creative-template .profile-image {
  width: 150px;
  height: 150px;
  border-radius: 20px;
  overflow: hidden;
  border: 4px solid white;
}

.creative-template .profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creative-template .header-content .name {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.creative-template .header-content .job-title {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  opacity: 0.9;
}

.creative-template .contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.creative-template .resume-body {
  background: white;
  color: #333;
  padding: 2rem;
}

.creative-template .section-title {
  background: linear-gradient(45deg, #f59e0b, #f97316);
  color: white;
  padding: 1rem;
  margin: -0.5rem -0.5rem 1rem -0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.creative-template .experience-item,
.creative-template .education-item {
  background: #fef3c7;
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  border-left: 4px solid #f59e0b;
}

.creative-template .skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.creative-template .skill-item {
  background: linear-gradient(45deg, #f59e0b, #f97316);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  font-weight: 500;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Classic Template */
.classic-template {
  font-family: "Roboto", sans-serif;
  color: #333;
  display: grid;
  grid-template-columns: 1fr 2fr;
  min-height: 297mm;
}

.classic-template .sidebar {
  background: #2c3e50;
  color: white;
  padding: 2rem 1.5rem;
}

.classic-template .main-content {
  padding: 2rem;
  background: white;
}

.classic-template .profile-section {
  text-align: center;
  margin-bottom: 2rem;
}

.classic-template .profile-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  overflow: hidden;
  border: 3px solid white;
}

.classic-template .profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.classic-template .name {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.classic-template .job-title {
  font-size: 1rem;
  opacity: 0.9;
  margin-bottom: 1.5rem;
}

.classic-template .sidebar .section {
  margin-bottom: 2rem;
}

.classic-template .sidebar .section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #34495e;
}

.classic-template .contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.classic-template .skills-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.classic-template .skill-item {
  background: #34495e;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  font-size: 0.9rem;
}

.classic-template .main-content .section {
  margin-bottom: 2rem;
}

.classic-template .main-content .section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #2c3e50;
}

.classic-template .experience-item,
.classic-template .education-item {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #ecf0f1;
}

.classic-template .item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.classic-template .item-title {
  font-weight: 600;
  font-size: 1.1rem;
  color: #2c3e50;
}

.classic-template .item-company {
  color: #7f8c8d;
  font-weight: 500;
}

.classic-template .item-duration {
  color: #95a5a6;
  font-size: 0.9rem;
}

/* Elegant Template */
.elegant-template {
  font-family: "Playfair Display", serif;
  color: #2c2c2c;
  background: #fefefe;
}

.elegant-template .resume-header {
  text-align: center;
  padding: 3rem 2rem 2rem;
  border-bottom: 3px solid #8b5a3c;
  margin-bottom: 2rem;
}

.elegant-template .profile-image {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  margin: 0 auto 1.5rem;
  overflow: hidden;
  border: 4px solid #8b5a3c;
}

.elegant-template .profile-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.elegant-template .name {
  font-size: 3rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #8b5a3c;
  letter-spacing: 2px;
}

.elegant-template .job-title {
  font-size: 1.5rem;
  font-style: italic;
  color: #666;
  margin-bottom: 1.5rem;
}

.elegant-template .contact-info {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  font-size: 1rem;
  color: #555;
}

.elegant-template .resume-body {
  padding: 0 2rem 2rem;
}

.elegant-template .section {
  margin-bottom: 2.5rem;
}

.elegant-template .section-title {
  font-size: 2rem;
  font-weight: 500;
  color: #8b5a3c;
  margin-bottom: 1rem;
  text-align: center;
  position: relative;
}

.elegant-template .section-title::after {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: #8b5a3c;
}

.elegant-template .summary {
  font-size: 1.1rem;
  line-height: 1.8;
  text-align: center;
  font-style: italic;
  color: #555;
  max-width: 600px;
  margin: 0 auto;
}

.elegant-template .experience-item,
.elegant-template .education-item {
  margin-bottom: 2rem;
  text-align: center;
  padding: 1.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  background: #fafafa;
}

.elegant-template .item-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: #8b5a3c;
  margin-bottom: 0.5rem;
}

.elegant-template .item-company {
  font-size: 1.1rem;
  color: #666;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.elegant-template .item-duration {
  color: #888;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.elegant-template .item-description {
  color: #555;
  line-height: 1.7;
  font-size: 1rem;
}

.elegant-template .skills-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.elegant-template .skill-item {
  background: #8b5a3c;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Animations */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Print Styles */
@media print {
  body {
    background: white !important;
  }

  .app-header,
  .input-panel,
  .preview-header,
  .zoom-controls {
    display: none !important;
  }

  .main-content {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
  }

  .preview-panel {
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  .preview-container {
    padding: 0 !important;
    background: white !important;
  }

  .resume-preview {
    width: 100% !important;
    min-height: auto !important;
    box-shadow: none !important;
    margin: 0 !important;
    transform: none !important;
  }

  @page {
    margin: 0;
    size: A4;
  }
}

/* Responsive Design */
@media (max-width: 1200px) {
  .main-content {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .resume-preview {
    width: 100%;
    transform: scale(0.8);
  }
}

@media (max-width: 768px) {
  .header-content {
    padding: 0 1rem;
    flex-direction: column;
    gap: 1rem;
  }

  .main-content {
    padding: 1rem;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .resume-preview {
    transform: scale(0.6);
  }

  .classic-template {
    grid-template-columns: 1fr;
  }

  .classic-template .sidebar {
    order: 2;
  }

  .creative-template .resume-header {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .app-title {
    font-size: 1.25rem;
  }

  .header-controls {
    flex-direction: column;
    gap: 0.5rem;
  }

  .contact-info {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .resume-preview {
    transform: scale(0.5);
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center {
  text-align: center;
}

.mb-0 {
  margin-bottom: 0;
}
.mb-1 {
  margin-bottom: 0.5rem;
}
.mb-2 {
  margin-bottom: 1rem;
}
.mb-3 {
  margin-bottom: 1.5rem;
}
.mb-4 {
  margin-bottom: 2rem;
}

.fade-in {
  animation: fadeIn 0.5s ease-in;
}
