/**
 * Transport for Rory - Dashboard Styles
 * Inspired by Transport for London's design
 */

@font-face {
  font-family: 'Johnston';
  src: url('./p22-johnston-underground-regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --tfl-blue: #0019a8;
  --tfl-red: #dc241f;
  --tfl-good-service: #00782a;
  --tfl-minor-delays: #ff9800;
  --tfl-severe-delays: #dc241f;
  --border-color: #ddd;
  --bg-light: #f5f5f5;
  --text-primary: #1c1c1c;
  --text-secondary: #666;

  /* TfL Line Brand Colors */
  --line-bakerloo: #B36305;
  --line-central: #E32017;
  --line-circle: #FFD300;
  --line-district: #00782A;
  --line-elizabeth: #6950a1;
  --line-hammersmith-city: #F3A9BB;
  --line-jubilee: #A0A5A9;
  --line-metropolitan: #9B0056;
  --line-northern: #000000;
  --line-piccadilly: #003688;
  --line-victoria: #0098D4;
  --line-waterloo-city: #95CDBA;
  --line-dlr: #00A4A7;
  --line-london-overground: #EE7C0E;
  --line-trams: #84B817;
  --line-cable-car: #E21836;
}

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

body {
  font-family: 'Johnston', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: #fff;
  padding: 20px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

header {
  background-color: #2d3039;
  color: white;
  padding: 20px 30px;
  margin: -20px -20px 10px -20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-logo {
  height: 50px;
  width: auto;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
}

.compact-toggle {
  background-color: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.compact-toggle:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.compact-toggle:active {
  transform: translateY(1px);
}

body.compact-mode .compact-toggle {
  background-color: var(--tfl-blue);
  border-color: white;
}

.toggle-icon {
  display: inline-block;
  transition: transform 0.2s;
}

.subtitle {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-top: 5px;
}

.section {
  margin-bottom: 40px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 15px;
  border-bottom: 3px solid var(--tfl-blue);
  padding-bottom: 8px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.section-header .section-title {
  margin-bottom: 0;
  flex: 1;
}

/* Compact mode: hide section headers */
body.compact-mode .section-header {
  display: none;
}

body.compact-mode .section {
  margin-bottom: 20px;
}

.configure-btn {
  background-color: var(--tfl-blue);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
}

.configure-btn:hover {
  background-color: #001580;
}

.configure-btn:active {
  transform: translateY(1px);
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.error {
  background-color: #fee;
  border: 1px solid var(--tfl-red);
  color: var(--tfl-red);
  padding: 15px;
  border-radius: 4px;
  margin: 20px 0;
}

/* Line Status Styles */
.line-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 15px;
  width: 100%;
}

.line-status-card {
  background: white;
  border: 2px solid var(--border-color);
  border-left: 5px solid var(--border-color);
  border-radius: 6px;
  padding: 15px;
  transition: box-shadow 0.2s, transform 0.2s;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

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

/* Line-specific border colors */
.line-status-card[data-line="bakerloo"] {
  border-left-color: var(--line-bakerloo);
}

.line-status-card[data-line="central"] {
  border-left-color: var(--line-central);
}

.line-status-card[data-line="circle"] {
  border-left-color: var(--line-circle);
}

.line-status-card[data-line="district"] {
  border-left-color: var(--line-district);
}

.line-status-card[data-line="elizabeth"] {
  border-left-color: var(--line-elizabeth);
}

.line-status-card[data-line="hammersmith-city"] {
  border-left-color: var(--line-hammersmith-city);
}

.line-status-card[data-line="jubilee"] {
  border-left-color: var(--line-jubilee);
}

.line-status-card[data-line="metropolitan"] {
  border-left-color: var(--line-metropolitan);
}

.line-status-card[data-line="northern"] {
  border-left-color: var(--line-northern);
}

.line-status-card[data-line="piccadilly"] {
  border-left-color: var(--line-piccadilly);
}

.line-status-card[data-line="victoria"] {
  border-left-color: var(--line-victoria);
}

.line-status-card[data-line="waterloo-city"] {
  border-left-color: var(--line-waterloo-city);
}

.line-status-card[data-line="dlr"] {
  border-left-color: var(--line-dlr);
}

.line-status-card[data-line="london-overground"],
.line-status-card[data-line="windrush"],
.line-status-card[data-line="liberty"],
.line-status-card[data-line="lioness"],
.line-status-card[data-line="mildmay"],
.line-status-card[data-line="suffragette"],
.line-status-card[data-line="weaver"] {
  border-left-color: var(--line-london-overground);
}

.line-status-card[data-line="tram"] {
  border-left-color: var(--line-trams);
}

.line-status-card[data-line="cable-car"] {
  border-left-color: var(--line-cable-car);
}

.line-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.line-name {
  font-size: 1.3rem;
  font-weight: 700;
  text-transform: capitalize;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.status-good {
  background-color: var(--tfl-good-service);
}

.status-minor {
  background-color: var(--tfl-minor-delays);
}

.status-severe {
  background-color: var(--tfl-severe-delays);
}

.status-reason {
  margin-top: 10px;
  padding: 10px;
  background-color: var(--bg-light);
  border-radius: 4px;
  font-size: 1rem;
  color: var(--text-secondary);
}

/* Station Arrivals Styles */
.station-selector {
  margin-bottom: 20px;
}

.station-selector label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.search-container {
  position: relative;
  width: 100%;
  max-width: 500px;
}

.search-container input[type="text"] {
  width: 100%;
  padding: 12px 15px;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background-color: white;
  transition: border-color 0.2s;
}

.search-container input[type="text"]:hover,
.search-container input[type="text"]:focus {
  border-color: var(--tfl-blue);
  outline: none;
}

.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 300px;
  overflow-y: auto;
  background: white;
  border: 2px solid var(--tfl-blue);
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 100;
  margin-top: -2px;
}

.suggestion-item {
  padding: 12px 15px;
  cursor: pointer;
  transition: background-color 0.2s;
  border-bottom: 1px solid var(--border-color);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.selected {
  background-color: var(--bg-light);
}

.suggestion-item.active {
  background-color: #e3f2fd;
}

.no-suggestions {
  padding: 12px 15px;
  color: var(--text-secondary);
  font-style: italic;
  text-align: center;
}

.station-selector select {
  width: 100%;
  max-width: 400px;
  padding: 10px 15px;
  font-size: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  background-color: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.station-selector select:hover,
.station-selector select:focus {
  border-color: var(--tfl-blue);
  outline: none;
}

.station-name {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.line-arrivals {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
}

.line-arrivals-header {
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: capitalize;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.arrivals-list {
  list-style: none;
}

.arrival-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.arrival-item:last-child {
  border-bottom: none;
}

.arrival-info {
  flex: 1;
}

.arrival-destination {
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 3px;
}

.arrival-platform {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.arrival-time {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--tfl-blue);
  white-space: nowrap;
  margin-left: 15px;
}

.arrival-time.due {
  color: var(--tfl-red);
}

.no-arrivals {
  text-align: center;
  padding: 30px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Station Configuration Styles */
.station-config-section {
  margin-bottom: 25px;
}

.station-config-section h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.configured-stations {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.configured-station-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  background: white;
  transition: all 0.2s;
}

.configured-station-item:hover {
  background-color: var(--bg-light);
  border-color: var(--tfl-blue);
}

.configured-station-info {
  flex: 1;
}

.configured-station-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 3px;
}

.configured-station-lines {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.configured-station-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 4px;
  transition: all 0.2s;
}

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

.btn-danger:hover {
  background-color: #fee;
  color: var(--tfl-red);
}

/* Station Arrivals Card Styles */
.arrivals-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 1024px) {
  .arrivals-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.station-arrivals-card {
  background: white;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 0;
}

.station-arrivals-lines-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

@media (min-width: 768px) {
  .station-arrivals-lines-container {
    grid-template-columns: repeat(2, 1fr);
  }

  /* If only one line, make it full width */
  .station-arrivals-lines-container:has(.line-arrivals-compact:only-child) {
    grid-template-columns: 1fr;
  }
}

.station-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-color);
}

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

.travel-time-indicator {
  font-size: 0.9rem;
  color: var(--text-secondary);
  background-color: var(--bg-light);
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-color);
}

.station-card-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.line-arrivals-compact {
  margin-bottom: 15px;
}

.line-arrivals-compact:last-child {
  margin-bottom: 0;
}

.line-arrivals-header-compact {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: capitalize;
  margin-bottom: 10px;
  color: var(--tfl-blue);
  border-left: 5px solid var(--border-color);
  padding-left: 10px;
}

/* Line-specific border colors for arrivals header */
.line-arrivals-header-compact[data-line="bakerloo"] {
  border-left-color: var(--line-bakerloo);
}

.line-arrivals-header-compact[data-line="central"] {
  border-left-color: var(--line-central);
}

.line-arrivals-header-compact[data-line="circle"] {
  border-left-color: var(--line-circle);
}

.line-arrivals-header-compact[data-line="district"] {
  border-left-color: var(--line-district);
}

.line-arrivals-header-compact[data-line="elizabeth"] {
  border-left-color: var(--line-elizabeth);
}

.line-arrivals-header-compact[data-line="hammersmith-city"] {
  border-left-color: var(--line-hammersmith-city);
}

.line-arrivals-header-compact[data-line="jubilee"] {
  border-left-color: var(--line-jubilee);
}

.line-arrivals-header-compact[data-line="metropolitan"] {
  border-left-color: var(--line-metropolitan);
}

.line-arrivals-header-compact[data-line="northern"] {
  border-left-color: var(--line-northern);
}

.line-arrivals-header-compact[data-line="piccadilly"] {
  border-left-color: var(--line-piccadilly);
}

.line-arrivals-header-compact[data-line="victoria"] {
  border-left-color: var(--line-victoria);
}

.line-arrivals-header-compact[data-line="waterloo-city"] {
  border-left-color: var(--line-waterloo-city);
}

.line-arrivals-header-compact[data-line="dlr"] {
  border-left-color: var(--line-dlr);
}

.line-arrivals-header-compact[data-line="london-overground"],
.line-arrivals-header-compact[data-line="windrush"],
.line-arrivals-header-compact[data-line="liberty"],
.line-arrivals-header-compact[data-line="lioness"],
.line-arrivals-header-compact[data-line="mildmay"],
.line-arrivals-header-compact[data-line="suffragette"],
.line-arrivals-header-compact[data-line="weaver"] {
  border-left-color: var(--line-london-overground);
}

.line-arrivals-header-compact[data-line="tram"] {
  border-left-color: var(--line-trams);
}

.line-arrivals-header-compact[data-line="cable-car"] {
  border-left-color: var(--line-cable-car);
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background-color: white;
  border-radius: 8px;
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-large {
  max-width: 700px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 2px solid var(--border-color);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text-primary);
}

.close-btn {
  background: none;
  border: none;
  font-size: 2rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.close-btn:hover {
  color: var(--tfl-red);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-description {
  margin-bottom: 15px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.line-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.line-checkbox-label {
  display: flex;
  align-items: center;
  padding: 12px;
  border: 2px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.line-checkbox-label:hover {
  background-color: var(--bg-light);
  border-color: var(--tfl-blue);
}

.line-checkbox-label input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-right: 12px;
  cursor: pointer;
  accent-color: var(--tfl-blue);
}

.line-checkbox-label span {
  font-size: 1rem;
  font-weight: 500;
}

.modal-footer {
  padding: 20px;
  border-top: 2px solid var(--border-color);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background-color: #001580;
}

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

.btn-secondary:hover {
  background-color: #e0e0e0;
}

.btn:active {
  transform: translateY(1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  header {
    margin: -10px -10px 10px -10px;
    padding: 15px 20px;
  }

  h1 {
    font-size: 1.5rem;
  }

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

  .section-header .section-title {
    width: 100%;
  }

  .configure-btn {
    width: 100%;
  }

  .search-container {
    max-width: 100%;
  }

  .line-status-grid {
    grid-template-columns: 1fr;
  }

  .arrival-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .arrival-time {
    margin-left: 0;
    margin-top: 5px;
  }

  .modal-footer {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
