/**
 * Time Granularity Manager Styles
 * Styling for all granularity selectors (Hours, Days, Weeks, Months, Years)
 */

/* ============================================================================
   Main Panel
   ============================================================================ */

.time-granularity-panel {
  background: white;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin: 20px 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.granularity-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e0e0e0;
  background: #f8f9fa;
  border-radius: 8px 8px 0 0;
}

.granularity-header h3 {
  margin: 0;
  font-size: 18px;
  color: #2c3e50;
}

.granularity-toggle-btn {
  background: none;
  border: 1px solid #3498db;
  color: #3498db;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.granularity-toggle-btn:hover {
  background: #3498db;
  color: white;
}

.toggle-icon {
  display: inline-block;
  font-weight: bold;
}

/* ============================================================================
   Content Area
   ============================================================================ */

.granularity-content {
  padding: 20px;
  transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
  max-height: 2000px;
  opacity: 1;
  overflow: hidden;
}

.granularity-content.collapsed {
  max-height: 60px;
  opacity: 0.7;
}

/* ============================================================================
   Summary
   ============================================================================ */

.granularity-summary {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
}

.summary-item {
  display: flex;
  margin-bottom: 8px;
}

.summary-item:last-child {
  margin-bottom: 0;
}

.summary-label {
  font-weight: 600;
  color: #7f8c8d;
  min-width: 100px;
}

.summary-value {
  color: #2c3e50;
}

/* ============================================================================
   Tabs
   ============================================================================ */

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

.granularity-tab {
  background: white;
  border: 1px solid #e0e0e0;
  padding: 10px 20px;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  font-size: 14px;
  color: #7f8c8d;
  transition: all 0.2s;
}

.granularity-tab:hover {
  background: #f8f9fa;
  color: #2c3e50;
}

.granularity-tab.active {
  background: #3498db;
  color: white;
  border-color: #3498db;
  font-weight: 600;
}

.tab-icon {
  display: inline-block;
  margin-right: 6px;
  font-weight: bold;
  color: #27ae60;
  font-size: 16px;
}

.granularity-tab.active .tab-icon {
  color: white;
}

/* ============================================================================
   Selector Containers
   ============================================================================ */

.granularity-selectors {
  min-height: 300px;
  margin-bottom: 20px;
}

.selector-container {
  animation: fadeIn 0.3s ease-in;
}

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

/* ============================================================================
   Hour Selector
   ============================================================================ */

.hour-selector {
  padding: 20px;
}

.hour-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.hour-selector-header h4 {
  margin: 0;
  font-size: 16px;
  color: #2c3e50;
}

.hour-grid {
  margin-bottom: 20px;
}

.hour-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.hour-cell {
  flex: 1;
  min-width: 40px;
  height: 50px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  background: white;
}

.hour-cell:hover {
  border-color: #3498db;
  background: #ebf5fb;
  transform: translateY(-2px);
}

.hour-cell.selected {
  background: #3498db;
  border-color: #2980b9;
  color: white;
}

.hour-cell.drag-highlight {
  background: #aed6f1;
  border-color: #5dade2;
}

.hour-label {
  font-weight: 600;
  font-size: 14px;
}

.hour-selection-info {
  margin-bottom: 15px;
}

.info-text {
  margin: 0;
  font-size: 13px;
  color: #7f8c8d;
  font-style: italic;
}

.selected-ranges {
  margin-top: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
}

.ranges-list {
  min-height: 40px;
}

.no-selection {
  margin: 0;
  color: #95a5a6;
  font-style: italic;
}

.ranges-summary {
  color: #2c3e50;
}

.warning-text {
  margin: 10px 0 0 0;
  color: #e67e22;
  font-size: 13px;
}

/* ============================================================================
   Day Selector
   ============================================================================ */

.day-selector {
  padding: 20px;
}

.day-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.day-selector-header h4 {
  margin: 0;
  font-size: 16px;
  color: #2c3e50;
}

.day-grid {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  justify-content: center;
}

.day-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.day-button, .btn-day {
  flex: 1;
  min-width: 100px;
  max-width: 120px;
  height: 80px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
}

.day-button:hover, .btn-day:hover {
  border-color: #3498db;
  transform: translateY(-3px);
  box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
}

.day-button.selected, .btn-day.selected {
  background: #3498db;
  border-color: #2980b9;
  color: white;
}

.day-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.checkbox-mark {
  display: none;
  color: #3498db;
  font-weight: bold;
}

.checkbox-mark::before {
  content: '✓';
  font-size: 16px;
}

.day-short {
  font-size: 18px;
  font-weight: 700;
  display: block;
}

.day-full {
  font-size: 12px;
  color: #7f8c8d;
  margin-top: 4px;
}

.day-button.selected .day-full {
  color: white;
}

.day-quick-select {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 20px;
}

.day-selection-info {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
  text-align: center;
}

.selected-days-text {
  margin: 0;
  color: #2c3e50;
}

/* ============================================================================
   Week Selector
   ============================================================================ */

.week-selector {
  padding: 20px;
}

.week-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.header-left {
  display: flex;
  gap: 20px;
  align-items: center;
}

