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

:root {
  --background: #ffffff;
  --foreground: #1a1a1a;
  --card: #5E5EA1;
  --card-foreground: #ffffff;
  --primary: #d4a855;
  --purple: #5E5EA1;
}

html {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  height: auto !important;
  position: relative !important;
}

body {
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  padding-top: 80px;
  min-height: 100vh;
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  height: auto !important;
  position: relative !important;
}

.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px;
}

.card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  overflow: visible;
  margin-bottom: 20px;
}

.card > .tabs + .tab-content,
.card > .tab-content {
  background: white;
  border-radius: 0 0 16px 16px;
  margin-top: -2px;
}

.section-header-bar {
  background: #5E5EA1;
  color: white;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  background: #5E5EA1;
  padding: 12px 16px;
  gap: 10px;
  min-height: 56px;
  border-radius: 16px;
  border: 2px solid gold;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  margin-bottom: 0;
}

.tab-btn {
  padding: 10px 20px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 8px;
}

.tab-btn:hover {
  color: white;
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
}

.tab-btn.active {
  color: #5E5EA1;
  background: white;
  border-color: gold;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.sub-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  background: #4a4a8a;
  padding: 8px 16px;
  gap: 8px;
  margin-top: -2px;
}

.sub-tab-btn {
  padding: 6px 14px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-radius: 6px;
}

.sub-tab-btn:hover {
  color: white;
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
}

.sub-tab-btn.active {
  color: #4a4a8a;
  background: white;
  border-color: gold;
}

.subtitle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-bottom: 1px solid #eee;
  gap: 12px;
}

.subtitle-row .subtitle {
  padding: 0;
  border-bottom: none;
  margin: 0;
}

.subtitle {
  color: #666;
  font-size: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #eee;
}

/* Search box in subtitle row (light background) */
.subtitle-row .host-search-container {
  margin-left: 0;
}

.subtitle-row .host-search-input {
  padding: 6px 32px 6px 10px;
  border: 1px solid #ccc;
  background: #fff;
  color: #333;
  font-size: 13px;
  border-radius: 6px;
  width: 180px;
}

.subtitle-row .host-search-input::placeholder {
  color: #999;
}

.subtitle-row .host-search-input:focus {
  outline: none;
  background: #fff;
  border-color: #5E5EA1;
  box-shadow: 0 0 0 2px rgba(94, 94, 161, 0.2);
  width: 220px;
}

.subtitle-row .host-search-icon svg {
  color: #999;
}

.subtitle-row .host-search-clear {
  background: #ccc;
  color: #333;
}

.subtitle-row .host-search-clear:hover {
  background: #999;
  color: #fff;
}

.host-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
  padding: 16px;
}

.host-card {
  position: relative;
  display: grid;
  grid-template-rows: 160px auto auto auto auto;
  align-items: center;
  justify-items: center;
  padding: 16px 8px 8px 8px;
  background: #E6E6F8;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  height: 280px;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

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

.host-edit-icon {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 10;
  transition: transform 0.2s, background 0.2s;
}
.host-edit-icon:hover {
  transform: scale(1.1);
  background: #f0f0f0;
}
.host-edit-icon svg {
  width: 14px;
  height: 14px;
  color: #5E5EA1;
}

.host-info-icon {
  position: absolute;
  top: 8px;
  right: 44px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 10;
  cursor: pointer;
  font-weight: bold;
  color: white;
  font-size: 16px;
  font-family: serif;
  transition: filter 0.2s;
}
.host-info-icon:hover {
  filter: brightness(0.85);
}

.host-info-modal {
  display: none;
  position: fixed;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 9999;
  min-width: 200px;
  padding: 12px;
  text-align: left;
}
.host-info-modal.active {
  display: block;
}
.host-info-modal-title {
  font-weight: bold;
  color: #2196F3;
  margin-bottom: 8px;
  font-size: 13px;
  border-bottom: 1px solid #eee;
  padding-bottom: 6px;
}
.host-info-modal-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
  color: #333;
}
.host-info-modal-row span:first-child {
  color: #666;
}
.host-info-modal-row span:last-child {
  font-weight: 500;
}
.host-info-modal-row.clickable {
  cursor: pointer;
}
.host-info-modal-row.clickable:hover {
  background: #f5f5f5;
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
}

.host-logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 160px;
  min-height: 160px;
  max-height: 160px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.hit-count-badge {
  position: absolute;
  bottom: 11px;
  right: calc(10% + 6px);
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 4px;
}

.hit-count-badge svg {
  width: 11px;
  height: 11px;
}

.host-logo {
  max-width: 80%;
  max-height: 140px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3)) drop-shadow(0 0 8px rgba(94, 94, 161, 0.4));
  border: 1px solid #ccc;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Video logos - Chrome/Edge need explicit dimensions to render */
video.host-logo {
  width: 80% !important;
  height: 140px !important;
  max-width: 80% !important;
  max-height: 140px !important;
  object-fit: contain;
  background: transparent;
  display: block;
}

