/**
 * ENHANCED EXPORT SYSTEM STYLES
 * Styling for custom report builder and export UI
 * 
 * @version 1.0.0
 * @date 2025-11-27
 */

/* ===== EXPORT BUILDER MODAL ===== */
.export-builder-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: none;
}

.export-builder-modal.active {
  display: block;
}

.export-builder-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.export-builder-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  background: white;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -45%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.export-builder-header {
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, #003057 0%, #660000 100%);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.export-builder-header h3 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
}

.export-builder-close {
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.export-builder-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.export-builder-body {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
}

.export-builder-section {
  margin-bottom: 2rem;
}

.export-builder-section h4 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  color: #003057;
  font-weight: 600;
}

.export-builder-footer {
  padding: 1rem 2rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* ===== TEMPLATE GRID ===== */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.template-card {
  padding: 1.25rem;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.template-card:hover {
  border-color: #003057;
  box-shadow: 0 4px 12px rgba(0, 48, 87, 0.1);
  transform: translateY(-2px);
}

.template-card.selected {
  border-color: #003057;
  background: rgba(0, 48, 87, 0.05);
  box-shadow: 0 0 0 3px rgba(0, 48, 87, 0.1);
}

.template-card h5 {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: #1f2937;
  font-weight: 600;
}

.template-card p {
  margin: 0;
  font-size: 0.875rem;
  color: #6b7280;
}

/* ===== FIELD SELECTION ===== */
.field-selection {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
}

.field-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  cursor: pointer;
  transition: background 0.2s ease;
  border-radius: 6px;
}

.field-checkbox:hover {
  background: white;
}

.field-checkbox input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  cursor: pointer;
  accent-color: #003057;
}

.field-checkbox span {
  font-size: 0.9375rem;
  color: #374151;
}

/* ===== FORMAT OPTIONS ===== */
.format-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.format-radio {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.format-radio:hover {
  border-color: #003057;
  background: rgba(0, 48, 87, 0.02);
}

.format-radio input[type="radio"] {
  margin-top: 0.25rem;
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: #003057;
}

.format-radio input[type="radio"]:checked ~ span {
  color: #003057;
  font-weight: 600;
}

.format-radio > div {
  flex: 1;
}

.format-radio span {
  display: block;
  font-size: 1rem;
  color: #1f2937;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.format-radio small {
  display: block;
  font-size: 0.875rem;
  color: #6b7280;
}

/* ===== EXPORT OPTIONS ===== */
.export-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.option-checkbox:hover {
  background: #f3f4f6;
}

.option-checkbox input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  cursor: pointer;
  accent-color: #003057;
}

.option-checkbox span {
  font-size: 0.9375rem;
  color: #374151;
}

/* ===== SCHEDULE FORM ===== */
.schedule-form {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  background: #f9fafb;
  border-radius: 8px;
}

.schedule-form label {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.schedule-form label span {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
}

.schedule-form select,
.schedule-form input[type="time"],
.schedule-form input[type="email"] {
  padding: 0.625rem 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-family: inherit;
  transition: all 0.2s ease;
}

.schedule-form select:focus,
.schedule-form input:focus {
  outline: none;
  border-color: #003057;
  box-shadow: 0 0 0 3px rgba(0, 48, 87, 0.1);
}

/* ===== EXPORT BUTTONS ===== */
.export-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.export-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.export-btn-primary {
  background: #003057;
  color: white;
}

.export-btn-primary:hover {
  background: #002040;
}

.export-btn-secondary {
  background: #e5e7eb;
  color: #374151;
}

.export-btn-secondary:hover {
  background: #d1d5db;
}

/* ===== EXPORT MENU (for quick access) ===== */
.export-quick-menu {
  position: relative;
  display: inline-block;
}

.export-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: #003057;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.export-menu-trigger:hover {
  background: #002040;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 48, 87, 0.3);
}

.export-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 250px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
}

.export-quick-menu.active .export-menu-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.export-menu-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
}

.export-menu-header h4 {
  margin: 0;
  font-size: 0.875rem;
  color: #6b7280;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.export-menu-items {
  padding: 0.5rem;
}

.export-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 0.9375rem;
  color: #374151;
}

.export-menu-item:hover {
  background: #f9fafb;
}

.export-menu-item span {
  font-size: 1.25rem;
}

/* ===== DARK MODE SUPPORT ===== */
[data-theme="dark"] .export-builder-container {
  background: #1f2937;
}

[data-theme="dark"] .export-builder-body {
  background: #1f2937;
  color: #f9fafb;
}

[data-theme="dark"] .export-builder-footer {
  background: #111827;
  border-top-color: #374151;
}

[data-theme="dark"] .export-builder-section h4 {
  color: #f9fafb;
}

[data-theme="dark"] .template-card {
  background: #374151;
  border-color: #4b5563;
}

[data-theme="dark"] .template-card:hover {
  border-color: #60a5fa;
}

[data-theme="dark"] .template-card.selected {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, 0.1);
}

[data-theme="dark"] .template-card h5 {
  color: #f9fafb;
}

[data-theme="dark"] .template-card p {
  color: #d1d5db;
}

[data-theme="dark"] .field-selection {
  background: #374151;
}

[data-theme="dark"] .field-checkbox:hover {
  background: #4b5563;
}

[data-theme="dark"] .field-checkbox span {
  color: #f9fafb;
}

[data-theme="dark"] .format-radio {
  background: #374151;
  border-color: #4b5563;
}

[data-theme="dark"] .format-radio:hover {
  background: #4b5563;
  border-color: #60a5fa;
}

[data-theme="dark"] .format-radio span {
  color: #f9fafb;
}

[data-theme="dark"] .format-radio small {
  color: #d1d5db;
}

[data-theme="dark"] .option-checkbox {
  background: #374151;
}

[data-theme="dark"] .option-checkbox:hover {
  background: #4b5563;
}

[data-theme="dark"] .option-checkbox span {
  color: #f9fafb;
}

[data-theme="dark"] .schedule-form {
  background: #374151;
}

[data-theme="dark"] .schedule-form label span {
  color: #f9fafb;
}

[data-theme="dark"] .schedule-form select,
[data-theme="dark"] .schedule-form input {
  background: #4b5563;
  border-color: #6b7280;
  color: #f9fafb;
}

[data-theme="dark"] .export-menu-dropdown {
  background: #1f2937;
}

[data-theme="dark"] .export-menu-header {
  border-bottom-color: #374151;
}

[data-theme="dark"] .export-menu-item {
  color: #f9fafb;
}

[data-theme="dark"] .export-menu-item:hover {
  background: #374151;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .export-builder-container {
    width: 95%;
    max-height: 95vh;
  }
  
  .export-builder-header,
  .export-builder-body,
  .export-builder-footer {
    padding: 1rem;
  }
  
  .template-grid {
    grid-template-columns: 1fr;
  }
  
  .field-selection {
    grid-template-columns: 1fr;
    max-height: 200px;
  }
  
  .format-options {
    gap: 0.75rem;
  }
  
  .format-radio {
    padding: 0.75rem;
  }
}

@media (max-width: 480px) {
  .export-builder-header h3 {
    font-size: 1.25rem;
  }
  
  .export-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  .export-builder-footer {
    flex-direction: column-reverse;
  }
  
  .export-builder-footer .export-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .export-builder-modal,
  .export-quick-menu {
    display: none !important;
  }
}
