/* Modern Veterinary Lab Catalog Styles */
:root {
  --primary-color: #2c5530;
  --secondary-color: #8fbc8f;
  --accent-color: #daa520;
  --text-color: #333;
  --light-bg: #f8f9fa;
  --border-color: #dee2e6;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background: linear-gradient(135deg, var(--light-bg) 0%, #e8f5e8 100%);
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 30px;
  padding: 30px;
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--secondary-color) 100%
  );
  color: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="paw" x="0" y="0" width="20" height="20" patternUnits="userSpaceOnUse"><circle cx="5" cy="5" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="15" cy="15" r="2" fill="rgba(255,255,255,0.1)"/><circle cx="5" cy="15" r="1.5" fill="rgba(255,255,255,0.1)"/><circle cx="15" cy="5" r="1.5" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23paw)"/></svg>');
  opacity: 0.3;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 1;
}

.lab-info h2 {
  font-size: 1.5rem;
  margin-bottom: 5px;
  position: relative;
  z-index: 1;
}

.lab-info p {
  font-size: 1.1rem;
  opacity: 0.9;
  position: relative;
  z-index: 1;
}

/* Tab Navigation */
.tabs {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
  border-bottom: 2px solid var(--border-color);
  background: white;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.tab-button {
  flex: 1;
  padding: 15px 20px;
  background: var(--light-bg);
  border: none;
  border-right: 1px solid var(--border-color);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
  transition: all 0.3s ease;
  position: relative;
}

.tab-button:last-child {
  border-right: none;
}

.tab-button:hover {
  background: var(--secondary-color);
  color: white;
}

.tab-button.active {
  background: var(--primary-color);
  color: white;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-button.active::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-color);
}

.tab-button.locked {
  opacity: 0.5;
  cursor: not-allowed;
  position: relative;
}

.tab-button.locked::after {
  content: "🔒";
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  font-size: 14px;
}

/* Tab Content */
.tab-content {
  background: white;
  border-radius: 0 0 15px 15px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tab-pane {
  display: none;
  padding: 30px;
}

.tab-pane.active {
  display: block;
}

/* Content with Preview Layout */
.content-with-preview {
  display: grid;
  grid-template-columns: 8fr 4fr;
  gap: 30px;
  align-items: start;
}

.main-content {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.preview-sidebar {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 20px;
  height: fit-content;
}

/* Tab Controls */
.tab-controls {
  margin-bottom: 30px;
}

.tab-controls h3 {
  color: var(--primary-color);
  margin-bottom: 20px;
  font-size: 1.5rem;
  text-align: center;
}

.control-group {
  margin-bottom: 20px;
}

.control-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--primary-color);
}

.tab-info {
  background: rgba(44, 85, 48, 0.05);
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  margin-top: 20px;
}

.tab-info p {
  margin: 0;
  color: var(--text-color);
  font-size: 0.95rem;
}

/* Presets Management Styles */
.presets-management {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid var(--border-color);
}

.presets-management h3 {
  color: var(--primary-color);
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.5rem;
}

.presets-controls {
  background: rgba(44, 85, 48, 0.05);
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  border-left: 4px solid var(--primary-color);
}

.preset-buttons {
  display: flex;
  gap: 15px;
  margin-top: 15px;
}

.btn-danger {
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.presets-list {
  margin-top: 20px;
}

.presets-list h4 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.presets-list-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
}

.preset-item {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
}

.preset-item:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.preset-item.selected {
  border-color: var(--accent-color);
  background: rgba(218, 165, 32, 0.1);
}

.preset-item h5 {
  margin: 0 0 5px 0;
  color: var(--primary-color);
  font-size: 1.1rem;
}

.preset-item p {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

.preset-item .preset-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 5px;
}

.preset-item .preset-actions button {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.preset-item .preset-actions button:hover {
  background: #f8f9fa;
  color: var(--primary-color);
}

/* Visual Customization */
.visual-customization {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid var(--border-color);
}

.visual-customization h3 {
  color: var(--primary-color);
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.5rem;
}

.customization-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-bottom: 30px;
}