.header-left h4 {
  margin: 0;
  font-size: 16px;
  color: #2c3e50;
}

.year-selector {
  display: flex;
  gap: 10px;
  align-items: center;
}

.year-dropdown {
  padding: 6px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.week-grid {
  margin-bottom: 20px;
}

.week-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.week-cell {
  flex: 1;
  min-width: 50px;
  height: 40px;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.week-cell:hover {
  border-color: #3498db;
  background: #ebf5fb;
}

.week-cell.selected {
  background: #3498db;
  border-color: #2980b9;
  color: white;
}

.week-label {
  font-size: 11px;
  font-weight: 600;
}

.week-range-input {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
}

.week-range-input label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #2c3e50;
}

.range-input-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.week-input {
  width: 60px;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 14px;
}

.week-selection-info {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
}

.selected-weeks-text {
  margin: 0;
  color: #2c3e50;
}

/* ============================================================================
   Month Selector
   ============================================================================ */

.month-selector {
  padding: 20px;
}

.month-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.month-selector-header h4 {
  margin: 0;
  font-size: 16px;
  color: #2c3e50;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  cursor: pointer;
}

.month-grid {
  margin-bottom: 20px;
}

.month-buttons {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.month-button, .btn-month {
  height: 70px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  font-size: 14px;
  font-weight: 600;
  color: #2c3e50;
}

.month-button:hover, .btn-month:hover {
  border-color: #3498db;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(52, 152, 219, 0.2);
}

.month-button.selected, .btn-month.selected {
  background: #3498db;
  border-color: #2980b9;
  color: white;
}

.month-short {
  font-size: 16px;
  font-weight: 700;
}

.month-full {
  font-size: 11px;
  color: #7f8c8d;
  margin-top: 4px;
}

.month-button.selected .month-full, .btn-month.selected .month-full {
  color: white;
}

.quarter-quick-select {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
}

.quarter-quick-select label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #2c3e50;
}

.quarter-buttons {
  display: flex;
  gap: 10px;
}

.quarter-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px;
}

.quarter-btn .icon {
  font-weight: 700;
  font-size: 16px;
}

.quarter-btn.active {
  background: #2ecc71;
  border-color: #27ae60;
  color: white;
}

.month-selection-info {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
}

.selected-months-text {
  margin: 0;
  color: #2c3e50;
}

/* ============================================================================
   Year Selector
   ============================================================================ */

.year-selector {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 20px;
}

.year-selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.year-selector-header h4 {
  margin: 0;
  font-size: 16px;
  color: #2c3e50;
}

.year-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  width: 100%;
}

.year-button, .btn-year {
  height: 50px;
  padding: 8px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  user-select: none;
}

.year-button:hover, .btn-year:hover {
  border-color: #3498db;
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(52, 152, 219, 0.2);
}

.year-button.selected, .btn-year.selected {
  background: #3498db;
  border-color: #2980b9;
  color: white;
}

.year-range-input {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
}

.year-range-input label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: #2c3e50;
}

.year-input {
  width: 80px;
  padding: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  font-size: 14px;
}

.year-selection-info {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 6px;
}

.selected-years-text {
  margin: 0;
  color: #2c3e50;
}

.no-data {
  text-align: center;
  color: #95a5a6;
  padding: 40px;
  font-style: italic;
}

/* ============================================================================
   Active Filters Display
   ============================================================================ */

.active-filters {
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
}

.active-filters h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: #7f8c8d;
}

.filter-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-badge {
  display: inline-block;
  padding: 6px 12px;
  background: #3498db;
  color: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.no-filters {
  margin: 0;
  color: #95a5a6;
  font-style: italic;
  font-size: 13px;
}

/* ============================================================================
   Action Buttons
   ============================================================================ */

.granularity-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 15px;
  border-top: 1px solid #e0e0e0;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.btn-link {
  background: none;
  border: none;
  color: #3498db;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  padding: 0;
  transition: color 0.2s;
}

.btn-link:hover {
  color: #2980b9;
  text-decoration: underline;
}

.btn-small {
  padding: 6px 12px;
  font-size: 13px;
}

.muted {
  color: #95a5a6;
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 1200px) {
  .hour-cell {
    min-width: 35px;
    height: 45px;
  }
  
  .day-button {
    max-width: 100px;
    height: 90px;
  }
}

@media (max-width: 768px) {
  .granularity-tabs {
    flex-wrap: wrap;
  }
  
  .granularity-tab {
    flex: 1;
    min-width: 80px;
    text-align: center;
  }
  
  .day-grid {
    flex-direction: column;
  }
  
  .day-button {
    max-width: 100%;
    height: 60px;
    flex-direction: row;
    justify-content: flex-start;
    padding: 0 15px;
  }
  
  .year-buttons {
    gap: 10px;
  }
  
  .year-button, .btn-year {
    min-width: 100px;
    height: 80px;
  }
  
  .month-buttons {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .month-button, .btn-month {
    height: 60px;
    font-size: 12px;
  }
  
  .day-button, .btn-day {
    min-width: 80px;
    height: 70px;
  }
}
