/* ============================================================================
   DIARIO.CSS - Dedicated stylesheet for Diario event filtering system
   ============================================================================

   Purpose: Keep diario-related styles isolated and maintainable
   Usage: <link rel="stylesheet" href="/static/css/diario.css">

   Structure:
   1. CSS Variables (Easy Color Configuration)
   2. Right Menu Width Override
   3. Filter Container & Layout
   4. Filter Buttons
   5. Theme Display
   6. Event List Items
   7. Condition Badges
   8. Utility Elements
   9. Responsive Design
   10. Animations
   ============================================================================ */


/* ============================================================================
   1. CSS VARIABLES - EASY COLOR CONFIGURATION
   ============================================================================

   CUSTOMIZE YOUR DRIVER COLORS HERE!
   Just change the hex values below to customize all driver colors at once

   ============================================================================ */

:root {
  /* Driver: Rating */
  --driver-rating-color: #0066cc;
  --driver-rating-bg: #e7f3ff;

  /* Driver: Forecaster */
  --driver-forecaster-color: #28a745;
  --driver-forecaster-bg: #d4edda;

  /* Driver: Trigger */
  --driver-trigger-color: #dc3545;
  --driver-trigger-bg: #f8d7da;

  /* Default/Unknown Driver */
  --driver-default-color: #6c757d;
  --driver-default-bg: #e2e3e5;

  /* Filter Button Colors */
  --filter-btn-active-bg: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
  --filter-btn-active-border: #0a58ca;
  --filter-btn-active-color: #ffffff;
  --filter-btn-active-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);

  --filter-btn-inactive-bg: #e9ecef;
  --filter-btn-inactive-border: #ced4da;
  --filter-btn-inactive-color: #6c757d;
  --filter-btn-inactive-opacity: 0.6;
}

#right-menu {
  width: 336px; /* 280px * 1.2 = 336px (20% wider) */
}

@media (max-width: 768px) {
  #right-menu {
    width: 100%;
    max-width: 360px; /* Slightly wider on mobile too */
  }
}


/* ============================================================================
   2. FILTER CONTAINER & LAYOUT
   ============================================================================ */

.diario-filter-container {
  padding: 15px 18px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  margin-bottom: 20px;
  border: 1px solid #dee2e6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  animation: slideIn 0.3s ease-out;
}

.diario-filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.diario-filter-title {
  font-weight: 600;
  font-size: 14px;
  color: #495057;
  display: flex;
  align-items: center;
  gap: 8px;
}

.diario-filter-title::before {
  content: "🔍";
  font-size: 16px;
}

.diario-filter-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.diario-filter-info {
  margin-top: 10px;
  font-size: 11px;
  color: #6c757d;
  font-style: italic;
}


/* ============================================================================
   2. FILTER BUTTONS
   ============================================================================ */

.condition-filter-btn {
  padding: 8px 16px;
  border: 2px solid;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  user-select: none;
  font-family: inherit;
}

