/* This Week in Cybersecurity - Styles */
/* Dark theme, responsive design for cybersecurity news aggregation */

:root {
  --bg-primary: #111;
  --bg-secondary: #222;
  --bg-tertiary: #000;
  --text-primary: #eee;
  --text-secondary: #ccc;
  --text-muted: #888;
  --accent-blue: #88f;
  --accent-white: #fff;
  --border-radius: 6px;
  --box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

/* Base styles */
* {
  box-sizing: border-box;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: Arial, sans-serif;
  margin: 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.4;
}

/* Typography */
h1 {
  text-align: center;
  color: var(--accent-white);
  margin-bottom: 0.5em;
  font-size: 2em;
}

h2 {
  margin-top: 0;
  color: var(--text-primary);
}

h3 {
  color: var(--text-primary);
  margin-bottom: 1em;
}

p {
  margin: 0.5em 0;
}

code {
  background: var(--bg-secondary);
  padding: 2px 4px;
  border-radius: 3px;
  font-family: monospace;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2em;
}

/* Week Navigation FAB */
.week-fab {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  text-decoration: none;
  font-size: 1.2em;
}

.week-fab:hover {
  background: var(--accent-blue) !important;
  color: var(--accent-white) !important;
}

.meta {
  display: flex;
  justify-content: center;
  gap: 1em;
  flex-wrap: wrap;
  font-size: 0.9em;
  color: var(--text-muted);
  margin-top: 1em;
}

/* Main content */
main {
  flex: 1;
  overflow: visible; /* Ensure sticky positioning works */
}

#stories-container {
  min-height: 200px;
}

.loading {
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
  padding: 2em;
}

.error {
  text-align: center;
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  padding: 1em;
  border-radius: var(--border-radius);
  margin: 1em 0;
}

/* Calendar layout */
.calendar {
  display: flex;
  gap: 10px;
  margin-top: 1em;
  align-items: flex-start;
}

.day-column {
  padding: 10px;
  border-radius: var(--border-radius);
  background: var(--bg-tertiary);
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Allow flex items to shrink */
}

.day-column.today {
  background: var(--accent-white);
  color: var(--bg-primary) !important;
}

.day-column.today .day-name {
  color: var(--bg-primary);
}

.day-name {
  text-align: center;
  font-size: 1.4em;
  margin-bottom: 20px;
  font-weight: bold;
  color: var(--text-primary);
  position: -webkit-sticky; /* Safari support */
  position: sticky;
  top: 0;
  background: var(--bg-tertiary);
  z-index: 100;
  padding: 12px 10px;
  margin: -10px -10px 20px -10px;
}

.day-column.today .day-name {
  background: var(--accent-white);
  color: var(--bg-primary);
}

/* Stories */
.story {
  margin-bottom: 18px;
  flex-shrink: 0;
}

.story-content {
  display: inline;
  line-height: 1.4;
}

.story a {
  color: inherit;
  text-decoration: none;
  word-break: break-word;
  display: inline;
  padding: 2px 4px;
  border-radius: 3px;
  transition: background-color var(--transition);
}

.story a:hover {
  text-decoration: underline;
  background: rgba(255, 255, 255, 0.05);
}

/* Sentiment display */
.sentiment {
  text-align: center;
  margin: 1em auto;
  font-style: italic;
  color: var(--text-secondary);
  max-width: 1000px;
  padding: 1em;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
}

/* Count displays */
.total-count {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0.5rem 0;
  max-width: 100%;
  justify-content: center;
}

.total-count span {
  flex: 0 0 auto;
  min-width: 0;
}

/* Remove the stretching on wide screens - keep minimal width */
@media (min-width: 1200px) {
  .total-count span {
    flex: 0 0 auto;
  }
}

@media (min-width: 1600px) {
  .total-count span {
    flex: 0 0 auto;
  }
}

/* === Original Emoji Count Styling with Active/Inactive States === */
.emoji-count {
  background: var(--bg-secondary);
  padding: 0.25em 0.5em;
  border-radius: 3px;
  font-size: 0.9em;
  margin: 0.125rem;
  transition: all 0.2s ease;
}

.emoji-count.inactive {
  background: rgba(239, 68, 68, 0.8);
  color: white;
  border: 1px solid rgba(239, 68, 68, 0.9);
}

