/* Chaprola Expenses - Dashboard Styles */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-dark: #1e293b;
  --bg-light: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);

  /* Category colors */
  --cat-software: #8b5cf6;
  --cat-office: #06b6d4;
  --cat-travel: #f97316;
  --cat-meals: #ec4899;
  --cat-equipment: #14b8a6;
  --cat-training: #6366f1;
  --cat-marketing: #f43f5e;
  --cat-professional: #84cc16;
  --cat-utilities: #a855f7;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-light);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 240px;
  background: var(--bg-dark);
  color: white;
  padding: 1.5rem;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
}

.logo {
  margin-bottom: 2rem;
}

.logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
}

.logo span {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.nav-links {
  list-style: none;
}

.nav-links li {
  margin-bottom: 0.5rem;
}

.nav-links a {
  display: block;
  padding: 0.75rem 1rem;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.nav-links a.active {
  background: var(--primary);
}

/* Main Content */
.content {
  flex: 1;
  margin-left: 240px;
  padding: 2rem;
  max-width: 1200px;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
}

.page-header .subtitle {
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

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

.card {
  background: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--primary);
}

.card.pending {
  border-left-color: var(--warning);
}

.card.approved {
  border-left-color: var(--success);
}

.card .label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.card .value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
}

.card .count {
  display: block;
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Sections */
section {
  background: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* Category Chart (CSS Bar Chart) */
.chart-container {
  margin-bottom: 1.5rem;
}

.chart-bar {
  display: flex;
  align-items: center;
  margin-bottom: 0.75rem;
}

.chart-bar .label {
  width: 180px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.chart-bar .bar-container {
  flex: 1;
  height: 24px;
  background: var(--bg-light);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 1rem;
}

.chart-bar .bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.chart-bar .amount {
  width: 100px;
  text-align: right;
  font-weight: 600;
  font-size: 0.875rem;
}

/* Category Colors */
.cat-software .bar { background: var(--cat-software); }
.cat-office .bar { background: var(--cat-office); }
.cat-travel .bar { background: var(--cat-travel); }
.cat-meals .bar { background: var(--cat-meals); }
.cat-equipment .bar { background: var(--cat-equipment); }
.cat-training .bar { background: var(--cat-training); }
.cat-marketing .bar { background: var(--cat-marketing); }
.cat-professional .bar { background: var(--cat-professional); }
.cat-utilities .bar { background: var(--cat-utilities); }

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  font-size: 0.875rem;
}

.data-table tbody tr:hover {
  background: var(--bg-light);
}

.data-table tbody tr.clickable {
  cursor: pointer;
}

.data-table .amount,
.data-table .number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.data-table .total-row {
  font-weight: 600;
  background: var(--bg-light);
}

/* Category Badges */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.category-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.category-badge.software::before { background: var(--cat-software); }
.category-badge.office::before { background: var(--cat-office); }
.category-badge.travel::before { background: var(--cat-travel); }
.category-badge.meals::before { background: var(--cat-meals); }
.category-badge.equipment::before { background: var(--cat-equipment); }
.category-badge.training::before { background: var(--cat-training); }
.category-badge.marketing::before { background: var(--cat-marketing); }
.category-badge.professional::before { background: var(--cat-professional); }
.category-badge.utilities::before { background: var(--cat-utilities); }

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.approved {
  background: #dcfce7;
  color: #166534;
}

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.rejected {
  background: #fee2e2;
  color: #991b1b;
}

/* Forms */
.form-container {
  max-width: 600px;
}

.form-group {
  margin-bottom: 1.25rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-light);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-sm {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
}

/* Filters */
.filters {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.filter-group select,
.filter-group input {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 0.875rem;
}

/* Alert Messages */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.alert-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.alert-info {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

/* Loading States */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.75rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.empty-state h4 {
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.pagination button {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination button:hover {
  background: var(--bg-light);
}

.pagination button.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

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

/* Export Options */
.export-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.export-option {
  padding: 1.5rem;
  border: 2px solid var(--border);
  border-radius: 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.export-option:hover {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.05);
}

.export-option.selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
}

.export-option h4 {
  margin-bottom: 0.5rem;
}

.export-option p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: white;
  padding: 1.5rem;
  border-radius: 0.75rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-header h3 {
  font-size: 1.125rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  line-height: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 1rem;
  }

  .sidebar .nav-links {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
  }

  .sidebar .nav-links li {
    margin-bottom: 0;
  }

  .content {
    margin-left: 0;
    padding: 1rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  body {
    flex-direction: column;
  }
}
