/* ============================================
   RESPONSIVE STYLES FOR ALL PAGES
   Bangladesh Election Portal 2026
   ============================================ */

/* Text Blink Animation */
@keyframes blink-text {
  0%,
  50% {
    opacity: 1;
  }

  51%,
  100% {
    opacity: 0.3;
  }
}

.blink-text {
  animation: blink-text 1s ease-in-out infinite;
}

/* Base Responsive Typography */
@media (max-width: 640px) {
  html {
    font-size: 16px;
  }
}

/* ============================================
   SCROLLBAR UTILITIES
   ============================================ */
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* ============================================
   CHART CONTAINER RESPONSIVE HEIGHTS
   ============================================ */
.chart-container {
  position: relative;
  height: 200px;
  width: 100%;
}

@media (min-width: 480px) {
  .chart-container {
    height: 220px;
  }
}

@media (min-width: 768px) {
  .chart-container {
    height: 280px;
  }
}

/* ============================================
   MOBILE-FIRST ADJUSTMENTS (< 768px)
   ============================================ */
@media (max-width: 767px) {
  /* Container Padding */
  .main-container,
  .max-w-7xl {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Chart Card Compression */
  .chart-card {
    padding: 0.75rem !important;
  }

  .chart-card h4 {
    margin-bottom: 0.5rem !important;
    font-size: 1rem !important;
    /* Increased from 0.85rem */
  }

  .chart-card p {
    margin-top: 0.25rem !important;
    font-size: 0.875rem !important;
    /* Increased from 10px */
  }

  /* Table Optimizations */
  table {
    font-size: 0.875rem !important;
    /* Increased from 0.75rem */
  }

  table th,
  table td {
    padding: 0.5rem 0.6rem !important;
  }

  /* Comparison Table */
  .comparison-table td {
    padding: 0.4rem 0.5rem !important;
  }

  /* Button Adjustments */
  .btn-responsive {
    padding: 0.75rem 1.25rem !important;
    font-size: 1rem !important;
    /* Increased from 0.875rem */
  }

  /* Card Adjustments */
  .card-responsive {
    padding: 1rem !important;
  }

  /* Hide non-essential elements on mobile */
  .hide-mobile {
    display: none !important;
  }

  /* Show mobile-only elements */
  .show-mobile {
    display: block !important;
  }

  /* Sticky bottom bar adjustment */
  #sticky-bottom-bar {
    bottom: 4rem !important;
    z-index: 40 !important;
  }
}

/* ============================================
   SMALL MOBILE BREAKPOINT (< 400px)
   ============================================ */
@media (max-width: 400px) {
  html {
    font-size: 15px;
    /* Increased from 14px */
  }

  /* Typography */
  h1.text-4xl,
  h1.text-3xl,
  .text-4xl,
  .text-3xl {
    font-size: 1.75rem !important;
    line-height: 2rem !important;
  }

  h2.text-3xl,
  h2.text-2xl,
  .text-2xl {
    font-size: 1.5rem !important;
    line-height: 1.75rem !important;
  }

  .text-xl {
    font-size: 1.125rem !important;
  }

  /* Container adjustments */
  .max-w-7xl {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }

  /* Card Padding Reductions */
  .p-6,
  .p-8,
  .p-10,
  .p-5 {
    padding: 0.875rem !important;
  }

  /* Grid Gaps */
  .gap-6,
  .gap-8 {
    gap: 1rem !important;
  }

  .gap-4 {
    gap: 0.75rem !important;
  }

  /* Candidate Page Specifics */
  .candidate-img-lg {
    height: 250px !important;
  }

  #tab-nav button {
    padding: 0.5rem 0.25rem !important;
    font-size: 0.9rem !important;
    /* Increased from 0.7rem */
    min-width: auto !important;
  }

  /* Form Inputs */
  input,
  select,
  textarea,
  button {
    font-size: 0.875rem !important;
    /* Increased from 0.8rem */
    padding: 0.6rem !important;
  }

  /* Chart Containers */
  .chart-container {
    height: 180px !important;
  }

  /* Header adjustments */
  header .w-10,
  header .h-10 {
    width: 2rem !important;
    height: 2rem !important;
  }

  header .text-lg {
    font-size: 1rem !important;
  }

  /* Stats Cards */
  .bg-linear-to-r.p-3.md\:p-4 {
    padding: 0.75rem !important;
  }

  .text-3xl.font-bold {
    font-size: 1.5rem !important;
  }

  /* News Ticker */
  .news-ticker-content a {
    font-size: 0.8rem !important;
    /* Increased from 0.7rem */
  }

  /* Comparison Table */
  .comparison-table td,
  .comparison-table th {
    font-size: 0.7rem !important;
    /* Increased from 0.6rem */
    padding: 0.25rem 0.5rem !important;
  }

  /* Tall elements */
  .h-80 {
    height: 220px !important;
  }
}

