/* Reset and Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

/* Header */
header {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  color: white;
  padding: 30px 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

header h1 {
  font-size: 32px;
  font-weight: 600;
  margin-bottom: 8px;
}

header p {
  font-size: 16px;
  opacity: 0.95;
}

/* Main Container */
.main-container {
  display: flex;
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
  gap: 20px;
}

/* Sidebar */
.sidebar {
  width: 300px;
  min-width: 300px;
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  height: fit-content;
  position: sticky;
  top: 20px;
}

.sidebar h2 {
  font-size: 20px;
  color: #1e3c72;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e8edf2;
}

/* Accordion */
.accordion-item {
  margin-bottom: 12px;
  border: 1px solid #e0e4e8;
  border-radius: 6px;
  overflow: hidden;
  background: white;
}

.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: #f8fafc;
  cursor: pointer;
  font-weight: 600;
  color: #2a5298;
  transition: all 0.3s ease;
  user-select: none;
}

.accordion-header:hover {
  background: #eef2f7;
}

.accordion-header.active {
  background: #2a5298;
  color: white;
}

.accordion-arrow {
  transition: transform 0.3s ease;
  font-size: 12px;
}

.accordion-header.active .accordion-arrow {
  transform: rotate(-180deg);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  background: white;
}

.accordion-content.active {
  max-height: 400px;
  padding: 15px;
  border-top: 1px solid #e0e4e8;
}

/* Search Box */
.search-box {
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 10px;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.search-box:focus {
  outline: none;
  border-color: #2a5298;
  box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

/* Select All Label */
.select-all-label {
  display: block;
  padding: 8px 0;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2a5298;
  border-bottom: 1px solid #e8edf2;
  cursor: pointer;
}

.select-all-label input {
  margin-right: 6px;
  cursor: pointer;
}

/* Checkbox Panel */
.checkbox-panel {
  max-height: 220px;
  overflow-y: auto;
  padding: 5px 0;
}

.checkbox-panel::-webkit-scrollbar {
  width: 6px;
}

.checkbox-panel::-webkit-scrollbar-track {
  background: #f1f3f5;
  border-radius: 3px;
}

.checkbox-panel::-webkit-scrollbar-thumb {
  background: #c1c9d2;
  border-radius: 3px;
}

.checkbox-panel::-webkit-scrollbar-thumb:hover {
  background: #a8b3c1;
}

.checkbox-panel label {
  display: block;
  padding: 6px 8px;
  margin: 2px 0;
  cursor: pointer;
  transition: background 0.2s;
  border-radius: 4px;
  font-size: 14px;
}

.checkbox-panel label:hover {
  background: #f8fafc;
}

.checkbox-panel input[type="checkbox"] {
  margin-right: 8px;
  cursor: pointer;
}

/* Primary Button */
.primary-btn {
  width: 100%;
  padding: 12px 20px;
  margin-top: 20px;
  background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 6px rgba(42, 82, 152, 0.3);
}

.primary-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(42, 82, 152, 0.4);
}

.primary-btn:active {
  transform: translateY(0);
}

/* Content Area */
.content-area {
  flex: 1;
  min-width: 0;
}

/* View Controls */
.view-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  background: white;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.view-btn {
  flex: 1;
  padding: 12px 24px;
  background: #f8fafc;
  color: #5a6c7d;
  border: 2px solid #e0e4e8;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.view-btn:hover {
  background: #eef2f7;
  border-color: #c1c9d2;
}

.view-btn.active {
  background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
  color: white;
  border-color: #2a5298;
  box-shadow: 0 2px 8px rgba(42, 82, 152, 0.3);
}

/* Placeholder Message */
.placeholder-message {
  background: white;
  border-radius: 8px;
  padding: 60px 40px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.placeholder-message h2 {
  color: #1e3c72;
  font-size: 28px;
  margin-bottom: 12px;
}

.placeholder-message h3 {
  color: #2a5298;
  font-size: 24px;
  margin-bottom: 10px;
}

.placeholder-message p {
  color: #5a6c7d;
  font-size: 16px;
}

/* View Container */
.view-container {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* Table Controls */
.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-btn {
  padding: 10px 20px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.secondary-btn:hover {
  background: #218838;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
}

.pagination-controls label {
  font-size: 14px;
  color: #5a6c7d;
  font-weight: 600;
}

.pagination-controls select {
  padding: 6px 10px;
  margin-left: 8px;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

/* Table Wrapper */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid #e0e4e8;
  border-radius: 6px;
  margin-bottom: 15px;
}

/* Table Styles */
#dataTable {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

#dataTable thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

#dataTable th {
  background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
  color: white;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid #1e3c72;
}

#dataTable th:first-child {
  position: sticky;
  left: 0;
  z-index: 11;
  min-width: 250px;
  max-width: 250px;
  white-space: normal;
  background: linear-gradient(135deg, #2a5298 0%, #1e3c72 100%);
}

#dataTable td {
  padding: 10px 16px;
  border-bottom: 1px solid #e8edf2;
  white-space: nowrap;
}

#dataTable td:first-child {
  position: sticky;
  left: 0;
  background: white;
  z-index: 5;
  min-width: 250px;
  max-width: 250px;
  white-space: normal;
  font-weight: 600;
  color: #2a5298;
  border-right: 2px solid #e0e4e8;
}

#dataTable tbody tr:nth-child(even) td:first-child {
  background: #f8fafc;
}

#dataTable tbody tr:hover td {
  background: #f0f4f8;
}

#dataTable tbody tr:hover td:first-child {
  background: #e8edf2;
}

/* Pagination Footer */
.pagination-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
  flex-wrap: wrap;
  gap: 10px;
}

.pagination-info {
  font-size: 14px;
  color: #5a6c7d;
  font-weight: 600;
}

.pagination-buttons {
  display: flex;
  gap: 8px;
}

.pagination-btn {
  padding: 8px 16px;
  background: #f8fafc;
  color: #2a5298;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
  background: #eef2f7;
  border-color: #2a5298;
}

.pagination-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Chart Controls */
.chart-controls {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.chart-select {
  flex: 1;
  min-width: 250px;
}

.chart-select label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #2a5298;
  margin-bottom: 6px;
}

.chart-dropdown {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d7de;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  background: white;
  transition: border-color 0.2s;
}

.chart-dropdown:focus {
  outline: none;
  border-color: #2a5298;
  box-shadow: 0 0 0 3px rgba(42, 82, 152, 0.1);
}

/* Chart Canvas Wrapper */
.chart-canvas-wrapper {
  position: relative;
  height: 400px;
  padding: 20px 0;
}

/* Footer */
footer {
  background: #1e3c72;
  color: white;
  text-align: center;
  padding: 20px;
  margin-top: 40px;
}

footer p {
  font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .main-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: static;
  }

  .content-area {
    width: 100%;
  }
}

@media (max-width: 768px) {
  header h1 {
    font-size: 24px;
  }

  header p {
    font-size: 14px;
  }

  .view-controls {
    flex-direction: column;
  }

  .view-btn {
    width: 100%;
  }

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

  .pagination-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  #dataTable th:first-child,
  #dataTable td:first-child {
    min-width: 180px;
    max-width: 180px;
  }
}