.customization-section {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.customization-section h4 {
  color: var(--primary-color);
  margin-bottom: 15px;
  font-size: 1.1rem;
  border-bottom: 2px solid var(--secondary-color);
  padding-bottom: 8px;
}

.customization-section .control-group {
  margin-bottom: 15px;
}

.customization-section .control-group:last-child {
  margin-bottom: 0;
}

.customization-section label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.9rem;
}

.customization-section input[type="color"] {
  width: 60px;
  height: 40px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  cursor: pointer;
}

.customization-section select {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  font-size: 0.9rem;
  background: white;
}

.customization-section input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-right: 8px;
  accent-color: var(--primary-color);
}

.customization-section input[type="checkbox"] + label {
  display: inline;
  margin-bottom: 0;
}

/* PDF Previews */
.pdf-previews {
  margin-top: 40px;
  padding-top: 30px;
  border-top: 2px solid var(--border-color);
}

.pdf-previews h3 {
  color: var(--primary-color);
  margin-bottom: 20px;
  text-align: center;
  font-size: 1.5rem;
}

.preview-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 20px;
}

.preview-item {
  background: white;
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-item h4 {
  background: var(--primary-color);
  color: white;
  margin: 0;
  padding: 15px 20px;
  font-size: 1.1rem;
  text-align: center;
}

.preview-canvas {
  position: relative;
  width: 100%;
  height: 400px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.preview-placeholder {
  text-align: center;
  color: var(--text-color);
  opacity: 0.7;
}

.preview-placeholder p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.4;
}

.preview-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 5px;
}

@media (max-width: 768px) {
  .preview-canvas {
    height: 300px;
  }
}

.image-selectors {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
}

.image-selector {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.image-selector label {
  font-weight: bold;
  color: var(--primary-color);
}

.image-options {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
}

.image-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 10px;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.image-option:hover {
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.image-option.selected {
  border-color: var(--accent-color);
  background: rgba(218, 165, 32, 0.1);
}

.thumbnail {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.no-image {
  width: 60px;
  height: 60px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--light-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-color);
  text-align: center;
}

.image-option span {
  font-size: 12px;
  text-align: center;
  max-width: 70px;
  word-wrap: break-word;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary-color) 0%,
    var(--accent-color) 100%
  );
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  background: linear-gradient(
    135deg,
    var(--secondary-color) 0%,
    var(--primary-color) 100%
  );
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.btn-primary:disabled,
.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow);
}

select {
  padding: 10px 15px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
}

.catalog-preview {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: var(--shadow);
  min-height: 600px;
}

.category-section {
  margin-bottom: 40px;
  page-break-inside: avoid;
}

.category-header {
  background: linear-gradient(
    135deg,
    var(--secondary-color) 0%,
    var(--primary-color) 100%
  );
  color: white;
  padding: 15px 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.category-header h3 {
  font-size: 1.5rem;
  margin-bottom: 5px;
}

.category-header p {
  opacity: 0.9;
  font-size: 0.9rem;
}

.exam-item {
  display: grid;
  grid-template-columns: 3fr 2fr 1fr 1fr;
  gap: 15px;
  padding: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 10px;
  background: rgba(248, 249, 250, 0.7);
  transition: all 0.3s ease;
}

.exam-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.exam-name {
  font-weight: bold;
  color: var(--primary-color);
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  line-height: 1.3;
  max-width: 100%;
  min-width: 0;
  hyphens: auto;
}

.exam-sample {
  font-style: italic;
  color: #666;
}

.exam-deadline {
  text-align: center;
}

.exam-price {
  text-align: right;
  font-weight: bold;
  color: var(--accent-color);
}

.data-source-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.data-source-controls select {
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
}

.data-source-controls input[type="text"] {
  padding: 8px 12px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
}

.exam-controls {
  grid-column: 1 / -1;
  display: flex;
  gap: 15px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
}

.exam-controls .toggle-btn {
  position: relative;
  width: 50px;
  height: 24px;
  background: #ccc;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.exam-controls .toggle-btn.active {
  background: var(--primary-color);
}

.exam-controls .toggle-btn::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.exam-controls .toggle-btn.active::after {
  transform: translateX(26px);
}

.exam-controls label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--primary-color);
  cursor: pointer;
}

