@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #4f46e5;
  --primary-hover: #4338ca;
  --bg-color: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --success-color: #10b981;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', sans-serif;
}

body {
  background: var(--bg-color);
  background-image: radial-gradient(circle at top right, rgba(79, 70, 229, 0.15), transparent 40%),
                    radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent 40%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Navbar Styles */
.navbar {
  width: 100%;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 0.75rem 2rem;
  display: flex;
  justify-content: center;
}

.navbar-content {
  width: 100%;
  max-width: 1000px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
}

.navbar-logo {
  height: 42px;
  width: auto;
  border-radius: 8px;
}

.company-name {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.navbar-links {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
  opacity: 0.7;
}

.nav-link:hover {
  opacity: 1;
  color: #818cf8;
}

.container {
  width: 100%;
  max-width: 900px;
  margin: 2rem 0;
  padding: 0 1rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(to right, #818cf8, #c084fc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Glassmorphism Cards */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  animation: slideUp 0.4s ease-out;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-size: 0.95rem;
  gap: 0.5rem;
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-danger {
  background: transparent;
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

.btn-danger:hover {
  background: var(--danger-color);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="password"],
textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

textarea {
  resize: vertical;
  min-height: 200px;
}

/* List/Table */
.report-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.report-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  transition: background 0.2s ease;
}

.report-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.report-item-info strong {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.report-item-info span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.report-actions {
  display: flex;
  gap: 0.5rem;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* PDF Preview container */
#pdfPreviewContainer {
  width: 100%;
  height: 600px;
  border: none;
  border-radius: 8px;
  background: #fff;
  margin-top: 1.5rem;
  display: none;
}

#reportContentToPdf {
  background: white;
  color: black;
  padding: 0px 40px 20px 10px;
  border-radius: 8px;
  margin-top: 0;
}

#reportContentToPdf h1,
#reportContentToPdf h2,
#reportContentToPdf h3 {
  background: none;
  -webkit-text-fill-color: black;
  color: black;
  margin-top: 1rem;
  margin-bottom: 0.3rem;
}
#reportContentToPdf p,
#reportContentToPdf li {
  white-space: pre-wrap;
  line-height: 0.8;
  margin: 0.1rem 0;
}

/* Structured Form Styles */
.form-section {
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 8px;
  background: rgba(0,0,0,0.2);
}
.form-section legend {
  font-weight: 600;
  color: #c084fc;
  background: var(--bg-color);
  padding: 0 10px;
  border-radius: 4px;
}
.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row > .form-group {
  flex: 1;
  min-width: 250px;
}
.half {
  flex: 0 0 calc(50% - 0.5rem) !important;
}
.radio-group label, .inline-checkboxes label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 1.5rem;
  margin-bottom: 0.5rem;
  font-weight: normal;
  color: var(--text-main);
  cursor: pointer;
}
.inline-checkboxes input[type="text"] {
  width: auto;
  display: inline-block;
  padding: 0.4rem;
  margin-left: 0.5rem;
}
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.8rem;
}
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  cursor: pointer;
}


.loader {
  display: none;
  border: 3px solid rgba(255,255,255,0.1);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
  margin: 1rem auto;
}

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

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

/* Custom Grouping Table */
.custom-table-container {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}
.group-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 650px;
  background: rgba(15, 23, 42, 0.4);
}
.group-table th, .group-table td {
  border: 1px solid var(--border-color);
  padding: 0.5rem;
  text-align: left;
  font-size: 0.9rem;
}
.group-table th {
  background: rgba(255,255,255,0.05);
  font-weight: 600;
}
.tbl-input {
  width: 100%;
  background: rgba(255,255,255,0.02);
  border: 1px solid transparent;
  color: var(--text-main);
  padding: 0.4rem;
  border-radius: 4px;
  transition: all 0.2s;
}
.tbl-input:focus, .tbl-input:hover {
  background: rgba(0,0,0,0.2);
  border-color: var(--border-color);
  outline: none;
}
.header-row th {
  font-size: 0.85rem;
  background: rgba(79, 70, 229, 0.1);
}
.section-title td {
  background: rgba(255,255,255,0.02);
}

/* Review Page specific styling for output table */
.review-table th, .review-table td {
  color: black;
  border-color: #ccc;
  font-size: 14px;
}
.review-table .header-row th {
  background: #f0f0f0;
}
.review-table {
  background: transparent;
  margin-top: 1rem;
}

/* Selection Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  padding: 2.5rem;
  border-radius: 20px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal-content h3 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-main);
}

.selection-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.selection-btn {
  padding: 1.2rem;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  display: block;
}

.selection-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-hover);
  transform: translateY(-3px);
  color: white;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* PDF Print Fixes */
@media print {
  #reportContentToPdf {
    color: black !important;
    background: white !important;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  #reportContentToPdf * {
    box-sizing: border-box !important;
  }
  #reportContentToPdf table {
    width: 100% !important;
    table-layout: fixed !important;
  }
  #reportContentToPdf td, #reportContentToPdf th {
    word-break: break-all !important;
    overflow: hidden !important;
  }
  #reportContentToPdf tr {
    page-break-inside: avoid !important;
    page-break-after: auto !important;
  }
  #reportContentToPdf thead {
    display: table-header-group !important;
  }
  h2 {
    page-break-after: avoid !important;
  }
}
