/* ===========================
   Media Queries - Responsive Design
   Consolidated responsive styles for all pages
   =========================== */

/* =============================================================================
   BREAKPOINT: 1119px - Tablets and small laptops
   ============================================================================= */
@media (max-width: 1119px) {
  .hamburger-menu {
    display: flex;
  }

  .nav-inner {
    grid-template-columns: auto 1fr;
    column-gap: 1rem;
    justify-items: start;
  }

  .nav-logo {
    justify-self: start;
  }

  .nav-links {
    display: none;
  }

  .nav-actions {
    display: none;
  }

  .mobile-nav-menu {
    display: flex;
  }
}

/* =============================================================================
   BREAKPOINT: 1024px - Large tablets and small desktops
   ============================================================================= */
@media (max-width: 1024px) {
  /* Statistics - adjust grid */
  .stats-overview {
    grid-template-columns: 1fr;
  }

  /* Trenerji dashboard layout */
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   BREAKPOINT: 968px - Tablets
   ============================================================================= */
@media (max-width: 968px) {
  /* Age Group - switch to single column layout */
  .age-group-content {
    grid-template-columns: 1fr;
  }

  .sidebar {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar > * {
    flex: 1 1 300px;
  }

  .trainer-card,
  .competition-card {
    flex: 1 1 320px;
    min-width: 0;
  }

  .age-group-title {
    font-size: 2.5rem;
  }

  .trainer-image-wrapper {
    aspect-ratio: 1 / 1;
    max-width: 240px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Avoid clipping trainer info when cards sit in flex rows */
  .trainer-card {
    overflow: visible;
  }

  /* Soften the top accent bar on narrow widths */
  .trainer-card::before {
    top: 0.5rem;
    left: 1rem;
    right: 1rem;
    height: 3px;
    border-radius: 999px;
  }

  /*
    On smaller screens the competition ("Tekmovanje") card should grow with
    its text content just like the custom mobile timetable cards do.
    Make sure its flex sizing doesn't impose a fixed height when stacked
    under the timetable section.
  */
  .timetable-section .competition-card {
    flex: 0 0 auto;
  }

  .timetable-section .competition-list {
    align-items: flex-start;
    justify-content: flex-start;
  }

  /* News - adjust grid */
  .news-section .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Novice (News) page */
  .featured-news {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
  }

  .featured-title {
    font-size: 1.5rem;
  }

  .featured-description {
    font-size: 0.95rem;
  }

  .novice-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

/* =============================================================================
   BREAKPOINT: 900px - Small tablets
   ============================================================================= */
@media (max-width: 900px) {
  .nav-inner {
    padding-inline: 1rem;
    column-gap: 1.25rem;
  }

  .nav-actions {
    display: none; /* For now hide CTAs on smaller screens */
  }

  .nav-links {
    gap: 1.25rem;
  }

  .hero {
    padding-top: 2.5rem;
  }

  .hero h1 {
    font-size: 2rem;
  }
  
  .hero-cards-container {
    flex-direction: column;
  }
  
  .hero-card {
    height: auto;
    min-height: 400px;
  }

  /* Mobile: make Šola (SELEKCIJE) tiles more compact */
  .hero-card.selekcije-card {
    min-height: 0;
    padding: 1.25rem 1rem;
  }

  .selekcije-card .card-header {
    margin-bottom: 0.75rem;
  }

  .selekcije-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.25rem 0;
  }

  .selekcije-item {
    padding: 0.6rem 0.5rem;
    border-radius: 0.6rem;
  }

  .selekcije-label {
    font-size: 1rem;
  }

  .leaderboard {
    flex: 0 0 auto;
    max-height: 45vh;
    max-height: min(320px, 45vh);
    -webkit-overflow-scrolling: touch;
  }
}


/* =============================================================================
   BREAKPOINT: 901px and up - Large screens
   ============================================================================= */
@media (min-width: 901px) {
  .statistika-btn {
    padding: 0.75rem 1.5rem;
  }
}

/* =============================================================================
   BREAKPOINT: 770px - Large mobile / small tablet
   ============================================================================= */
@media (max-width: 770px) {
  /* Age Group - trainers container layout */
  .trainers-container {
    flex-direction: column;
    align-items: stretch;
    gap: 1.5rem;
  }
  
  .section-card {
    padding: 1.5rem;
  }
}

/* =============================================================================
   BREAKPOINT: 768px - Mobile landscape / small tablets
   ============================================================================= */
@media (max-width: 768px) {
  .hero-logo-link {
    display: none;
  }

  .hero-overlay {
    justify-content: flex-start;
  }
  /* Shared section spacing */
  .osnovni-section {
    padding: 1.5rem 0 6rem;
  }

  .vpis-section {
    padding: 2rem 0 6rem;
  }

  .age-group-section {
    padding: 0.75rem 0 6rem;
  }

  .statistika-section {
    padding: 79px 0 6rem;
  }

  .oprema-section {
    padding: 1.5rem 0 6rem;
  }

  :is(
      .age-group-container,
      .osnovni-container,
      .vpis-container,
      .oprema-container,
      .statistika-container,
      .novice-container
    ) {
    padding: 0 1rem;
  }

  /* Container padding adjustments */
  .kontakt-section,
  .about-section {
    padding: 1.5rem;
  }

  .stats-card {
    padding: 1.5rem;
  }

  /* Vpis specific */
  .vpis-main {
    grid-template-columns: 1fr;
  }

  .vpis-contact {
    position: static;
    top: auto;
  }

  .vpis-content {
    padding: 1.5rem;
  }

  .vpis-impressum,
  .klub-podatki-section {
    padding: 1.5rem;
  }

  .vpis-button {
    width: 100%;
  }

  .vpis-title {
    font-size: 2rem;
  }

  .vpis-subtitle {
    font-size: 1rem;
  }

  .osnovni-title,
  .statistika-title,
  .novice-title,
  .age-group-title,
  .oprema-title {
    font-size: 2rem;
    line-height: 1.2;
  }

  .osnovni-subtitle,
  .vpis-subtitle,
  .age-group-subtitle {
    font-size: 1rem;
  }


  /* Statistics grid */
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .legend {
    gap: 0.75rem;
  }

  .stats-info-card {
    padding: 1.5rem;
  }

  /* Osnovni podatki layout */
  .kontakt-simplified {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .trener-info {
    padding: 1.5rem;
  }

  .trener-name {
    font-size: 1.5rem;
  }

  .polja-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .polje-image {
    height: 250px;
  }

  /* Timetable mobile layout */
  .timetable-wrapper {
    overflow-x: hidden;
  }

  .timetable thead {
    display: none;
  }

  .timetable,
  .timetable tbody,
  .timetable tr {
    display: block;
    width: 100%;
  }

  .timetable td {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
  }

  .timetable td::before {
    content: attr(data-label);
    font-weight: 600;
    color: #111827;
    margin-right: 1rem;
    flex-shrink: 0;
  }

  .timetable tr {
    margin-bottom: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    border-left: 4px solid #aa912b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
  }

  .timetable tr:hover {
    background: #f9fafb;
  }

  .timetable td:last-child {
    border-bottom: none;
  }

  /* Additional Age Group mobile timetable rules */
  .timetable tr {
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    margin-bottom: 0.75rem;
    background: #ffffff;
    overflow: hidden;
  }

  /* Hide empty days on mobile */
  .timetable tr.empty-day {
    display: none;
  }

  /* When all days are empty on mobile, hide table and show message */
  .timetable-all-empty .timetable {
    display: none;
  }

  .timetable-all-empty .timetable-empty-message {
    display: block;
    text-align: center;
    padding: 2rem 1rem;
  }

  .timetable td {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    width: auto !important;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }

  .timetable td .cell-value {
    flex: 1;
    min-width: 0;
    text-align: center;
  }

  .timetable td .cell-value.is-empty {
    text-align: center;
  }

  .timetable td::before {
    flex: 0 0 auto;
    width: 5.5rem;
    font-weight: 700;
    color: #111827;
  }

  /* Day is the card header (no "Dan:" label) */
  .timetable td.col-day {
    justify-content: center;
    gap: 0;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 700;
  }

  .timetable td.col-day::before {
    content: none;
    display: none;
  }

  .timetable td.col-time::before {
    content: "URA";
  }

  .timetable td.col-garderoba::before {
    content: "GARDEROBA";
  }

  .timetable td.col-notes::before {
    content: "IGRIŠČE";
  }

  /* Igrišče link on mobile - matches cell-value styling */
  .timetable td .igrisce-link {
    flex: 1;
    min-width: 0;
    text-align: center;
  }

  /* News detail */
  .news-detail-container {
    padding: 1rem;
  }

  .news-detail-title {
    font-size: 28px;
  }

  .news-detail-content {
    font-size: 16px;
  }

  /* Home page layout tweaks */
  .page-content > .hero {
    margin-top: -79px;
  }

  .page-content:not(:has(.news-detail-section)) {
    padding-top: 79px;
  }

  .page-content > section:not(.hero):not(.news-detail-section):not(.age-group-section) {
    padding-top: 1.5rem !important;
  }

  .page-content > section.hero {
    padding-top: 0 !important;
  }

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

  .news-section-title {
    font-size: 1.5rem;
  }

  .partners-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    padding: 0 1rem;
    gap: 1rem;
  }

  .partners-grid::after {
    content: none;
  }

  a.partner-item {
    grid-column: auto !important;
    padding: 0.75rem;
  }

  .partner-item img {
    max-height: 90px;
  }

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

  .pagination-numbers {
    gap: 0.25rem;
  }

  .pagination-number,
  .pagination-btn {
    width: 36px;
    height: 36px;
  }

  /* Join section */
  .join-content {
    flex-direction: column;
    text-align: center;
  }
  
  .join-icon {
    width: 120px;
    height: 120px;
  }
  
  .join-icon img {
    width: 60px;
    height: 60px;
  }
  
  .join-title {
    font-size: 1.5rem;
  }
  
  .join-description {
    font-size: 1rem;
  }
  
  .join-features {
    justify-content: center;
  }
}

/* =============================================================================
   BREAKPOINT: 640px - Mobile
   ============================================================================= */
@media (max-width: 640px) {
  .error-container {
    padding: 2rem 1.5rem;
  }

  .error-code {
    font-size: 3.25rem;
  }

  .error-title {
    font-size: 1.4rem;
  }

  .error-text {
    font-size: 0.95rem;
  }
  .age-group-section {
    padding: 1rem 0 6rem;
  }

  .oprema-section {
    padding: 1.5rem 0 6rem;
  }

  /* Oprema header */
  .oprema-header .oprema-title {
    font-size: 2rem;
  }

  .oprema-header .oprema-subtitle {
    font-size: 0.95rem;
  }

  .about-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  /* Age Group */

  .trainer-image-wrapper {
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 1rem;
  }

  .trainer-title {
    margin-bottom: 1rem;
  }

  .age-group-content {
    gap: 1.5rem;
  }

  .sidebar {
    flex-direction: column;
  }

  .timetable .day-label {
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .section-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

  /* News grid */
  .news-section .news-grid {
    grid-template-columns: 1fr;
  }

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

  .featured-news {
    padding: 1rem;
  }

  .featured-title {
    font-size: 1.3rem;
  }

  .featured-description {
    font-size: 0.9rem;
  }

  .novice-title {
    font-size: 2rem;
  }

  .novice-subtitle {
    font-size: 0.95rem;
  }

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

  .pagination-btn,
  .pagination-number {
    width: 38px;
    height: 38px;
  }

  /* Vpis headings */
  .vpis-content h2,
  .vpis-contact h3,
  .vpis-impressum h2,
  .klub-podatki-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  /* Osnovni podatki headings */
  .kontakt-section h2,
  .about-section h2,
  .trener-section h2,
  .trener-section-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  /* Statistika headings */
  .stats-card-title {
    font-size: 1.25rem;
  }

  .stats-info-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }
}

/* =============================================================================
   BREAKPOINT: 480px - Small mobile
   ============================================================================= */
@media (max-width: 480px) {
  .error-container {
    padding: 1.5rem 1.25rem;
  }

  .error-code {
    font-size: 2.75rem;
  }

  .error-title {
    font-size: 1.25rem;
  }
  .osnovni-section,
  .vpis-section {
    padding: 1rem 0 6rem;
  }

  .statistika-section {
    padding: 79px 0 6rem;
  }

  .oprema-section {
    padding: 1rem 0 6rem;
  }

  :is(
      .age-group-container,
      .osnovni-container,
      .vpis-container,
      .oprema-container,
      .statistika-container,
      .novice-container
    ) {
    padding: 0 0.75rem;
  }

  /* Container padding */
  .kontakt-section,
  .about-section {
    padding: 1rem;
  }

  .kontakt-item {
    padding: 1rem;
  }

  .stats-card {
    padding: 1rem;
  }

  .section-card {
    padding: 1rem;
  }

  .vpis-content,
  .vpis-contact,
  .vpis-impressum,
  .klub-podatki-section {
    padding: 1rem;
  }

  /* Trainers */
  .trener-section {
    padding: 1.5rem 1rem;
  }

  .trener-info {
    padding: 1rem;
  }

  /* Fields */
  .polje-card {
    border-radius: 0.5rem;
  }

  .polje-image {
    height: 180px;
  }

  .polje-info {
    padding: 1rem;
  }

  /* Stats */
  .stats-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-item {
    padding: 0.75rem 0.25rem;
  }

  .stat-value {
    font-size: 1.125rem;
  }

  .legend {
    flex-direction: column;
    gap: 0.5rem;
  }

  /* Stats info card */
  .stats-info-card {
    padding: 1rem;
  }

  .stats-info-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }


  /* Typography adjustments */
  .section-title {
    font-size: 1.125rem;
  }

  /* Buttons */
  .vpis-button,
  .statistika-btn,
  .oprema-button {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  /* Home hero tweaks */
  .hero-cards-container {
    padding: 0 0.75rem;
  }
}

/* =============================================================================
   BREAKPOINT: 360px - Extra small mobile
   ============================================================================= */
@media (max-width: 360px) {
  /* Extra tight padding for very small screens */
  .osnovni-section,
  .vpis-section,
  .oprema-section {
    padding: 0.75rem 0.5rem 6rem 0.5rem;
  }

  .age-group-section,
  .statistika-section {
    padding: 0.5rem 0.5rem 6rem 0.5rem;
  }

  /* Smaller container padding */
  .kontakt-section,
  .about-section,
  .stats-card,
  .section-card,
  .vpis-content,
  .vpis-contact,
  .vpis-impressum,
  .klub-podatki-section {
    padding: 0.75rem;
  }

  /* Typography */
  .osnovni-title,
  .vpis-title,
  .statistika-title,
  .oprema-title,
  .age-group-title {
    font-size: 1.75rem;
  }

  .section-title {
    font-size: 1rem;
  }

  .stats-info-title {
    font-size: 1.125rem;
  }
}