/* Active State - Button is enabled/checked */
.condition-filter-btn.active,
.condition-filter-btn[data-active="true"] {
  background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
  border-color: #0a58ca;
  color: white;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

/* Inactive State - Button is disabled/unchecked */
.condition-filter-btn.inactive,
.condition-filter-btn[data-active="false"] {
  background: #e9ecef;
  border-color: #ced4da;
  color: #6c757d;
  opacity: 0.6;
  box-shadow: none;
}

/* Hover Effects */
.condition-filter-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.condition-filter-btn.active:hover {
  box-shadow: 0 4px 16px rgba(13, 110, 253, 0.4);
  background: linear-gradient(135deg, #0b5ed7 0%, #084298 100%);
}

.condition-filter-btn.inactive:hover {
  opacity: 0.8;
  background: #dee2e6;
}

/* Click Animation */
.condition-filter-btn:active {
  transform: translateY(0);
  transition: transform 0.1s ease;
}

/* Ripple Effect on Click */
.condition-filter-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.4s, height 0.4s;
  pointer-events: none;
}

.condition-filter-btn:active::after {
  width: 300px;
  height: 300px;
}


/* ============================================================================
   3. UTILITY BUTTONS
   ============================================================================ */

.reset-filters-btn {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid #dc3545;
  background: white;
  color: #dc3545;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  font-family: inherit;
}

.reset-filters-btn:hover {
  background: #dc3545;
  color: white;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.reset-filters-btn:active {
  transform: scale(0.98);
}

.utility-btn {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  border: 1px solid #6c757d;
  background: white;
  color: #6c757d;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.utility-btn:hover {
  background: #6c757d;
  color: white;
}


/* ============================================================================
   4. THEME DISPLAY
   ============================================================================ */

.theme-container {
  margin-bottom: 15px;
}

.theme-header {
  display: block;
  padding: 10px 15px;
  background: linear-gradient(135deg, #e7f3ff 0%, #d0e9ff 100%);
  color: #0d6efd;
  text-decoration: none;
  font-weight: 600;
  border-radius: 6px;
  border-left: 4px solid #0d6efd;
  transition: all 0.2s ease;
  cursor: pointer;
}

.theme-header:hover {
  background: linear-gradient(135deg, #d0e9ff 0%, #b8e0ff 100%);
  transform: translateX(3px);
}

.theme-header:active {
  transform: translateX(1px);
}


/* ============================================================================
   5. EVENT LIST ITEMS
   ============================================================================ */

.theme-item-list {
  list-style: none;
  padding: 0;
  margin: 10px 0 0 0;
  transition: all 0.3s ease;
}

.theme-item-list.hidden {
  display: none;
}

.theme-item-list li {
  padding: 10px 15px;
  margin-bottom: 6px;
  background: white;
  border-radius: 6px;
  border: 1px solid #e9ecef;
  transition: all 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* Changed from center to flex-start */
  gap: 8px; /* Add gap between elements */
}

.theme-item-list li:hover {
  border-color: #0d6efd;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.1);
  transform: translateX(3px);
}

.theme-item-list li a {
  color: #0d6efd;
  text-decoration: none;
  font-weight: 500;
}

.theme-item-list li a:hover {
  text-decoration: underline;
}

.theme-item-list li span {
  color: #6c757d;
  font-size: 14px;
}


/* ============================================================================
   6. CONDITION BADGES
   ============================================================================ */

.condition-badge {
  display: inline-block;
  font-size: 10px;
  padding: 3px 8px;
  margin-left: 8px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Default badge style */
.condition-badge {
  background: #e7f3ff;
  color: #0066cc;
}

/* Specific condition type colors */
.condition-badge[data-condition="breakout"],
.condition-badge.breakout {
  background: #e7f3ff;
  color: #0066cc;
}

.condition-badge[data-condition="bounce"],
.condition-badge.bounce {
  background: #d4edda;
  color: #155724;
}

.condition-badge[data-condition="pattern"],
.condition-badge.pattern {
  background: #fff3cd;
  color: #856404;
}

.condition-badge[data-condition="divergence"],
.condition-badge.divergence {
  background: #f8d7da;
  color: #721c24;
}

.condition-badge[data-condition="momentum"],
.condition-badge.momentum {
  background: #e2e3e5;
  color: #383d41;
}

/* Numbered conditions */
.condition-badge[data-condition="condition1"] {
  background: #cfe2ff;
  color: #084298;
}

.condition-badge[data-condition="condition2"] {
  background: #d1e7dd;
  color: #0f5132;
}

.condition-badge[data-condition="condition3"] {
  background: #fff3cd;
  color: #664d03;
}

.condition-badge[data-condition="condition4"] {
  background: #f8d7da;
  color: #842029;
}

.condition-badge[data-condition="condition5"] {
  background: #e2e3e5;
  color: #41464b;
}


/* ============================================================================
   7. UTILITY ELEMENTS
   ============================================================================ */

.no-events-message {
  padding: 40px 20px;
  text-align: center;
  color: #6c757d;
  background: #f8f9fa;
  border-radius: 8px;
  border: 2px dashed #dee2e6;
  font-size: 14px;
}

.diario-loader {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #0d6efd;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.error-message {
  padding: 15px;
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c2c7;
  border-radius: 6px;
  margin: 10px 0;
}


/* ============================================================================
   8. ANIMATIONS
   ============================================================================ */

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

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

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

.theme-item-list li {
  animation: fadeIn 0.3s ease-out;
}


/* ============================================================================
   9. RESPONSIVE DESIGN
   ============================================================================ */

@media (max-width: 768px) {
  .diario-filter-container {
    padding: 12px;
  }

  .condition-filter-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .diario-filter-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .theme-item-list li {
    padding: 8px 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .condition-badge {
    margin-left: 0;
    margin-top: 5px;
  }

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

@media (max-width: 480px) {
  .diario-filter-buttons {
    gap: 6px;
  }

  .condition-filter-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  .theme-item-list li {
    font-size: 13px;
  }
}


/* ============================================================================
   10. DARK MODE SUPPORT (Optional)
   ============================================================================ */

@media (prefers-color-scheme: dark) {
  .diario-filter-container {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    border-color: #4a5568;
  }

  .diario-filter-title {
    color: #e2e8f0;
  }

  .condition-filter-btn.inactive {
    background: #2d3748;
    border-color: #4a5568;
    color: #a0aec0;
  }

  .theme-header {
    background: linear-gradient(135deg, #2c5282 0%, #2a4365 100%);
    color: #90cdf4;
    border-left-color: #3182ce;
  }

  .theme-item-list li {
    background: #2d3748;
    border-color: #4a5568;
    color: #e2e8f0;
  }

  .theme-item-list li a {
    color: #90cdf4;
  }

  .theme-item-list li span {
    color: #cbd5e0;
  }

  .no-events-message {
    background: #2d3748;
    border-color: #4a5568;
    color: #a0aec0;
  }

  .diario-filter-info {
    color: #a0aec0;
  }
}


/* ============================================================================
   11. PRINT STYLES
   ============================================================================ */

@media print {
  .diario-filter-container {
    display: none;
  }

  .theme-item-list {
    display: block !important;
  }

  .theme-item-list.hidden {
    display: block !important;
  }

  .condition-badge {
    border: 1px solid #000;
  }

  .theme-header {
    page-break-after: avoid;
  }

  .theme-item-list li {
    page-break-inside: avoid;
  }
}


/* ============================================================================
   12. ACCESSIBILITY ENHANCEMENTS
   ============================================================================ */

/* Focus styles for keyboard navigation */
.condition-filter-btn:focus,
.reset-filters-btn:focus,
.utility-btn:focus,
.theme-header:focus {
  outline: 2px solid #0d6efd;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: more) {
  .condition-filter-btn {
    border-width: 3px;
  }

  .theme-header {
    border-left-width: 6px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ============================================================================
   END OF DIARIO.CSS
   ============================================================================ */