/**
 * Styles for TrainMore Booking Bot
 */

* {
  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%);
  color: #333;
  line-height: 1.4;
  min-height: 100vh;
  padding: 15px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 20px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f0f0f0;
}

h1 {
  color: #667eea;
  font-size: 1.8rem;
  margin-bottom: 5px;
}

.subtitle {
  color: #666;
  font-size: 0.9rem;
}

/* Sections */
.section {
  margin-bottom: 25px;
}

h2 {
  color: #333;
  font-size: 1.3rem;
  margin-bottom: 12px;
}

h3 {
  color: #555;
  font-size: 1.1rem;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e0e0e0;
}

/* Forms */
.form-group {
  margin-bottom: 12px;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
  color: #555;
  font-size: 0.9rem;
}

input[type="email"],
input[type="password"],
input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.3s;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus {
  outline: none;
  border-color: #667eea;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: #667eea;
  color: white;
}

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

.btn-secondary {
  background: #6c757d;
  color: white;
  margin-left: 10px;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-book {
  background: #28a745;
  color: white;
  width: 100%;
  margin-top: 10px;
}

.btn-book:hover {
  background: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-danger {
  background: #dc3545;
  color: white;
}

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

.btn-sm {
  padding: 8px 16px;
  font-size: 0.9rem;
}

/* Date Range */
.date-range {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.date-range label {
  margin: 0;
}

.date-range input[type="date"] {
  width: auto;
  min-width: 150px;
}

/* Filters */
.filters {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.filter-group > label {
  margin: 0;
  font-weight: 500;
  color: #555;
}

.filter-group input[type="text"] {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  min-width: 200px;
}

.filter-group input[type="text"]:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Studio Checkboxes */
.studio-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.studio-checkbox-label {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: white;
  border: 2px solid #ddd;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.studio-checkbox-label:hover {
  border-color: #667eea;
  background: #f0f4ff;
}

.studio-checkbox-label input[type="checkbox"] {
  display: none;
}

.studio-checkbox-label input[type="checkbox"]:checked + span {
  color: white;
}

.studio-checkbox-label:has(input[type="checkbox"]:checked) {
  background: #667eea;
  border-color: #667eea;
  color: white;
}

.studio-checkbox-label span {
  font-size: 14px;
  font-weight: 500;
  color: #555;
  transition: color 0.2s ease;
}

.studio-checkbox-label:has(input[type="checkbox"]:checked) span {
  color: white;
}

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

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

.checkbox-label span {
  font-weight: 500;
  color: #555;
}

/* Status Messages */
.status-message {
  padding: 12px;
  border-radius: 6px;
  margin-top: 15px;
  display: none;
}

.status-info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.status-success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Course Cards */
#courses-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 8px;
}

.course-card {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px 15px;
  background: #fafafa;
  transition: all 0.3s;
  cursor: pointer;
}

.course-card:hover {
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Collapsed state - fit more in a row */
.course-card.collapsed {
  grid-column: span 1;
}

/* Expanded state - take full width */
.course-card:not(.collapsed) {
  grid-column: 1 / -1;
}

.course-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.course-header h4 {
  color: #333;
  font-size: 1rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 150px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.course-level {
  background: #667eea;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.collapse-indicator {
  font-size: 0.7rem;
  color: #667eea;
  transition: transform 0.3s;
  user-select: none;
}

.course-card:not(.collapsed) .collapse-indicator {
  transform: rotate(180deg);
}

.course-details-expanded {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.course-card:not(.collapsed) .course-details-expanded {
  max-height: 500px;
  margin-top: 10px;
}

.course-details {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 8px;
}

.detail {
  color: #555;
  font-size: 0.85rem;
  white-space: nowrap;
}

.detail strong {
  color: #333;
  font-weight: 600;
  margin-right: 4px;
}

.booking-time {
  background: #fff3cd;
  padding: 6px 10px;
  border-radius: 4px;
  margin-top: 8px;
  border-left: 3px solid #ffc107;
  font-size: 0.85rem;
  display: block;
  width: 100%;
}

.countdown {
  color: #856404;
  font-weight: 600;
}

.available-now {
  color: #28a745;
  font-weight: 600;
}

/* Booking Cards */
.booking-card,
.history-card {
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 10px 15px;
  margin-bottom: 8px;
  background: #fafafa;
  width: 100%;
  cursor: pointer;
  transition: all 0.3s;
}

.booking-card:hover,
.history-card:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.booking-card.status-success,
.history-card.status-success {
  border-color: #28a745;
  background: #f1f9f3;
}

.booking-card.status-failed,
.history-card.status-failed {
  border-color: #dc3545;
  background: #fef5f6;
}

.booking-card.status-pending {
  border-color: #ffc107;
  background: #fffbf0;
}

.booking-header,
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.booking-header h4,
.history-header h4 {
  margin: 0;
  color: #333;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 150px;
}

.status-badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-badge.status-pending {
  background: #ffc107;
  color: #856404;
}

.status-badge.status-success {
  background: #28a745;
  color: white;
}

.status-badge.status-failed {
  background: #dc3545;
  color: white;
}

.booking-details-expanded,
.history-details-expanded {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.booking-card:not(.collapsed) .booking-details-expanded,
.history-card:not(.collapsed) .history-details-expanded {
  max-height: 300px;
  margin-top: 10px;
}

.booking-card:not(.collapsed) .collapse-indicator,
.history-card:not(.collapsed) .collapse-indicator {
  transform: rotate(180deg);
}

.booking-details,
.history-details {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.booking-details .detail,
.history-details .detail {
  margin-bottom: 0;
}

.message {
  background: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  margin-top: 8px;
  font-style: italic;
  border-left: 3px solid #667eea;
  font-size: 0.85rem;
  display: block;
  width: 100%;
}

/* Empty State */
.empty-state {
  text-align: center;
  color: #999;
  padding: 40px;
  font-size: 1.1rem;
}

/* Loading */
#loading {
  text-align: center;
  padding: 40px;
  color: #667eea;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 20px;
  }

  h1 {
    font-size: 2rem;
  }

  #courses-container {
    grid-template-columns: 1fr;
  }

  .date-range {
    flex-direction: column;
    align-items: stretch;
  }

  .date-range input[type="date"] {
    width: 100%;
  }

  .btn-secondary {
    margin-left: 0;
    margin-top: 10px;
  }
}