/* ============================================
   ULTRA-SMALL MOBILE (< 360px)
   ============================================ */
@media (max-width: 360px) {
  html {
    font-size: 15px;
  }

  h1 {
    font-size: 1.75rem !important;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.5rem !important;
    line-height: 1.2;
  }

  h3 {
    font-size: 1.25rem !important;
  }

  /* More aggressive padding reduction */
  .p-6,
  .p-8,
  .p-10,
  .p-5 {
    padding: 0.875rem !important;
  }

  #tab-nav button {
    padding: 0.4rem 0.2rem !important;
    font-size: 0.875rem !important;
    /* Increased from 0.65rem */
  }
}

/* ============================================
   TABLET ADJUSTMENTS (768px - 1024px)
   ============================================ */
@media (min-width: 768px) and (max-width: 1024px) {
  .chart-container {
    height: 250px;
  }

  .chart-card {
    padding: 1rem !important;
  }

  /* Sticky bottom bar */
  #sticky-bottom-bar {
    border-radius: 12px 12px 0 0;
    margin: 0 auto;
    max-width: 64rem;
  }
}

/* ============================================
   DESKTOP OPTIMIZATIONS (> 1024px)
   ============================================ */
@media (min-width: 1024px) {
  #sticky-bottom-bar {
    border-radius: 12px 12px 0 0;
    margin: 0 auto;
    max-width: 64rem;
  }
}

/* ============================================
   GLASSMORPHISM UTILITIES
   ============================================ */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}

.glass-dark {
  background: rgba(30, 58, 138, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

.delay-100 {
  animation-delay: 0.1s;
}

.delay-200 {
  animation-delay: 0.2s;
}

.delay-300 {
  animation-delay: 0.3s;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Removed conflicting mobile-menu animation to let components.js manage transitions */

@keyframes ticker {
  0% {
    transform: translateX(100%);
  }

  100% {
    transform: translateX(-100%);
  }
}

.animate-ticker {
  animation: ticker 40s linear infinite;
}

.news-ticker-content:hover {
  animation-play-state: paused;
}

/* ============================================
   TABLE STYLES
   ============================================ */
tr.hover-shine:hover td {
  background-color: rgba(239, 246, 255, 0.5);
}

.comparison-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.comparison-table th,
.comparison-table td {
  padding: 12px 16px;
  border-bottom: 2px solid #dbeafe;
  border-right: 2px solid #dbeafe;
}

.comparison-table th {
  background-color: #f8fafc;
  font-weight: 700;
  color: #1e3a8a;
  text-align: center;
}

.group-header,
.group-header td {
  background-color: #1e3a8a !important;
  cursor: pointer;
  transition: all 0.2s;
}

.group-header:hover,
.group-header:hover td {
  background-color: #1e40af !important;
}

tr:not(.group-header):nth-child(even) td:not(.bg-white):not(.highlight-col) {
  background-color: #f1f5f9 !important;
}

.comparison-table tr:hover td:not(.group-header td) {
  background-color: #eff6ff !important;
}

.highlight-col {
  background-color: #dbeafe !important;
  border-left: 2px solid #3b82f6;
  border-right: 2px solid #3b82f6;
}

.group-header.collapsed .group-header-icon {
  transform: rotate(-90deg);
}

.group-content.hidden {
  display: none;
}

/* ============================================
   CHECKBOX CUSTOM STYLE
   ============================================ */
.custom-checkbox {
  appearance: none;
  background-color: #fff;
  margin: 0;
  font: inherit;
  color: currentColor;
  width: 1.15em;
  height: 1.15em;
  border: 0.15em solid #2563eb;
  border-radius: 0.15em;
  display: grid;
  place-content: center;
  cursor: pointer;
}

.custom-checkbox::before {
  content: '';
  width: 0.65em;
  height: 0.65em;
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  box-shadow: inset 1em 1em white;
  background-color: white;
  transform-origin: center;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.custom-checkbox:checked {
  background-color: #2563eb;
}

.custom-checkbox:checked::before {
  transform: scale(1);
}

/* ============================================
   HEADER STYLES
   ============================================ */
header nav a {
  position: relative;
  transition: all 0.2s ease;
}

header nav a:hover {
  transform: translateY(-1px);
}

/* ============================================
   FOOTER STYLES
   ============================================ */
footer a {
  position: relative;
  transition: all 0.2s ease;
}

footer a:hover {
  transform: translateX(2px);
}

/* ============================================
   RESPONSIVE TABLE WRAPPER
   ============================================ */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table {
  min-width: 600px;
}

/* ============================================
   MOBILE CARD VIEW FOR TABLES
   ============================================ */
@media (max-width: 767px) {
  .mobile-cards-table {
    display: block;
  }

  .mobile-cards-table thead {
    display: none;
  }

  .mobile-cards-table tbody,
  .mobile-cards-table tr {
    display: block;
    width: 100%;
  }

  .mobile-cards-table tr {
    margin-bottom: 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.75rem;
  }

  .mobile-cards-table td {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0 !important;
    border: none !important;
    text-align: right;
  }

  .mobile-cards-table td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #374151;
    text-align: left;
  }
}

/* ============================================
   RESPONSIVE GRID HELPERS
   ============================================ */
@media (max-width: 640px) {
  .stack-mobile {
    flex-direction: column !important;
  }

  .stack-mobile > * {
    width: 100% !important;
  }
}

/* ============================================
   PARTY MODAL RESPONSIVENESS
   ============================================ */
@media (max-width: 640px) {
  #modal-content-wrapper {
    width: 100% !important;
  }

  #modal-content-wrapper .grid-cols-3 {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================
   HERO SECTION RESPONSIVENESS
   ============================================ */
@media (max-width: 767px) {
  .hero-section {
    min-height: 60vh !important;
    padding-top: 4rem;
  }

  .hero-section h1 {
    font-size: 1.75rem !important;
  }

  .hero-section p {
    font-size: 1rem !important;
  }
}

/* ============================================
   STATS CARD RESPONSIVENESS
   ============================================ */
@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }

  .stats-card {
    padding: 0.75rem !important;
  }

  .stats-card .text-3xl {
    font-size: 1.5rem !important;
  }
}

/* ============================================
   PARLIAMENT MAP RESPONSIVENESS
   ============================================ */
@media (max-width: 767px) {
  .parliament-map-container {
    transform: scale(0.8);
  }

  .parliament-dot {
    width: 6px !important;
    height: 6px !important;
  }
}

/* ============================================
   CANDIDATE TABS RESPONSIVENESS
   ============================================ */
@media (max-width: 767px) {
  #tab-nav {
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  #tab-nav::-webkit-scrollbar {
    display: none;
  }

  #tab-nav button {
    flex-shrink: 0;
  }
}

