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

:root {
  --primary: #467bd6;
  --primary-dark: #3562b8;
  --secondary: #6c5ce7;
  --accent: #fd79a8;
  --success: #00b894;
  --warning: #fdcb6e;
  --danger: #d63031;
  --dark: #2d3436;
  --light: #dfe6e9;
  --bg: #f8f9fa;
  --card-bg: #ffffff;
  --border: #e1e8ed;
  --text: #2c3e50;
  --text-light: #636e72;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-lg: rgba(0, 0, 0, 0.15);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  margin: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  color: white;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  margin: 0 auto 2rem;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-title {
  font-size: 2rem;
  margin: 0 0 0.5rem 0;
  font-weight: 700;
}

.loading-text {
  font-size: 1.1rem;
  margin: 0;
  opacity: 0.9;
}

/* App Layout */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 320px;
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 2px 0 8px var(--shadow);
}

.sidebar-header {
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-content {
  flex: 1;
}

.app-title {
  font-size: 1.5rem;
  margin: 0 0 0.5rem 0;
  font-weight: 700;
}

.app-subtitle {
  font-size: 0.9rem;
  margin: 0;
  opacity: 0.9;
  font-weight: 300;
}

.sidebar-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s;
  flex-shrink: 0;
  margin-left: 1rem;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.3);
}

.toggle-icon {
  display: inline-block;
  font-size: 1.2rem;
  transition: transform 0.3s;
}

.sidebar.collapsed .toggle-icon {
  transform: rotate(-180deg);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.sidebar-content > div {
  margin-bottom: 1.5rem;
}

.sidebar-content > div:last-child {
  margin-bottom: 0;
}

.sidebar-content label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
  font-size: 0.9rem;
}

/* Main Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  background: var(--bg);
}

.date-selector {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.date-selector input[type="date"] {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.3s;
}

.date-selector input[type="date"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(70, 123, 214, 0.1);
}

.btn-today {
  width: 100%;
  padding: 0.75rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.95rem;
}

.btn-today:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow);
}

/* Tag Filter */
.tag-buttons-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-btn {
  padding: 0.5rem 0.85rem;
  background: var(--light);
  border: 2px solid transparent;
  border-radius: 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}

.tag-btn:hover {
  background: var(--primary);
  color: white;
  transform: translateY(-1px);
}

.tag-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary-dark);
  box-shadow: 0 2px 6px var(--shadow);
}

/* Search */
.search-box input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: all 0.3s;
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(70, 123, 214, 0.1);
}

/* Calendar Section */
.calendar-section {
  margin-bottom: 1.5rem;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 2px 4px var(--shadow);
}

.calendar-header h2 {
  font-size: 1.5rem;
  color: var(--dark);
  margin: 0;
}

.nav-btn {
  padding: 0.6rem 1.2rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  font-size: 0.9rem;
}

.nav-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px var(--shadow);
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: var(--card-bg);
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 4px var(--shadow);
}

.calendar-day-header {
  text-align: center;
  font-weight: 700;
  padding: 0.5rem;
  color: var(--text);
  font-size: 0.85rem;
  text-transform: uppercase;
  background: var(--light);
  border-radius: 6px;
}

.calendar-day {
  background: var(--bg);
  border-radius: 10px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  transition: all 0.3s;
  border: 2px solid transparent;
  min-height: 120px;
  overflow: hidden;
}

.calendar-day.empty {
  background: transparent;
  cursor: default;
}

.calendar-day.today {
  border-color: var(--warning);
  box-shadow: 0 0 0 2px rgba(253, 203, 110, 0.3);
}

.calendar-day.past {
  opacity: 0.7;
}

.calendar-day.past .day-number,
.calendar-day.past .event-preview {
  color: var(--text-light);
}

.calendar-day.has-news {
  cursor: pointer;
  border-color: transparent;
}

.calendar-day.has-news:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px var(--shadow-lg);
  border-color: var(--primary);
}

.calendar-day.has-news.low {
  background: linear-gradient(135deg, rgba(70, 123, 214, 0.15) 0%, rgba(70, 123, 214, 0.25) 100%);
}

.calendar-day.has-news.medium {
  background: linear-gradient(135deg, rgba(70, 123, 214, 0.4) 0%, rgba(70, 123, 214, 0.6) 100%);
}

.calendar-day.has-news.high {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
}

/* Past dates with events - gray theme */
.calendar-day.past.has-news.low {
  background: linear-gradient(135deg, rgba(150, 150, 150, 0.15) 0%, rgba(150, 150, 150, 0.25) 100%);
}

.calendar-day.past.has-news.medium {
  background: linear-gradient(135deg, rgba(150, 150, 150, 0.4) 0%, rgba(150, 150, 150, 0.5) 100%);
}

.calendar-day.past.has-news.high {
  background: linear-gradient(135deg, #7a7a7a 0%, #a0a0a0 100%);
  color: var(--text);
}

.calendar-day.past.has-news.high .event-preview {
  color: var(--text);
}

.calendar-day.past .news-count {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text-light);
}

.calendar-day.past.has-news.high .news-count {
  background: rgba(255, 255, 255, 0.85);
  color: var(--dark);
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 0.35rem;
  gap: 0.25rem;
}

.day-number {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

.news-count {
  font-size: 0.6rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.85);
  color: var(--primary);
  padding: 0.2rem 0.4rem;
  border-radius: 8px;
  line-height: 1;
  white-space: nowrap;
}

