/* ============================================
   CAJA MODULE - Enhanced Styling
   ============================================ */

/* Category Badges */
.category-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.category-servicios {
  background: #E3F2FD;
  color: #1565C0;
  border: 1px solid #90CAF9;
}

.category-alquiler {
  background: #F3E5F5;
  color: #6A1B9A;
  border: 1px solid #CE93D8;
}

.category-impuestos {
  background: #FFF3E0;
  color: #E65100;
  border: 1px solid #FFB74D;
}

.category-repuestos {
  background: #E8F5E9;
  color: #2E7D32;
  border: 1px solid #81C784;
}

.category-herramientas {
  background: #E0F2F1;
  color: #00695C;
  border: 1px solid #4DB6AC;
}

.category-salarios {
  background: #FCE4EC;
  color: #C2185B;
  border: 1px solid #F06292;
}

.category-marketing {
  background: #FFF9C4;
  color: #F57F17;
  border: 1px solid #FFF176;
}

.category-mantenimiento {
  background: #FFEBEE;
  color: #C62828;
  border: 1px solid #EF5350;
}

.category-transporte {
  background: #E1F5FE;
  color: #01579B;
  border: 1px solid #4FC3F7;
}

.category-otros {
  background: #F5F5F5;
  color: #616161;
  border: 1px solid #BDBDBD;
}

/* Payment Method Icons */
.payment-icon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.payment-icon::before {
  content: '';
  width: 20px;
  height: 20px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.payment-efectivo::before {
  content: '💵';
}

.payment-posnet::before {
  content: '💳';
}

.payment-transferencia::before {
  content: '🏦';
}

/* Stats Cards Enhancement */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  transition: all 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
}

.stat-subtitle {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

/* Stat Card Variants */
.stat-card.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  color: white;
}

.stat-card.primary .stat-label,
.stat-card.primary .stat-value,
.stat-card.primary .stat-subtitle {
  color: white;
}

.stat-card.success {
  background: #e8f5e9;
  border-color: #81c784;
}

.stat-card.success .stat-value {
  color: #2e7d32;
}

.stat-card.warning {
  background: #fff8e1;
  border-color: #ffd54f;
}

.stat-card.warning .stat-value {
  color: #f57f17;
}

.stat-card.danger {
  background: #ffebee;
  border-color: #ef5350;
}

.stat-card.danger .stat-value {
  color: #c62828;
}

.stat-card.info {
  background: #e3f2fd;
  border-color: #90caf9;
}

.stat-card.info .stat-value {
  color: #1565c0;
}

/* Enhanced Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

table thead {
  background: #f9fafb;
}

table thead th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e5e7eb;
}

table tbody tr {
  border-bottom: 1px solid #f3f4f6;
  transition: background-color 0.15s ease;
}

table tbody tr:hover {
  background-color: #f9fafb;
}

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

table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: #1f2937;
}

/* Forms Enhancement */
.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 20px;
  padding: 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: #374151;
}

.form-group input,
.form-group select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Responsive enhancements */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 13px;
  }

  table thead th,
  table tbody td {
    padding: 10px 12px;
  }

  .category-badge {
    font-size: 11px;
    padding: 3px 8px;
  }
}

/* Date Range Filter Enhancement */
.date-filter {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  padding: 16px;
  background: white;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  margin-bottom: 20px;
}

.date-filter .quick-ranges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-range-btn {
  padding: 6px 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.quick-range-btn:hover {
  background: #e5e7eb;
}

.quick-range-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

/* Trend Indicators */
.trend-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
}

.trend-up {
  color: #16a34a;
  background: #f0fdf4;
}

.trend-up::before {
  content: '↑';
  font-weight: bold;
}

.trend-down {
  color: #dc2626;
  background: #fef2f2;
}

.trend-down::before {
  content: '↓';
  font-weight: bold;
}

.trend-neutral {
  color: #6b7280;
  background: #f9fafb;
}

.trend-neutral::before {
  content: '→';
  font-weight: bold;
}

/* Chart Container */
.chart-container {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.chart-header {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 16px;
}

/* Expense Summary by Category */
.category-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  transition: all 0.2s ease;
}

.category-item:hover {
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.category-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-item-amount {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

/* Progress Bar for Categories */
.category-progress {
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.category-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
  transition: width 0.3s ease;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablet and below */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-inline {
    flex-direction: column;
    align-items: stretch !important;
  }

  .form-inline .form-group {
    width: 100%;
  }
}

/* Mobile devices */
@media (max-width: 768px) {
  /* Stats Grid - Single column on mobile */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-subtitle {
    font-size: 10px;
  }

  /* Form Inline - Stack vertically */
  .form-inline {
    padding: 12px;
  }

  .form-group {
    width: 100%;
  }

  .form-group input,
  .form-group select {
    width: 100% !important;
    min-width: 0 !important;
    font-size: 16px !important; /* Prevent iOS zoom */
  }

  /* Tables - Better mobile experience */
  table {
    font-size: 13px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table thead th {
    padding: 10px 8px;
    font-size: 11px;
    white-space: nowrap;
  }

  table tbody td {
    padding: 10px 8px;
    font-size: 13px;
  }

  /* Category Badges - Smaller on mobile */
  .category-badge {
    font-size: 11px;
    padding: 3px 8px;
  }

  /* Payment Icons */
  .payment-icon {
    font-size: 14px;
  }

  .payment-icon::before {
    width: 18px;
    height: 18px;
  }

  /* Category Summary - Stack items */
  .category-summary {
    grid-template-columns: 1fr;
  }

  .category-item {
    padding: 10px 12px;
  }

  .category-item-amount {
    font-size: 14px;
  }

  /* Date Filter - Stack vertically */
  .date-filter {
    flex-direction: column;
    align-items: stretch;
    padding: 12px;
  }

  .date-filter .quick-ranges {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .date-filter .quick-ranges::-webkit-scrollbar {
    display: none;
  }

  .quick-range-btn {
    flex-shrink: 0;
    font-size: 12px;
    padding: 5px 10px;
  }

  /* Chart Container */
  .chart-container {
    padding: 14px;
  }

  .chart-header {
    font-size: 14px;
  }

  /* Buttons - Touch friendly */
  .btn,
  .button {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }

  .btn-small {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 13px;
  }

  /* Hide less important columns on mobile */
  .hide-mobile {
    display: none !important;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .stat-card {
    padding: 12px;
  }

  .stat-value {
    font-size: 18px;
  }

  .category-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .category-item-amount {
    font-size: 16px;
    font-weight: 700;
  }

  table {
    font-size: 12px;
  }

  table thead th,
  table tbody td {
    padding: 8px 6px;
  }
}
