/* ========== 1. GLOBAL STYLES - Irish Times Inspired ============== */
:root {
  --it-primary: #326891;
  --it-dark: #1a1a1a;
  --it-light-gray: #f5f5f5;
  --it-medium-gray: #e0e0e0;
  --it-border: #d0d0d0;
  --it-text: #333;
  --it-accent: #d32f2f;
  --page-max-width: 1200px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Georgia', 'Times New Roman', serif;
  background: var(--it-light-gray);
  color: var(--it-text);
  line-height: 1.6;
  font-size: 16px;
}

.page-container {
  max-width: var(--page-max-width);
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

/* ========== 2. HEADER - Irish Times Style ======================== */
.irish-times-header {
  background: #fff;
  border-bottom: 3px solid var(--it-primary);
  position: relative;
}

.header-top-bar {
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  align-items: center;
  padding: 20px 30px;
  gap: 20px;
  min-height: 120px;
}

.header-left {
  display: flex;
  justify-content: flex-start;
}

.header-center {
  text-align: center;
}

.header-right {
  display: flex;
  justify-content: flex-end;
}

.main-logo {
  max-height: 160px;
  width: auto;
  object-fit: contain;
}

.geek-logo {
  max-height: 240px;
  width: auto;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.geek-logo:hover {
  transform: scale(1.05);
}

.masthead {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--it-primary);
  margin: 0 0 10px 0;
  letter-spacing: -0.5px;
}

.date-weather-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.current-date {
  font-size: 0.9rem;
  color: var(--it-text);
  font-weight: 500;
}

.date-picker-container {
  position: relative;
}

.date-picker-input {
  padding: 6px 12px;
  border: 1px solid var(--it-border);
  border-radius: 4px;
  font-size: 0.85rem;
  background: #fff;
  color: var(--it-text);
}

/* ========== 3. FLOATING CONTROL PANEL ========================== */
.floating-control-panel {
  position: fixed;
  top: -120px; /* Show header and a bit of content initially */
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 1.0);
  border-bottom: 1px solid var(--it-border);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  z-index: 1000;
  transform: translateY(0);
  transition: all 0.3s ease;
  opacity: 1;
}

.floating-control-panel:hover,
.floating-control-panel.sticky,
.floating-control-panel.show-full {
  top: 0;
}

.floating-control-panel.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}

/* Add a visual hint tab at the bottom */
.floating-control-panel::after {
  content: "⚙️ AI Models";
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--it-primary);
  color: white;
  padding: 6px 16px;
  border-radius: 0 0 8px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  animation: pulseHint 2s ease-in-out infinite;
}

@keyframes pulseHint {
  0%, 100% { opacity: 0.8; transform: translateX(-50%) scale(1); }
  50% { opacity: 1; transform: translateX(-50%) scale(1.05); }
}

.floating-control-panel:hover::after,
.floating-control-panel.sticky::after {
  opacity: 0;
  pointer-events: none;
  animation: none;
}

.control-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  background: var(--it-primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 1001;
}

.control-panel-header h3 {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
}