.exam-controls input[type="text"] {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
}

.profile-exam {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border: 2px solid var(--accent-color);
}

.profile-components {
  grid-column: 1 / -1;
  margin-top: 10px;
  padding: 10px;
  background: rgba(218, 165, 32, 0.1);
  border-radius: 5px;
  border-left: 3px solid var(--accent-color);
}

.profile-components h4 {
  font-size: 0.9rem;
  color: var(--primary-color);
  margin-bottom: 5px;
}

.component-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.component-item {
  background: var(--accent-color);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
}

.loading {
  text-align: center;
  padding: 50px;
  font-size: 1.2rem;
  color: var(--primary-color);
}

.error {
  background: #f8d7da;
  color: #721c24;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #f5c6cb;
  margin: 20px 0;
}

.info {
  text-align: center;
  padding: 50px;
  font-size: 1.2rem;
  color: var(--primary-color);
  background: var(--light-bg);
  border-radius: 8px;
  border: 2px solid var(--secondary-color);
}

@media print {
  body {
    background: white;
  }

  .container {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  .controls {
    display: none;
  }

  .catalog-preview {
    box-shadow: none;
    border-radius: 0;
    padding: 20px;
  }

  .exam-item {
    page-break-inside: avoid;
  }
}

/* Search and Filters */
.search-filters {
  background: rgba(44, 85, 48, 0.05);
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid var(--border-color);
}

.search-group {
  display: flex;
  gap: 15px;
  align-items: center;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 15px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.1);
}

.filter-select {
  min-width: 150px;
  padding: 10px 15px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.1);
}

/* Notifications */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--primary-color);
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 1000;
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
  max-width: 300px;
}

.notification.show {
  transform: translateX(0);
  opacity: 1;
}

.notification.success {
  background: var(--primary-color);
}

.notification.warning {
  background: var(--accent-color);
}

.notification.error {
  background: #dc3545;
}

.notification.info {
  background: var(--secondary-color);
}

