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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* Auth Modal */
.modal {
  display: flex;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: white;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.modal-content h2 {
  margin-bottom: 20px;
  color: #667eea;
}

.modal-content p {
  margin-bottom: 20px;
  color: #666;
}

.modal-content input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
  margin-bottom: 20px;
  transition: border-color 0.3s;
}

.modal-content input:focus {
  outline: none;
  border-color: #667eea;
}

.modal-content button {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.modal-content button:hover {
  transform: translateY(-2px);
}

.error-message {
  color: #e74c3c;
  margin-top: 10px;
  font-size: 14px;
}

/* Dashboard */
#dashboard {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
header {
  background: white;
  padding: 20px 30px;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  color: #667eea;
  font-size: 28px;
}

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

.logout-btn:hover {
  background-color: #c0392b;
}

/* Import Section */
.import-section {
  background: white;
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.import-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding-bottom: 10px;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 20px;
  transition: all 0.3s;
}

.import-section-header:hover {
  border-bottom-color: #667eea;
}

.import-section-header h2 {
  margin: 0;
  color: #333;
  font-size: 20px;
}

.toggle-arrow {
  font-size: 18px;
  color: #667eea;
  transition: transform 0.3s;
}

.import-section-content {
  animation: slideDown 0.3s ease-out;
}

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

.import-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.import-tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  color: #777;
  transition: all 0.3s;
}

.import-tab:hover {
  color: #667eea;
}

.import-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
}

.import-form {
  margin-top: 20px;
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.import-group {
  display: flex;
  flex-direction: column;
}

.import-group label {
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
  font-size: 14px;
}

.import-group input,
.import-group select {
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.import-group input:focus,
.import-group select:focus {
  outline: none;
  border-color: #667eea;
}

.import-actions {
  display: flex;
  align-items: flex-end;
}

.btn-import {
  width: 100%;
  padding: 10px 20px;
  background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-import:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
}

.import-info {
  background: #e3f2fd;
  border: 1px solid #2196f3;
  border-radius: 6px;
  padding: 15px;
  margin-bottom: 20px;
}

.import-info p {
  margin: 5px 0;
  color: #1565c0;
  font-size: 14px;
}

.import-info.import-warning {
  background: #fff3cd;
  border: 1px solid #ffc107;
}

.import-info.import-warning p {
  color: #856404;
}

.import-group-wide {
  grid-column: span 2;
}

.label-hint {
  font-size: 12px;
  font-weight: normal;
  color: #999;
  font-style: italic;
}

.import-status {
  background: #e3f2fd;
  border: 1px solid #2196f3;
  border-radius: 6px;
  padding: 20px;
  margin-top: 20px;
}

.import-status-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.import-spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #2196f3;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
}

.import-status-content p {
  margin: 0;
  color: #1976d2;
  font-weight: 600;
}

.import-result {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  padding: 20px;
  margin-top: 20px;
  position: relative;
}

.close-result {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 5px 10px;
  line-height: 1;
}

.close-result:hover {
  color: #333;
}

.import-result h3 {
  margin-bottom: 15px;
  font-size: 18px;
}

.import-result pre {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 15px;
  overflow-x: auto;
  max-height: 300px;
  font-size: 12px;
  line-height: 1.5;
}

/* Filters Section */
.filters-section {
  background: white;
  padding: 25px;
  border-radius: 12px;
  margin-bottom: 30px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.filters-section h2 {
  margin-bottom: 20px;
  color: #333;
  font-size: 20px;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.filter-group {
  display: flex;
  flex-direction: column;
}

.filter-group label {
  margin-bottom: 8px;
  font-weight: 600;
  color: #555;
  font-size: 14px;
}

.filter-group input,
.filter-group select {
  padding: 10px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.3s;
}

.filter-group input:focus,
.filter-group select:focus {
  outline: none;
  border-color: #667eea;
}

.filter-actions {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.btn-primary,
.btn-secondary,
.btn-refresh,
.btn-export {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background-color: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
}

.btn-refresh {
  background-color: #3498db;
  color: white;
}

.btn-refresh:hover {
  background-color: #2980b9;
}

.btn-export {
  background-color: #27ae60;
  color: white;
}

.btn-export:hover {
  background-color: #229954;
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.summary-card {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  text-align: center;
  transition: transform 0.3s;
}

.summary-card:hover {
  transform: translateY(-5px);
}

.card-title {
  font-size: 14px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  font-weight: 600;
}

.card-value {
  font-size: 32px;
  font-weight: bold;
  color: #333;
}

.card-value.positive {
  color: #27ae60;
}

.card-value.negative {
  color: #e74c3c;
}

/* Charts Section */
.charts-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.chart-container {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  height: 400px;
}

.chart-container h3 {
  margin-bottom: 20px;
  color: #333;
  font-size: 18px;
}

.chart-container canvas {
  max-height: 320px;
}

/* Table Section */
.table-section {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  margin-bottom: 30px;
}

.table-section h2 {
  margin-bottom: 20px;
  color: #333;
  font-size: 20px;
}

.record-count {
  font-size: 14px;
  color: #777;
  font-weight: normal;
}

.table-controls {
  margin-bottom: 15px;
  display: flex;
  justify-content: flex-end;
}

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

th {
  padding: 15px 10px;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.sort-arrow {
  margin-left: 5px;
  font-size: 12px;
}

td {
  padding: 12px 10px;
  border-bottom: 1px solid #e0e0e0;
}

tbody tr:hover {
  background-color: #f8f9fa;
}

tbody tr:last-child td {
  border-bottom: none;
}

td.positive {
  color: #27ae60;
  font-weight: 600;
}

td.negative {
  color: #e74c3c;
  font-weight: 600;
}

/* Loading Indicator */
.loading-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.spinner {
  border: 5px solid #f3f3f3;
  border-top: 5px solid #667eea;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
}

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

.loading-indicator p {
  color: white;
  margin-top: 20px;
  font-size: 18px;
}

/* Responsive Design */
@media (max-width: 768px) {
  #dashboard {
    padding: 10px;
  }

  header {
    flex-direction: column;
    gap: 15px;
  }

  header h1 {
    font-size: 22px;
  }

  .filters-grid {
    grid-template-columns: 1fr;
  }

  .filter-actions {
    flex-direction: column;
    width: 100%;
  }

  .filter-actions button {
    width: 100%;
  }

  .summary-cards {
    grid-template-columns: 1fr;
  }

  .charts-section {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 8px 5px;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  /* Add dark mode styles here if needed */
}