.close-panel {
  background: none;
  border: none;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-panel:hover {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

.control-panel-content {
  display: flex;
  gap: 30px;
  padding: 16px 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.control-group {
  margin: 0;
  border: none;
  padding: 0;
  flex: 1;
  min-width: 300px;
}

.control-group legend {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--it-primary);
  margin-bottom: 8px;
  padding: 0;
}

.control-group-content {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.control-group label {
  display: block;
  margin: 0;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 8px;
  transition: all 0.2s ease;
  border-radius: 4px;
  white-space: nowrap;
  background: var(--it-light-gray) !important;
  border: 1px solid var(--it-border);
}

/* Ensure both LLM and Image Gen sections have solid backgrounds */
#llm-selection-group label,
#imagegen-selection-group label {
  background: var(--it-light-gray) !important;
}

.control-group label:hover {
  background: var(--it-primary) !important;
  color: white;
}

.control-group label:has(input:checked) {
  background: var(--it-dark) !important;
  color: #ffd700;
  font-weight: 600;
  border: 2px solid var(--it-primary);
}

/* Ensure selected items have good hover state too */
.control-group label:has(input:checked):hover {
  background: var(--it-primary) !important;
  color: #ffffff;
  border: 2px solid var(--it-dark);
}

.control-group input[type="radio"] {
  margin-right: 6px;
  accent-color: var(--it-primary);
}

/* ========== 4. PAGE NAVIGATION BUTTONS ========================= */
.page-nav-button {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  background: rgba(50, 104, 145, 0.9);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 999;
  transition: all 0.3s ease;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  user-select: none;
}

.page-nav-button.visible {
  opacity: 1;
  pointer-events: all;
}

.page-nav-button:hover {
  background: var(--it-primary);
  transform: translateY(-50%) scale(1.1);
}

.nav-left {
  left: 20px;
}

.nav-right {
  right: 20px;
}

/* ========== 5. IRISH TIMES CONTENT LAYOUT ==================== */
.irish-times-content {
  padding: 20px;
}

.main-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.main-content-area {
  grid-column: span 4;
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 20px;
}

.lead-story {
  grid-column: span 1;
}

.author-section {
  grid-column: span 1;
}

.sponsored-section {
  grid-column: span 4;
}

.humor-section {
  grid-column: span 4;
}

.bottom-articles {
  grid-column: span 4;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.top-stories {
  display: grid;
  grid-template-columns: 3fr 1fr; /* 3 parts for lead, 1 for secondary */
  gap: 20px;
  margin-bottom: 20px;
}

.lead-story {
  grid-column: span 1; /* Takes up 1 area of the parent grid */
}

.story-headline {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 700;
  color: var(--it-dark);
  margin: 0 0 16px 0;
  line-height: 1.2;
  cursor: help;
}

.story-image {
  width: 100%;
  height: auto; /* Allow height to scale automatically */
  object-fit: contain; /* Ensure the whole image is visible */
  margin: 0 0 20px 0;
  border-radius: 3px;
}

.story-content {
  line-height: 1.7;
  font-size: 1rem;
  color: #2c3e50;
  padding: 0;
}

.story-content p {
  margin: 0 0 1em 0;
  text-align: justify;
  hyphens: auto;
}

.story-content h3, .story-content h4 {
  color: var(--it-primary);
  margin-top: 1.5em;
  margin-bottom: 0.8em;
  font-weight: 600;
}

/* Quote styling for stories */
.story-quote {
  background: #f8f9fa;
  border-left: 4px solid var(--it-primary);
  padding: 15px 20px;
  margin: 20px 0;
  font-style: italic;
  position: relative;
}

.story-quote::before {
  content: '"';
  font-size: 3rem;
  color: var(--it-primary);
  position: absolute;
  left: 8px;
  top: -5px;
  font-family: Georgia, serif;
}

/* New improved quote styles to avoid overwhelming large quotes */
.dialogue-quote {
  font-style: italic;
  color: var(--it-primary);
  font-weight: 500;
  padding: 2px 4px;
  background: rgba(50, 104, 145, 0.1);
  border-radius: 3px;
}

.standalone-quote {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-left: 4px solid var(--it-primary);
  padding: 12px 18px;
  margin: 12px 0;
  font-style: italic;
  border-radius: 0 6px 6px 0;
  color: var(--it-text);
  position: relative;
}

/* Celebration/achievement styling */
.celebration-content {
  background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
  border: 2px solid #f39c12;
  border-radius: 12px;
  padding: 20px;
  margin: 15px 0;
  position: relative;
  overflow: hidden;
}

.celebration-content::before {
  content: '🎉';
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 1.5rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.celebration-title {
  color: #d68910;
  font-weight: bold;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Life hack fail styling */
.life-hack-fail {
  background: #fadbd8;
  border-left: 5px solid #e74c3c;
  padding: 15px;
  margin: 15px 0;
  border-radius: 0 8px 8px 0;
}

.life-hack-fail h4 {
  color: #c0392b;
  margin-bottom: 10px;
  font-weight: 600;
}

/* Social media vs reality styling */
.comparison-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 20px 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.expectation-side {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
  padding: 20px;
  text-align: center;
}

.reality-side {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  padding: 20px;
  text-align: center;
}

.comparison-split h4 {
  margin-bottom: 15px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.expectation-side h4 {
  color: #ad1457;
}

.reality-side h4 {
  color: #00695c;
}

/* Enhanced comparison table */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.comparison-table thead {
  background: linear-gradient(135deg, var(--it-primary) 0%, #2980b9 100%);
  color: white;
}

.comparison-table th {
  padding: 15px 12px;
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.9rem;
}

.comparison-table td {
  padding: 12px;
  border-bottom: 1px solid #ecf0f1;
  vertical-align: top;
}

.comparison-table tbody tr:hover {
  background: #f8f9fa;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.comparison-table tbody tr:nth-child(even) {
  background: #f9f9f9;
}

.comparison-table .model-name {
  font-weight: 600;
  color: var(--it-primary);
  background: #e8f4fd;
}

/* Cynical commentary styling */
.cynical-comment {
  background: #fff5e6;
  border-radius: 8px;
  padding: 10px 15px;
  font-style: italic;
  color: #8b4513;
  border-left: 3px solid #ff8c00;
  margin: 10px 0;
}

/* Tech fail indicators */
.tech-fail-icon {
  display: inline-block;
  margin-right: 8px;
  font-size: 1.2rem;
}

.tech-fail-icon::before {
  content: '⚠️';
}

/* Achievement badge styling */
.achievement-badge {
  display: inline-flex;
  align-items: center;
  background: linear-gradient(45deg, #ffd700, #ffed4e);
  color: #8b4513;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: bold;
  margin: 5px 5px 5px 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.achievement-badge::before {
  content: '🏆';
  margin-right: 5px;
}

.secondary-stories {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.secondary-story, .feature-story {
  background: #fff;
  padding: 15px;
  border: 1px solid var(--it-border);
  flex: 1; /* Grow to fill space if needed */
}

.secondary-headline, .feature-headline {
  font-family: 'Playfair Display', serif;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--it-primary);
  margin: 0 0 12px 0;
  cursor: help;
}

.secondary-image, .feature-image {
  width: 100%;
  height: auto; /* Allow height to scale automatically */
  object-fit: contain; /* Ensure the whole image is visible */
  margin-bottom: 15px;
  border-radius: 2px;
}

.secondary-content, .feature-content {
  font-size: 0.9rem;
  color: #555;
}

/* ========== 6. BOTTOM SECTIONS ================================= */
.bottom-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.section-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--it-primary);
  margin: 0 0 16px 0;
  padding-bottom: 5px;
  border-bottom: 2px solid var(--it-primary);
  margin-bottom: 15px;
}

.author-section, .humor-section, .sponsored-section {
  background: #fdfdfd;
  padding: 15px;
  border: 1px solid var(--it-border);
}

.author-bio-content {
  display: block; /* Change from flex to block for float to work */
}

.author-bio-logo {
  float: left;
  max-width: 80px;
  height: auto;
  border-radius: 50%;
  margin-right: 15px;
  margin-bottom: 5px;
}

.humor-content-wrapper {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.humor-image {
  max-width: 150px;
  height: auto;
  object-fit: cover;
}

.humor-content {
  font-size: 0.95rem;
  flex: 1;
}

.sponsor-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 15px;
}

.sponsor-item {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--it-border);
  height: 0;
  padding-bottom: 100%; /* This creates a square aspect ratio */
}

.sponsor-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.sponsor-item:hover img {
  transform: scale(1.05);
}

/* ========== 7. COMPARISON TABLE (Preserved) =================== */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  font-size: 0.9rem;
  line-height: 1.5;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.comparison-table thead {
  background: linear-gradient(135deg, var(--it-primary), #2d5aa0);
  color: #fff;
}

.comparison-table th {
  padding: 12px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 2px solid #1a252f;
}

.comparison-table td {
  padding: 10px;
  border-bottom: 1px solid #e8e8e8;
  vertical-align: top;
}

.comparison-table tbody tr:hover {
  background: #f8f9fa;
  transition: background-color 0.2s ease;
}

.comparison-table tbody tr:nth-child(even) {
  background: #fdfdfd;
}

.comparison-table .model-name {
  font-weight: 500;
  background: linear-gradient(90deg, #ecf0f1, #f8f9fa);
  border-right: 2px solid #bdc3c7;
  min-width: 140px;
}

.comparison-table .model-name strong {
  color: var(--it-primary);
  font-weight: 700;
}

.table-subtitle {
  margin: 0 0 10px 0;
  color: var(--it-primary);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid #ecf0f1;
}

/* ========== 8. TOOLTIP SYSTEM (Preserved) ===================== */
.prompt-tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.95);
  color: #fff;
  padding: 15px;
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.4;
  max-width: 450px;
  min-width: 250px;
  z-index: 1000;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.prompt-tooltip:has(.prompt-tooltip-image) {
  max-width: 500px;
}

.prompt-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.prompt-tooltip-header {
  font-weight: bold;
  color: #ffd700;
  margin-bottom: 8px;
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding-bottom: 5px;
}

.prompt-tooltip-content {
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 300px;
  overflow-y: auto;
}

.prompt-tooltip-image {
  max-width: 200px;
  max-height: 150px;
  width: auto;
  height: auto;
  margin-bottom: 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-prompt-type] {
  cursor: help;
  position: relative;
}

[data-prompt-type]:hover {
  background-color: rgba(50, 104, 145, 0.1);
  transition: background-color 0.2s ease;
}

/* ========== 9. RESPONSIVE DESIGN ============================== */
@media (max-width: 992px) {
  .header-top-bar {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 15px;
    padding: 15px 20px;
  }
  
  .header-left, .header-right {
    justify-content: center;
  }
  
  .top-stories {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .bottom-section {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .control-panel-content {
    flex-direction: column;
    gap: 20px;
  }
  
  .control-group {
    min-width: auto;
  }
}

@media (max-width: 768px) {
  .irish-times-content {
    padding: 20px 15px;
  }
  
  .masthead {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
  }
  
  .secondary-stories {
    gap: 20px;
  }
  
  .author-bio-content {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .sponsor-grid {
    grid-template-columns: 1fr;
  }
  
  .page-nav-button {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }
  
  .nav-left {
    left: 10px;
  }
  
  .nav-right {
    right: 10px;
  }
  
  .floating-control-panel {
    max-height: 180px;
  }
  
  .control-panel-content {
    padding: 12px 15px;
    gap: 15px;
  }
  
  .control-group-content {
    gap: 6px 12px;
  }
  
  .control-group label {
    font-size: 0.7rem;
    padding: 3px 6px;
    background: var(--it-light-gray) !important;
  }

  .comparison-split {
    grid-template-columns: 1fr;
    gap: 0;
  }
  
  .celebration-content {
    padding: 15px;
  }
  
  .story-quote {
    padding: 12px 15px;
    margin: 15px 0;
  }
  
  .achievement-badge {
    font-size: 0.8rem;
    padding: 4px 10px;
  }
}

@media (max-width: 480px) {
  .control-panel-content {
    flex-direction: column;
    gap: 12px;
    padding: 10px 12px;
  }
  
  .control-group {
    min-width: auto;
  }
  
  .control-group-content {
    flex-direction: column;
    gap: 4px;
  }
  
  .control-group label {
    text-align: center;
    width: 100%;
    background: var(--it-light-gray) !important;
  }
  
  .floating-control-panel {
    max-height: 220px;
  }
  
  .comparison-table,
  .comparison-table thead,
  .comparison-table tbody,
  .comparison-table th,
  .comparison-table td,
  .comparison-table tr {
    display: block;
  }
  
  .comparison-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  
  .comparison-table tr {
    border: 1px solid #ccc;
    margin-bottom: 10px;
    padding: 10px;
    background: #fff;
    border-radius: 4px;
  }
  
  .comparison-table td {
    border: none;
    padding: 5px 0;
    position: relative;
    padding-left: 30%;
  }
  
  .comparison-table td:before {
    content: attr(data-label);
    position: absolute;
    left: 6px;
    width: 25%;
    padding-right: 10px;
    white-space: nowrap;
    font-weight: 600;
    color: var(--it-primary);
  }
}

/* ========== 10. FOOTER ========================================= */
.irish-times-footer {
  text-align: center;
  padding: 30px 20px;
  background: var(--it-dark);
  color: #fff;
  font-size: 0.85rem;
}

/* ========== 11. ADDITIONAL UTILITY CLASSES =================== */
.comparison-list {
  margin: 15px 0;
}

.list-subtitle {
  margin: 0 0 10px 0;
  color: var(--it-primary);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid #ecf0f1;
}

.formatted-comparison-list {
  padding-left: 20px;
  line-height: 1.6;
}

.formatted-comparison-list li {
  margin-bottom: 12px;
  padding: 8px;
  background: #f8f9fa;
  border-left: 3px solid var(--it-primary);
  border-radius: 0 4px 4px 0;
}

.formatted-comparison-list li strong {
  color: var(--it-primary);
  font-weight: 700;
}