.host-edit-icon.large-logo {
  background: #e74c3c;
}
.host-edit-icon.large-logo svg {
  color: white;
}
.host-edit-icon.large-logo:hover {
  background: #c0392b;
}

.host-edit-icon.small-logo {
  background: #f1c40f;
}
.host-edit-icon.small-logo svg {
  color: #333;
}
.host-edit-icon.small-logo:hover {
  background: #d4ac0d;
}

.host-logo-placeholder {
  width: 120px;
  height: 120px;
  min-width: 120px;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 8px;
  color: transparent;
  font-weight: bold;
  font-size: 14px;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
}

/* Image overlays placeholder - placeholder always visible behind */
.host-logo-container .host-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.host-name {
  font-weight: 600;
  font-size: 14px;
  color: #333;
  text-align: center;
  margin-bottom: 4px;
  line-height: 1.3;
  align-self: end;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
  box-sizing: border-box;
}

.host-affiliate {
  font-size: 11px;
  text-align: center;
  margin-bottom: 2px;
}

.host-affiliate a {
  color: #5E5EA1;
  text-decoration: none;
}

.host-affiliate a:hover {
  text-decoration: underline;
}

.host-count {
  font-size: 12px;
  color: #666;
}

.host-contact {
  font-size: 12px;
  color: #000;
  text-align: center;
  word-break: break-all;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background 0.2s;
}

.host-contact:hover {
  background: rgba(0,0,0,0.1);
}

.host-contact.copied {
  background: #d4edda;
}

.loading-message {
  padding: 40px 20px;
  text-align: center;
  color: #666;
}

@media (max-width: 1200px) {
  .host-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .host-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 768px) {
  .host-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 500px) {
  .host-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .host-card { padding: 10px 5px 5px 5px; height: 220px; grid-template-rows: 120px auto auto auto auto; }
  .host-logo-container { height: 120px; min-height: 120px; max-height: 120px; }
  .host-logo { max-width: 90%; max-height: 100px; width: auto; height: auto; }
  video.host-logo { width: 90% !important; height: 100px !important; max-width: 90% !important; max-height: 100px !important; }
  .host-logo-placeholder { width: 90px; height: 90px; font-size: 12px; }
  .host-name { font-size: 12px; }
  .host-location { font-size: 10px; }
  .host-events { font-size: 10px; }
  .host-count { font-size: 10px; }
}

/* Hide sub-tabs on mobile to simplify the interface */
@media (max-width: 768px) {
  .sub-tabs {
    display: none !important;
  }

  /* Make main tabs more compact on mobile */
  .tabs {
    padding: 10px 12px;
    gap: 6px;
  }

  .tab-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}

/* When podcast name wraps to multiple lines - keep count visible */
.host-card.text-wrapped .host-logo {
  max-height: 100px;
  max-width: 50%;
  width: auto;
  height: auto;
}
.host-card.text-wrapped .host-logo-placeholder {
  width: 60px;
  height: 60px;
  font-size: 10px;
}

/* My Venues action buttons */
.my-venue-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 8px;
  width: 100%;
}
.venue-action-btn {
  padding: 6px 12px;
  background: #5E5EA1;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  transition: background 0.2s;
}
.venue-action-btn:hover {
  background: #4a4a8a;
}

/* Adjust host card height for My Venues to fit buttons */
#myvenues-tab .host-card {
  height: 320px;
  grid-template-rows: 140px auto auto auto auto auto;
}

/* Host Search Box */
.host-search-container {
  position: relative;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.host-search-input {
  padding: 8px 32px 8px 12px;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.15);
  color: white;
  font-size: 14px;
  border-radius: 8px;
  width: 180px;
  transition: all 0.2s;
}

.host-search-input::placeholder {
  color: rgba(255,255,255,0.6);
}

.host-search-input:focus {
  outline: none;
  background: rgba(255,255,255,0.25);
  border-color: gold;
  width: 220px;
}

.host-search-icon {
  position: absolute;
  right: 10px;
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.host-search-icon svg {
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.6);
}

.host-search-clear {
  position: absolute;
  right: 10px;
  width: 20px;
  height: 20px;
  background: rgba(255,255,255,0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.host-search-clear:hover {
  background: rgba(255,255,255,0.5);
}

/* Hide cards that don't match search */
.host-card.search-hidden {
  display: none !important;
}

/* Message when no results found */
.no-search-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: #666;
  font-size: 14px;
}

/* Search Modal Button */
.search-modal-btn {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: #5E5EA1;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.search-modal-btn:hover {
  background: #4a4a8a;
}

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

.search-modal.open {
  display: flex;
}

.search-modal-content {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.2s ease-out;
}

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

.search-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}

.search-modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

.search-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.search-modal-close:hover {
  color: #333;
}

.search-modal-body {
  padding: 20px;
}

.search-field {
  margin-bottom: 16px;
}

.search-field:last-child {
  margin-bottom: 0;
}

.search-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.search-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  box-sizing: border-box;
}