.emoji-count:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Dark theme for emoji counts */
[data-theme="dark"] .emoji-count.inactive {
  background: rgba(239, 68, 68, 0.8);
  color: white;
}

[data-theme="dark"] .emoji-count {
  background: var(--bg-secondary);
}

/* Info sections */
.info {
  margin-top: 2em;
  padding: 1em;
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  font-size: 0.95em;
}

.info-section {
  margin-bottom: 2em;
}

.info-category {
  margin-bottom: 1em;
}

.info-category ul {
  list-style: none;
  padding-left: 0;
  margin: 0.5em 0;
}

.info-category li {
  margin: 0.25em 0;
  padding: 0.25em 0;
}

/* === Info Overlays === */
.info-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.info-content,
.filter-content {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--box-shadow);
  border: 1px solid #444;
}

.info-close {
  position: absolute;
  top: 0.3em;
  right: 0.5em;
  font-size: 1.5em;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.25em;
  border-radius: 3px;
  transition: background-color var(--transition);
}

.info-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Buttons */
button {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid #444;
  padding: 0.5em 1em;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.9em;
  transition: all var(--transition);
}

button:hover {
  background: #333;
  border-color: #666;
}

button:active {
  transform: translateY(1px);
}

/* Footer */
footer {
  margin-top: 2rem;
  padding: 1rem;
  border-top: 1px solid var(--outline);
  background: var(--surface);
  text-align: center;
}

.footer-line {
  color: var(--text-secondary);
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

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

.footer-line span {
  margin: 0 0.25rem;
}

.filter-option {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  margin: 0.2em;
  padding: 0.3em 0.5em;
  background: var(--bg-tertiary);
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color var(--transition);
}

.filter-option:hover {
  background: #333;
}

.filter-option input[type="checkbox"] {
  margin: 0;
}

#filter-checkboxes {
  margin: 1em 0;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #444;
  padding: 0.5em;
  border-radius: var(--border-radius);
}

#filter-strict {
  margin-right: 0.4em;
}

/* Responsive design */
@media (max-width: 1600px), (max-aspect-ratio: 1/1) {
  .calendar {
    flex-direction: column-reverse;
  }
  
  .day-column {
    width: 100%;
    flex: none;
    margin-bottom: 1em;
  }
  
  .day-name {
    position: -webkit-sticky; /* Safari support */
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    z-index: 100;
    margin: -10px -8px 20px -8px;
    padding: 15px 8px 17px 8px;
  }
  
  .day-column.today .day-name {
    background: var(--accent-white);
    color: var(--bg-primary);
  }
  
  .footer-line {
    margin-bottom: 0.5em;
  }
  
  .total-count {
    max-width: none;
  }
}

