* {
  margin: 0;
  padding-top: 0;
  box-sizing: border-box;
}

:root {
  --color-background: #0a0a0f;
  --color-surface: #1a1a24;
  --color-surface-elevated: #252535;
  --color-primary: #8b5cf6;
  --color-primary-hover: #7c3aed;
  --color-accent: #06b6d4;
  --color-text: black;
  --color-text-muted: #94a3b8;
  --color-border: #2d2d3d;

  /* Added lightning blue and neon purple for folder system */
  --color-lightning-blue: #00d4ff;
  --color-neon-purple: #b026ff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: white;
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Header */

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo a {
  text-decoration: none;
  color: inherit;
}

/* Optional: ensure icons don't shrink */
.tab-icon {
  flex-shrink: 0;
}

/* Optional: hide tab-label on small screens */
@media (max-width: 768px) {
  .tab-label {
    display: none;
  }
}

.tab-label {
  font-weight: 500;
}

/* Smooth transitions */

/* Dashboard styles */

/* Complete redesign of main content area styling - modern, sleek, organized */

/* Redesigned main content area with modern spacing and styling */
.reports-main {
  padding: 0.5rem;
  min-height: 100vh;
  background:white;
  margin-top: 70px;
}

/* Enhanced header with better visual hierarchy */
.reports-header {
  margin-bottom: 3rem;
  animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
}

.reports-header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--color-text);
  letter-spacing: -0.5px;
}

.header-subtitle {
  font-size: 1rem;
  color: var(--color-text-muted);
  font-weight: 400;
}

/* Modern reports container with card-based layout */
.reports-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.reports-section {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 16px;
  padding: 2rem;
  overflow: hidden;
  transition: all 0.3s ease;
}

.reports-section:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.08);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px solid var(--color-border);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.3px;
}

.report-count {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(6, 182, 212, 0.1));
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid rgba(139, 92, 246, 0.2);
}

/* Card-based reports gallery with hover effects */
.reports-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.75rem;
}

.saved-report {
  display: flex;
  flex-direction: column;
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 1.75rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.saved-report::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.saved-report:hover {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(6, 182, 212, 0.05) 100%);
  
}

.saved-report:hover::before {
  opacity: 1;
}

.saved-report strong {
  font-size: 1.1rem;
  color: var(--color-text);
  margin-bottom: 1rem;
  display: block;
  word-break: break-word;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.saved-report-meta {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.saved-report-meta span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.saved-report-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.saved-report .btn {
  flex: 1;
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  justify-content: center;
}

/* Empty state styling */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-muted);
}

.empty-state-icon {
  font-size: 4rem;
  margin-bottom: 1.5rem;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.4rem;
  color: var(--color-text);
  margin-bottom: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.empty-state p {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  letter-spacing: 0.3px;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1rem;
  border-radius: 10px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: white;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.9375rem;
  width: 155px;
  height: 45px;
  margin-right: 20px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background-color: #00d4ff;
  color: white;
  border: 1px solid #00d4ff;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  background-color: #00d4ff;
  color: white;
  border: 1px solid #00d4ff;
   transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
}

.btn-icon {
  font-size: 1.2rem;
  font-weight: 700;
}

/* Enhanced modal with overlay and better styling */
.reports-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1001;
}

.reports-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.reports-modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 90%;
  max-width: 1100px;
  max-height: 85vh;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, -45%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2rem;
  border-bottom: 1px solid var(--color-border);
  background: linear-gradient(135deg, var(--color-surface) 0%, rgba(139, 92, 246, 0.03) 100%);
}

.modal-title-section h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  letter-spacing: -0.4px;
}

.modal-title-section p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.modal-close:hover {
  color: var(--color-text);
  background: var(--color-surface-elevated);
}

/* Enhanced report builder form layout */
.report-builder-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding: 2rem;
  gap: 1.75rem;
}