.calendar-day.has-news.high .news-count {
  background: rgba(255, 255, 255, 0.95);
  color: var(--primary-dark);
  font-weight: 700;
}

.event-previews {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.25rem;
  flex: 1;
  overflow: hidden;
}

.event-preview {
  font-size: 0.65rem;
  line-height: 1.3;
  padding: 0.25rem 0.35rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  border-left: 2px solid var(--primary);
}

.calendar-day.has-news.medium .event-preview {
  background: rgba(255, 255, 255, 0.85);
}

.calendar-day.has-news.high .event-preview {
  background: rgba(255, 255, 255, 0.95);
  color: var(--dark);
  border-left-color: white;
}

.event-more {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-light);
  padding: 0.2rem 0.35rem;
  text-align: center;
  font-style: italic;
}

.calendar-day.has-news.high .event-more {
  color: white;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  overflow: auto;
  animation: fadeIn 0.3s;
}

.modal-content {
  background: var(--card-bg);
  margin: 2% auto;
  width: 90%;
  max-width: 1200px;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 2px solid var(--border);
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: white;
  border-radius: 20px 20px 0 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.timeline-view {
  /* Styles for timeline inside modal */
}

/* Year Section */
.year-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.year-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.year-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, var(--light) 0%, var(--bg) 100%);
  border-radius: 8px;
}

.year-badge {
  font-size: 1.2rem;
  font-weight: 700;
  padding: 0.4rem 1rem;
  background: var(--primary);
  color: white;
  border-radius: 20px;
  box-shadow: 0 2px 6px var(--shadow);
}

.year-count {
  font-size: 0.9rem;
  color: var(--text-light);
  font-weight: 600;
}

.date-header {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--dark);
  margin: 1.5rem 0 1rem;
  padding-left: 0.5rem;
  border-left: 4px solid var(--secondary);
}

/* News Grid */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.news-card {
  background: var(--card-bg);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 6px var(--shadow);
  transition: all 0.3s;
  border: 2px solid transparent;
}

.news-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px var(--shadow-lg);
  border-color: var(--primary);
}

.news-image {
  width: 100%;
  height: 150px;
  background-size: cover;
  background-position: center;
  background-color: var(--light);
  position: relative;
  transition: background-color 0.3s ease;
}

.news-image.loading {
  background: linear-gradient(90deg, var(--light) 25%, var(--bg) 50%, var(--light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.news-image::before {
  content: '🎮';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  opacity: 0.3;
}

.news-image.loading::before {
  content: '';
}

.news-content {
  padding: 1rem;
}

.news-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--dark);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-meta {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 0.6rem;
}

.news-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.news-tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: var(--light);
  color: var(--text);
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
}

.news-link {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.news-link:hover {
  color: var(--primary-dark);
  transform: translateX(5px);
}

/* Insights */
.insights-section {
  margin-top: 3rem;
}

.insights-section h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  color: var(--dark);
}

#insights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.insight-card {
  background: linear-gradient(135deg, var(--card-bg) 0%, rgba(70, 123, 214, 0.05) 100%);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px var(--shadow);
  display: flex;
  gap: 1rem;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.insight-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px var(--shadow-lg);
  border-color: var(--primary);
}

.insight-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.insight-content {
  flex: 1;
}

.insight-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
  color: var(--dark);
}

.insight-text {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* No Data */
.no-data {
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
  font-size: 1.1rem;
  background: var(--light);
  border-radius: 10px;
}

/* Error */
.error {
  background: var(--danger);
  color: white;
  padding: 1.5rem;
  border-radius: 10px;
  margin: 2rem 0;
  text-align: center;
  font-weight: 600;
}

/* Responsive */
@media (max-width: 968px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    max-height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar.collapsed {
    max-height: auto;
  }

  .sidebar-header {
    padding: 1rem;
  }

  .app-title {
    font-size: 1.25rem;
  }

  .app-subtitle {
    font-size: 0.85rem;
  }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-content {
    padding: 1rem;
    max-height: 60vh;
    overflow-y: auto;
    transition: max-height 0.3s ease, padding 0.3s ease;
  }

  .sidebar.collapsed .sidebar-content {
    max-height: 0;
    padding: 0 1rem;
    overflow: hidden;
  }

  .main-content {
    padding: 1rem;
    flex: 1;
  }

  .news-grid {
    grid-template-columns: 1fr;
  }

  .calendar-header {
    flex-direction: column;
    gap: 0.75rem;
  }

  .calendar-header h2 {
    font-size: 1.25rem;
    order: -1;
  }

  .nav-btn {
    width: 100%;
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
  }

  .calendar {
    gap: 4px;
    padding: 0.75rem;
  }

  .calendar-day {
    min-height: 100px;
    padding: 0.4rem;
  }

  .day-header {
    margin-bottom: 0.25rem;
  }

  .day-number {
    font-size: 0.95rem;
  }

  .news-count {
    font-size: 0.55rem;
    padding: 0.15rem 0.3rem;
  }

  .event-preview {
    font-size: 0.6rem;
    padding: 0.2rem 0.3rem;
  }

  .event-more {
    font-size: 0.6rem;
  }

  .modal-content {
    width: 95%;
    margin: 5% auto;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-header h2 {
    font-size: 1.1rem;
  }

  .modal-body {
    padding: 0.75rem;
  }

  .news-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .news-image {
    height: 140px;
  }

  .news-content {
    padding: 0.85rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.news-card {
  animation: fadeIn 0.5s ease-out;
}

.year-section {
  animation: fadeIn 0.6s ease-out;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}