.search-field input:focus {
  outline: none;
  border-color: #5E5EA1;
  box-shadow: 0 0 0 3px rgba(94, 94, 161, 0.1);
}

.search-results-info {
  margin-top: 16px;
  padding: 10px 12px;
  background: #f8f8f8;
  border-radius: 6px;
  font-size: 13px;
  color: #666;
}

.search-modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
}

.search-clear-btn {
  padding: 8px 16px;
  background: #f0f0f0;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  color: #666;
  cursor: pointer;
  transition: background 0.2s;
}

.search-clear-btn:hover {
  background: #e0e0e0;
  color: #333;
}

.search-submit-btn {
  padding: 8px 20px;
  background: #5E5EA1;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  transition: background 0.2s;
  margin-left: 8px;
}

.search-submit-btn:hover {
  background: #4a4a8a;
}

.search-submit-btn:disabled {
  background: #999;
  cursor: not-allowed;
}

/* Search Type Toggle (Hosts vs Events) */
.search-type-toggle {
  display: flex;
  gap: 20px;
  margin-top: 5px;
}

.search-type-option {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-weight: normal;
}

.search-type-option input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Event Search Results Grid */
#eventSearchGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: flex-start;
  padding: 10px 0;
}

#eventSearchGrid .event-image-wrapper > img {
  object-fit: contain !important;
  background: #fff !important;
}

/* Event Search Header */
.event-search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.event-search-header h3 {
  margin: 0;
  color: #333;
}

.event-search-clear-btn {
  padding: 6px 12px;
  background: #e74c3c;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.event-search-clear-btn:hover {
  background: #c0392b;
}

.event-search-loading {
  display: none;
  text-align: center;
  padding: 20px;
}

.event-search-load-more {
  display: none;
  text-align: center;
  padding: 20px;
}

.event-search-load-more-btn {
  padding: 10px 20px;
  background: #3498db;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.event-search-load-more-btn:hover {
  background: #2980b9;
}

/* Host Card Utility Classes */
.host-card {
  cursor: pointer;
}

.no-events-card {
  background-color: #e0e0e0 !important;
}

/* Hidden Count Styling (red text for staff visibility) */
.host-count-hidden {
  color: #e74c3c !important;
}

/* Host Website/URL Link Styling */
.host-url {
  color: #800020 !important;
}

/* Host Info Icon Default Background */
.host-info-icon {
  background: #2196F3;
}

/* Error Message Styling */
.error-message {
  color: #e74c3c;
}

/* Subtitle Row Layout */
.subtitle-row-flex {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.subtitle-nowrap {
  margin: 0;
  white-space: nowrap;
}

/* Search Button Icon */
.search-btn-icon {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

/* HR Separator */
.section-separator {
  margin: 20px 0;
  border: none;
  border-top: 1px solid #ccc;
}

.search-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Distance display on host cards */
.host-distance {
  font-size: 12px;
  color: #5E5EA1;
  font-weight: 600;
  margin-top: 4px;
  background: rgba(94, 94, 161, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  display: inline-block;
}

@media (max-width: 768px) {
  .host-search-container {
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
  }

  .host-search-input {
    width: 100%;
  }

  .host-search-input:focus {
    width: 100%;
  }

  .subtitle-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .subtitle-row .host-search-container {
    width: 100%;
  }

  .subtitle-row .host-search-input {
    width: 100%;
  }

  .subtitle-row .host-search-input:focus {
    width: 100%;
  }
}

/* ====== MOBILE RESPONSIVENESS FIXES ====== */

/* Single column layout for very small phones (320px-400px) */
@media (max-width: 400px) {
  .host-grid {
    grid-template-columns: 1fr !important;
    gap: 8px;
    padding: 8px;
  }

  .host-card {
    height: auto !important;
    min-height: 200px;
    padding: 12px 6px 6px 6px !important;
  }

  .host-logo-container {
    height: 100px !important;
    min-height: 100px !important;
    max-height: 100px !important;
  }

  .host-logo {
    max-height: 90px !important;
  }

  video.host-logo {
    height: 90px !important;
    max-height: 90px !important;
  }

  #myvenues-tab .host-card {
    height: auto !important;
    min-height: 240px;
  }
}

/* Fix small font sizes for better mobile readability */
@media (max-width: 480px) {
  .host-affiliate {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }

  .host-count {
    font-size: 13px !important;
  }

  .subtitle {
    font-size: 13px !important;
    line-height: 1.5 !important;
  }

  .host-contact {
    font-size: 13px !important;
  }

  .hit-count-badge {
    font-size: 12px !important;
    padding: 4px 10px !important;
  }
}

/* Improve touch targets for small screens */
@media (max-width: 480px) {
  .tab-btn {
    padding: 10px 14px !important;
    min-height: 44px;
  }

  .sub-tab-btn {
    padding: 8px 12px !important;
    min-height: 40px;
  }

  .venue-action-btn {
    padding: 10px 14px !important;
    font-size: 12px !important;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