.notification-close {
  position: absolute;
  top: 5px;
  right: 10px;
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-close:hover {
  opacity: 0.8;
}

/* Loading Spinner */
.loading::before {
  content: "";
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(44, 85, 48, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
  margin-right: 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Enhanced Responsiveness */
@media (max-width: 992px) {
  .content-with-preview {
    grid-template-columns: 1fr;
  }

  .preview-sidebar {
    position: relative;
    top: 0;
    margin-top: 30px;
  }
}

@media (max-width: 768px) {
  .exam-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .exam-price,
  .exam-deadline {
    text-align: left;
  }

  header h1 {
    font-size: 2rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .search-group {
    flex-direction: column;
    align-items: stretch;
  }

  .search-input,
  .filter-select {
    min-width: auto;
    width: 100%;
  }

  .notification {
    left: 20px;
    right: 20px;
    max-width: none;
  }

  .tabs {
    flex-direction: column;
  }

  .tab-button {
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }

  .tab-button:last-child {
    border-bottom: none;
  }

  .customization-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .preview-container {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  header {
    padding: 20px;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .tab-pane {
    padding: 20px;
  }

  .exam-controls {
    flex-direction: column;
    gap: 10px;
  }

  .exam-controls .toggle-btn {
    align-self: flex-start;
  }
}

/* Wizard Progress */
.wizard-progress {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
  padding: 20px 0;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
  color: #ccc;
  transition: all 0.3s ease;
}

.step.active {
  color: var(--primary-color);
}

.step-number {
  width: 40px;
  height: 40px;
  background: white;
  border: 2px solid #ccc;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 8px;
  transition: all 0.3s ease;
}

.step.active .step-number {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
  box-shadow: 0 0 0 4px rgba(44, 85, 48, 0.2);
}

.step-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.step-line {
  flex: 0 0 150px;
  height: 3px;
  background: #e0e0e0;
  margin: -25px 15px 0;
  position: relative;
  z-index: 1;
}

/* Wizard Content */
.wizard-content {
  background: white;
  border-radius: 15px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 400px;
}

.step-pane {
  display: none;
  padding: 30px;
}

.step-pane.active {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Wizard Actions */
.wizard-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.large-btn {
  padding: 15px 30px;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-success {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Helper Classes */
.hidden {
  display: none !important;
}

/* New Step 1 Layout */
.visual-step-container {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 30px;
  height: calc(100vh - 200px);
  min-height: 600px;
}

.visual-controls-panel {
  overflow-y: auto;
  padding-right: 15px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  order: 1;
}

.big-preview-panel {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  border: 1px solid #e0e0e0;
  order: 2;
}

.preview-canvas-large {
  flex: 1;
  background: white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Editor de camadas (Fabric) */
.preview-canvas-large canvas.editor-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.preview-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.layer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: rgba(44, 85, 48, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  margin-bottom: 10px;
}

.layer-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.layer-toolbar-actions input[type="range"] {
  width: 140px;
}

.mini-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* New Step 2 Layout */
.step-2-container {
  display: grid;
  grid-template-columns: 250px 1fr 250px;
  gap: 20px;
  height: calc(100vh - 200px);
  min-height: 600px;
}

/* Category Sidebar */
.category-sidebar {
  background: #f8f9fa;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  border-radius: 8px 0 0 8px;
  overflow: hidden;
}

.category-sidebar h3 {
  padding: 15px;
  margin: 0;
  font-size: 1.1rem;
  background: #fff;
  border-bottom: 1px solid #eee;
}

.category-list {
  overflow-y: auto;
  flex: 1;
}

.category-item {
  padding: 12px 15px;
  cursor: pointer;
  border-bottom: 1px solid #eee;
  transition: all 0.2s;
  font-size: 0.95rem;
  color: #555;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.category-item:hover {
  background: #e9ecef;
  padding-left: 20px;
}

.category-item.active {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
}

/* Main Exam Area */
.exam-area {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 0 10px;
  overflow: hidden;
}

.exam-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.search-box {
  flex: 1;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid #ddd;
  border-radius: 20px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--primary-color);
}

#catalogPreview {
  flex: 1;
  overflow-y: auto;
  padding-right: 5px;
}

/* Summary Sidebar */
.summary-sidebar {
  background: #f8f9fa;
  border-left: 1px solid #ddd;
  padding: 20px;
  border-radius: 0 8px 8px 0;
}

.summary-stats p {
  margin-bottom: 10px;
  font-size: 1rem;
}

.mini-cover {
  width: 100%;
  height: 300px; /* A4 aspect ratio approx */
  background: white;
  border: 1px solid #ddd;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-top: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .step-2-container {
    grid-template-columns: 200px 1fr 200px;
  }
}

@media (max-width: 900px) {
  .visual-step-container {
    grid-template-columns: 1fr;
    height: auto;
  }

  .big-preview-panel {
    height: 500px;
    order: -1; /* Preview first on mobile */
  }

  .step-2-container {
    grid-template-columns: 1fr;
    height: auto;
  }

  .category-sidebar,
  .summary-sidebar {
    height: auto;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
  }

  /* PDF Progress Overlay */
  .pdf-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
  }

  .pdf-progress-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    min-width: 300px;
  }

  .pdf-progress-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2c5530;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
  }

  @keyframes spin {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }

  .pdf-progress-text {
    font-size: 16px;
    color: #333;
    margin-bottom: 15px;
  }

  .pdf-progress-bar {
    width: 100%;
    height: 10px;
    background: #f0f0f0;
    border-radius: 5px;
    overflow: hidden;
  }

  .pdf-progress-fill {
    height: 100%;
    background: #2c5530;
    width: 0%;
    transition: width 0.3s ease;
  }
}