@media (max-width: 768px) {
  body {
    margin: 10px;
  }

  h1 {
    font-size: 1.5em;
  }


  
  .calendar {
    gap: 5px;
  }
  
  .day-column {
    padding: 8px;
  }
  
  .day-name {
    font-size: 1.2em;
    margin-bottom: 15px;
    position: -webkit-sticky; /* Safari support */
    position: sticky;
    top: 0;
    background: var(--bg-tertiary);
    z-index: 100;
    margin: -8px -8px 15px -8px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .day-column.today .day-name {
    background: var(--accent-white);
    color: var(--bg-primary);
  }
  
  .info-content, .filter-content {
    padding: 1em;
    max-height: 90vh;
  }
  
  .filter-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .total-count {
    font-size: 1em;
    gap: 0.5em;
  }
  
  .controls {
    flex-direction: column;
    gap: 0.5em;
  }
}

@media (max-width: 480px) {
  .footer-line {
    font-size: 0.8em;
  }
  
  .story {
    margin-bottom: 12px;
  }
  
  .emoji-count {
    font-size: 0.8em;
    padding: 0.2em 0.4em;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus styles for keyboard navigation */
button:focus,
.story a:focus,
.filter-option:focus {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

/* Loading animation */
.loading::after {
  content: "...";
  animation: dots 1.5s steps(5, end) infinite;
}

@keyframes dots {
  0%, 20% {
    color: rgba(238, 238, 238, 0);
    text-shadow:
      .25em 0 0 rgba(238, 238, 238, 0),
      .5em 0 0 rgba(238, 238, 238, 0);
  }
  40% {
    color: var(--text-primary);
    text-shadow:
      .25em 0 0 rgba(238, 238, 238, 0),
      .5em 0 0 rgba(238, 238, 238, 0);
  }
  60% {
    text-shadow:
      .25em 0 0 var(--text-primary),
      .5em 0 0 rgba(238, 238, 238, 0);
  }
  80%, 100% {
    text-shadow:
      .25em 0 0 var(--text-primary),
      .5em 0 0 var(--text-primary);
  }
}

/* Print styles */
@media print {
  .info-overlay,
  .controls,
  .loading {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  .day-column {
    background: white;
    border: 1px solid #ccc;
  }
  
  .story a {
    color: black;
  }
}

/* === Floating Action Buttons === */
.fab-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 1000;
}

.fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.fab:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fab:hover:before {
  opacity: 1;
}

.fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.fab:active {
  transform: translateY(0);
}

.info-fab {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.filter-fab {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.kofi-fab {
  background: linear-gradient(135deg, #794bc4 0%, #5a3a9a 100%);
  color: white;
}

.kofi-icon {
  width: 24px;
  height: 24px;
  pointer-events: none; /* Prevent the image from interfering with hover */
}

/* === Filter Overlay Improvements === */

.filter-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 1px solid #444;
}

.filter-section h3 {
  margin: 0 0 0.75rem 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-mode {
  margin-bottom: 0.75rem;
  display: flex;
  gap: 1rem;
}

.filter-mode label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-checkbox {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  background: var(--bg-secondary);
  border: 1px solid #555;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.filter-checkbox:hover {
  background: #333;
  transform: translateY(-1px);
}

.filter-checkbox input[type="checkbox"] {
  margin: 0;
}

.filter-buttons button {
  padding: 0.5rem 1rem;
  border: 1px solid #444;
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.filter-buttons button:hover {
  background: #333;
  transform: translateY(-1px);
}

.filter-buttons button:active {
  transform: translateY(0);
}

/* Filter Actions Layout */
.filter-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.filter-actions-left {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.filter-actions-right {
  display: flex;
}

/* Make action buttons consistent with filter section buttons */
.filter-actions button {
  padding: 0.5rem 1rem;
  border: 1px solid #444;
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

.filter-actions button:hover {
  background: #333;
  transform: translateY(-1px);
}

.filter-actions button:active {
  transform: translateY(0);
}

#apply-filters {
  background: var(--accent-blue);
  color: var(--accent-white);
  font-weight: 600;
}

#apply-filters:hover {
  background: #99f;
}

/* Ensure filter section buttons are aligned properly */
.filter-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #444;
  justify-content: flex-start;
}

/* Emoji Tooltip Popup Styles */
.emoji-tooltip {
  position: absolute;
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid var(--accent-blue);
  z-index: 1001;
  pointer-events: none;
  opacity: 0;
  transform: translateY(0);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 250px;
  word-wrap: break-word;
  font-size: 0.9rem;
  line-height: 1.4;
}

.emoji-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

/* Comic book style tooltip - no arrow, fully rounded */
.emoji-tooltip.comic {
  background: #fff;
  color: #000;
  border: 3px solid #000;
  border-radius: 20px;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.3);
  font-weight: bold;
  text-shadow: none;
}

/* Clickable emoji styles - monospace-like alignment */
.clickable-emoji {
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 3px;
  transition: all 0.2s ease;
  display: inline-block;
  width: 1.5em;
  text-align: center;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", monospace;
  line-height: 1;
  vertical-align: baseline;
}

.clickable-emoji:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.05);
}

/* === Mobile Responsive === */
@media (max-width: 768px) {
  .fab-container {
    bottom: 16px;
    right: 16px;
  }
  
  .fab {
    width: 48px;
    height: 48px;
    font-size: 20px;
  }
  
  .filter-content {
    margin: 1rem;
    max-width: calc(100vw - 2rem);
    max-height: calc(100vh - 2rem);
  }
  
  .filter-checkboxes {
    gap: 0.25rem;
  }
  
  .emoji-count {
    font-size: 0.8rem;
    padding: 0.2rem 0.4rem;
  }
  
  .filter-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .filter-actions-left {
    justify-content: center;
  }
  
  .filter-actions-right {
    justify-content: center;
  }
}

[data-theme="dark"] .filter-section {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .filter-checkbox {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .filter-checkbox:hover {
  background: rgba(255, 255, 255, 0.08);
} 