.report-builder-header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--color-border);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group input,
.form-group select {
  padding: 0.85rem;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  color: var(--color-text);
  font-size: 0.9rem;
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(139, 92, 246, 0.05);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.form-group input::placeholder {
  color: var(--color-text-muted);
}

.custom-date-inputs {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 8px;
  border: 1px solid var(--color-border);
}

.custom-date-inputs input {
  flex: 1;
  padding: 0.75rem;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  color: var(--color-text);
  font-size: 0.9rem;
}

      /* View Report Page Styles */
      .view-report-main {
          padding: 2.5rem;
          background:white;
      }

      .header-content-view {
          display: flex;
          justify-content: space-between;
          align-items: center;
          gap: 2rem;
          padding: 2rem;
          background-color: #f8f9fa;
          border: 1px solid #e9ecef;
          border-radius: 16px;
          margin-bottom: 2rem;
      }

      .header-content-view h1 {
          font-size: 1.75rem;
          font-weight: 700;
          color: var(--color-text);
          margin: 0;
          letter-spacing: -0.3px;
      }

      .report-actions {
          display: flex;
          gap: 0.75rem;
      }

      .report-actions .btn {
          padding: 0.65rem 1.25rem;
          font-size: 0.8rem;
      }

      /* Report Viewer Full */
      .report-viewer-full {
         background-color: #f8f9fa;
          border: 1px solid #e9ecef;
          border-radius: 16px;
          overflow: hidden;
          box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
      }

      .report-content-full {
          padding: 2rem;
          overflow-x: auto;
          max-height: calc(100vh - 400px);
      }

      .report-content-full table {
          width: 100%;
          border-collapse: collapse;
          font-size: 0.85rem;
      }

      .report-content-full th,
      .report-content-full td {
          border: 1px solid var(--color-border);
          padding: 1rem;
          text-align: left;
      }

      .report-content-full th {
          background: white;
          font-weight: 700;
          color: black;
          position: sticky;
          top: 0;
          z-index: 10;
          text-transform: uppercase;
          font-size: 0.75rem;
          letter-spacing: 0.05em;
      }

      .report-content-full td {
          color: black;
      }

      .report-content-full tbody tr:hover {
          background: rgba(139, 92, 246, 0.08);
      }

      @media (max-width: 768px) {
          .view-report-main {
              padding: 1.5rem;
          }

          .header-content-view {
              flex-direction: column;
              align-items: flex-start;
          }

          .report-actions {
              width: 100%;
              flex-wrap: wrap;
          }

          .report-content-full {
              padding: 1.5rem;
          }
      }

/* Added new two-column layout styles for create report page */

/* Create Report Two-Column Layout */
.create-report-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 2rem;
  align-items: start;
  max-width: 100%; /* Prevent the grid from growing beyond viewport width */
  overflow: hidden; /* */
}

/* Fields Panel (Left Side) */
.fields-panel {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 16px;
  overflow: hidden;
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
}

.fields-panel-header {
  padding: 1.5rem;
  border-bottom: 2px solid var(--color-border);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, transparent 100%);
}

.fields-panel-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 0.5rem 0;
  letter-spacing: -0.2px;
}

.fields-panel-header p {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin: 0;
}

.fields-panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

/* Field Categories */
.field-category {
  margin-bottom: 0.75rem;
}

.category-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  color: var(--color-text);
  font-family: inherit;
}

.category-toggle:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(6, 182, 212, 0.05) 100%);
  border-color: var(--color-primary);
}

.category-toggle .toggle-icon {
  font-size: 0.75rem;
  transition: transform 0.3s ease;
  color: var(--color-accent);
}

.category-toggle.collapsed .toggle-icon {
  transform: rotate(-90deg);
}

.category-toggle h3 {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.category-fields {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 400px;
  overflow-y: auto;
}

.category-fields.collapsed {
  display: none;
}

.field-checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 6px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.field-checkbox-wrapper:hover {
  background: rgba(139, 92, 246, 0.12);
  transform: translateX(4px);
}

.field-checkbox-wrapper input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--color-primary);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.field-checkbox-wrapper label {
  cursor: pointer;
  flex: 1;
  font-size: 0.85rem;
  color: var(--color-text);
  text-transform: capitalize;
}

/* Config and Preview Panel (Right Side) */
.config-preview-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0; /* Constrain the right panel to prevent horizontal overflow */
  max-width: 100%; /* */
}

.report-form {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 100%; /* Ensure form doesn't grow beyond its container */
}

.config-section {
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.3s ease;
  max-width: 100%; /* Prevent sections from growing beyond viewport */
  min-width: 0; /* */
}

.config-section:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.08);
}

.section-heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 1.25rem 0;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--color-border);
  letter-spacing: -0.2px;
}

.form-group-large {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-group-large label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group-large input {
  padding: 1rem;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  color: var(--color-text);
  font-size: 1.1rem;
  font-weight: 600;
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-group-large input:focus {
  outline: none;
  border-color: var(--color-primary);
  background: rgba(139, 92, 246, 0.05);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.filters-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.preview-section {
  min-height: 400px;
  max-width: 100%; /* Prevent preview section from expanding horizontally */
  overflow: hidden; /* */
}

/* Added horizontal scroll container for table preview */
.preview-container {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: white;
  max-width: 100%; /* Constrain the preview container to its parent width */
}

.report-preview-full {
  min-width: 100%;
  width: fit-content;
  max-width: max-content; /* Allow table to overflow within its scroll container */
}

.report-preview-full table {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.report-preview-full th,
.report-preview-full td {
  white-space: nowrap;
  padding: 0.875rem 1rem;
  border: 1px solid var(--color-border);
}

.report-preview-full th {
  background: white;
  font-weight: 700;
  color: var(--color-text);
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 10;
}

.report-preview-full td {
  color: var(--color-text);
  background: white;
}

.report-preview-full tr:hover td {
  background: rgba(139, 92, 246, 0.05);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 2rem;
  background-color: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 16px;
  position: sticky;
  bottom: 0;
  z-index: 50;
}

.form-actions .btn {
  padding: 0.875rem 2.25rem;
  font-size: 0.95rem;
}

/* Responsive Design for Create Report Layout */
@media (max-width: 1200px) {
  .create-report-layout {
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .create-report-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .fields-panel {
    position: relative;
    top: 0;
    max-height: none;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .btn {
    width: 100%;
  }
}