/* ============================================
   POLL SECTION RESPONSIVENESS
   ============================================ */
@media (max-width: 767px) {
  .poll-option {
    padding: 0.75rem !important;
  }

  .poll-option-text {
    font-size: 0.9rem !important;
  }
}

/* ============================================
   FOOTER RESPONSIVENESS
   ============================================ */
@media (max-width: 640px) {
  footer .grid-cols-4 {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  footer .grid-cols-2 {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================
   NEWS CARDS RESPONSIVENESS
   ============================================ */
@media (max-width: 640px) {
  .news-card {
    padding: 0.75rem !important;
  }

  .news-card h3 {
    font-size: 0.95rem !important;
  }

  .news-card p {
    font-size: 0.875rem !important;
  }

  .news-card img {
    height: 140px !important;
  }
}

/* ============================================
   INCIDENT FORM RESPONSIVENESS
   ============================================ */
@media (max-width: 767px) {
  .incident-stats {
    position: static !important;
    margin-bottom: 1.5rem;
  }

  .incident-form-container {
    order: 1 !important;
  }

  .incident-stats-container {
    order: 2 !important;
  }
}

/* ============================================
   DIVISION CARDS RESPONSIVENESS
   ============================================ */
@media (max-width: 640px) {
  .division-card {
    padding: 0.75rem !important;
  }

  .division-card h3 {
    font-size: 0.9rem !important;
  }
}

/* ============================================
   YEAR SELECTOR RESPONSIVENESS
   ============================================ */
@media (max-width: 640px) {
  #year-selector {
    gap: 0.5rem !important;
  }

  #year-selector button {
    padding: 0.6rem 0.875rem !important;
    font-size: 0.95rem !important;
  }
}

/* ============================================
   PARTIES GRID RESPONSIVENESS
   ============================================ */
@media (max-width: 640px) {
  .party-card {
    margin-top: 0 !important;
  }

  .party-card .px-8 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .party-card .pb-8 {
    padding-bottom: 1.5rem !important;
  }
}

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