/**
 * CSB - Circolo Scacchistico Bolognese
 * Custom CSS for the chess club website
 *
 * Color Palette:
 * - Primary Yellow: #f5da5a
 * - Light Yellow (hover): #f7e279
 * - Dark Yellow: #e6c84a
 * - Black: #000
 */

/* ==========================================
   CSS VARIABLES
   ========================================== */
:root {
    --csb-yellow: #f5da5a;
    --csb-yellow-light: #f7e279;
    --csb-yellow-dark: #e6c84a;
    --csb-black: #000;
}

/* ==========================================
   UTILITY CLASSES - COLORS
   ========================================== */
.bg-csb-yellow {
    background-color: var(--csb-yellow) !important;
}

.bg-csb-black {
    background-color: var(--csb-black) !important;
}

.text-csb-yellow {
    color: var(--csb-yellow) !important;
}

.text-csb-black {
    color: var(--csb-black) !important;
}

/* ==========================================
   BUTTONS - CSB STYLE
   ========================================== */
.btn-csb-yellow {
    background-color: var(--csb-yellow);
    border-color: var(--csb-yellow);
    color: var(--csb-black);
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-csb-yellow:hover,
.btn-csb-yellow:focus {
    background-color: var(--csb-yellow-light);
    border-color: var(--csb-black);
    color: var(--csb-black);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(245, 218, 90, 0.4);
}

.btn-csb-black {
    background-color: var(--csb-black);
    border-color: var(--csb-black);
    color: var(--csb-yellow);
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-csb-black:hover,
.btn-csb-black:focus {
    background-color: var(--csb-black);
    border-color: var(--csb-black);
    color: var(--csb-yellow);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* ==========================================
   STAFF ADMIN BUTTONS
   ========================================== */
.btn-staff-yellow {
    background-color: var(--csb-yellow);
    color: var(--csb-black);
    border: none;
    transition: all 0.3s ease;
}

.btn-staff-yellow:hover {
    background-color: var(--csb-black);
    color: var(--csb-yellow);
}

.btn-staff-black {
    background-color: var(--csb-black);
    color: var(--csb-yellow);
    border: none;
    transition: all 0.3s ease;
}

.btn-staff-black:hover {
    background-color: var(--csb-yellow);
    color: var(--csb-black);
}

.btn-staff-danger {
    background-color: #dc3545;
    color: #fff;
    border: 2px solid #dc3545;
    transition: all 0.3s ease;
}

.btn-staff-danger:hover {
    background-color: #bb2d3b;
    color: #fff;
    border-color: #bb2d3b;
}

/* ==========================================
   FILTER BUTTONS (Tournament & Pages)
   ========================================== */
.btn-outline-primary,
.btn-outline-secondary {
    border-color: var(--csb-black) !important;
    color: var(--csb-black) !important;
}

.btn-outline-primary:hover,
.btn-outline-secondary:hover {
    background-color: var(--csb-yellow-light) !important;
    border-color: var(--csb-yellow-light) !important;
    color: var(--csb-black) !important;
}

/* Button checked state for filters */
.btn-check:checked+.btn-outline-primary,
.btn-check:checked+.btn-outline-secondary {
    background-color: var(--csb-yellow-light) !important;
    border-color: var(--csb-yellow-light) !important;
    color: var(--csb-black) !important;
}

/* View Toggle Button Styles */
.btn-group .btn-outline-dark.active {
    background-color: var(--csb-yellow);
    border-color: var(--csb-yellow);
    color: var(--csb-black);
}

.btn-group .btn-outline-dark:hover {
    background-color: var(--csb-yellow-light);
    border-color: var(--csb-yellow-light);
    color: var(--csb-black);
}

/* ==========================================
   CARDS - HOVER EFFECTS
   ========================================== */
.hover-lift {
    transition: all 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
}

/* ==========================================
   ICONS
   ========================================== */
.icon-md {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

/* ==========================================
   PAGE HEADERS - HERO SECTIONS
   ========================================== */
.page-hero-overlay {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.7) 0%, rgba(30, 30, 30, 0.8) 100%);
}

.page-hero-section {
    background-size: cover;
    background-position: center;
}

.page-hero-content {
    z-index: 10;
}

/* ==========================================
   FILTER SIDEBAR
   ========================================== */
.filter-card-header {
    background: linear-gradient(135deg, var(--csb-yellow) 0%, var(--csb-yellow-dark) 100%);
}

.filter-sidebar-sticky {
    position: sticky;
    top: 100px;
    z-index: 1;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

/* ==========================================
   COLLAPSE ANIMATIONS
   ========================================== */
a[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform 0.3s ease;
}

a[data-bs-toggle="collapse"][aria-expanded="false"] .bi-chevron-down {
    transform: rotate(-90deg);
}

/* ==========================================
   BADGES - CSB STYLE
   ========================================== */
.badge-csb-yellow {
    background-color: var(--csb-yellow);
    color: var(--csb-black);
}

.badge-csb-black {
    background-color: var(--csb-black);
    color: var(--csb-yellow);
}

/* ==========================================
   GRADIENTS
   ========================================== */
.bg-gradient-light {
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
}

/* ==========================================
   NAVBAR - CSB CUSTOM
   ========================================== */
.navbar-top.bg-csb-yellow {
    margin: 0;
    padding-left: 0;
    padding-right: 0;
    border: none;
    border-radius: 0;
}

.nav-link.social-icon {
    transition: all 0.3s ease;
}

.nav-link.social-icon:hover {
    transform: scale(1.2);
    opacity: 0.8;
}

/* Navbar menu links hover */
.navbar-nav .nav-link {
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus {
    background-color: rgba(0, 0, 0, 0.08);
    border-radius: 6px;
    color: var(--csb-black) !important;
}

.navbar-nav .dropdown-item:hover,
.navbar-nav .dropdown-item:focus {
    background-color: rgba(0, 0, 0, 0.08);
    color: var(--csb-black);
}

/* ==========================================
   RESULTS COUNTER CIRCLE
   ========================================== */
.results-counter-circle {
    width: 50px;
    height: 50px;
    background-color: var(--csb-yellow);
    color: var(--csb-black);
}

/* ==========================================
   TOURNAMENT LIST STYLES
   ========================================== */
.tournament-date-icon {
    color: var(--csb-yellow);
}

.btn-csb-yellow.btn-lg,
.btn-csb-black.btn-lg {
    min-width: 200px;
}

.tournament-card-btn {
    z-index: 2;
}

/* ==========================================
   ASSOCIATES LIST STYLES
   ========================================== */
.associates-icon-yellow {
    color: var(--csb-yellow);
}

/* ==========================================
   FILTER BADGES AND ICONS
   ========================================== */
.filter-badge-active {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
}

.filter-icon-sm {
    width: 35px;
    height: 35px;
}

.filter-icon-md {
    width: 40px;
    height: 40px;
}

/* ==========================================
   RESPONSIVE UTILITIES
   ========================================== */
@media (max-width: 1199.98px) {
    .filter-sidebar-sticky {
        position: relative;
        top: 0;
        max-height: none;
        overflow-y: visible;
    }
}

/* Mobile: Center buttons and text */
@media (max-width: 767.98px) {

    /* Hero section */
    .hero-title,
    .hero-subtitle {
        text-align: center !important;
    }

    .hero-cta {
        justify-content: center !important;
    }

    /* Section headers - "Tutte le Notizie", "Tutti i Tornei" buttons */
    .col-lg-4.text-lg-end,
    .col-lg-3.text-lg-end,
    .col-md-3.text-md-end {
        text-align: center !important;
        justify-content: center !important;
    }

    /* Daily puzzle banner */
    #homePuzzleBoard {
        margin: 0 auto 1rem auto !important;
    }

    /* General button containers in home */
    main .d-flex.gap-2,
    main .d-flex.gap-3 {
        justify-content: center;
    }

    /* Section titles */
    main .row.mb-5 .col-lg-8,
    main .row.mb-5 .col-lg-4 {
        text-align: center;
    }

    /* Puzzle section text */
    .col-lg-5.col-md-4 {
        text-align: center;
    }

    .col-lg-5.col-md-4 .d-flex.align-items-center.gap-3 {
        justify-content: center;
    }
}

/* ==========================================
   HERO CALENDAR
   ========================================== */
.hero-calendar {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    padding: 20px;
    max-width: 400px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.hero-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.hero-calendar-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--csb-black);
}

.hero-calendar-nav {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: var(--csb-black);
}

.hero-calendar-nav:hover {
    background: var(--csb-yellow);
    transform: scale(1.1);
}

.hero-calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.hero-calendar-weekday {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    padding: 8px 0;
    text-transform: uppercase;
}

.hero-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.hero-calendar-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: #fafafa;
}

.hero-calendar-day:hover:not(.hero-calendar-day-empty) {
    background: #f0f0f0;
    transform: scale(1.05);
}

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

.hero-calendar-day-number {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--csb-black);
}

.hero-calendar-day-past .hero-calendar-day-number {
    color: #ccc;
}

.hero-calendar-day-today {
    background: var(--csb-yellow) !important;
    box-shadow: 0 4px 12px rgba(245, 218, 90, 0.4);
}

.hero-calendar-day-today .hero-calendar-day-number {
    font-weight: 700;
}

.hero-calendar-day-selected {
    background: var(--csb-black) !important;
}

.hero-calendar-day-selected .hero-calendar-day-number {
    color: #fff;
}

.hero-calendar-day-has-events {
    font-weight: 600;
}

.hero-calendar-day-dots {
    display: flex;
    gap: 3px;
    position: absolute;
    bottom: 4px;
}

.hero-calendar-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.hero-calendar-dot-tournament {
    background: var(--csb-yellow);
    border: 1px solid var(--csb-yellow-dark);
}

.hero-calendar-dot-event {
    background: #4CAF50;
}

/* Tooltip */
.hero-calendar-tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--csb-black);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 120px;
    max-width: 200px;
}

.hero-calendar-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--csb-black);
}

.hero-calendar-day:hover .hero-calendar-tooltip {
    opacity: 1;
    visibility: visible;
}

.hero-calendar-tooltip-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-calendar-tooltip-item:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.hero-calendar-tooltip-tournament i {
    color: var(--csb-yellow);
}

.hero-calendar-tooltip-event i {
    color: #4CAF50;
}

/* Hide tooltip on mobile (touch devices) */
@media (max-width: 991.98px) {
    .hero-calendar-tooltip {
        display: none;
    }
}

/* Legend */
.hero-calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.hero-calendar-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #666;
}

/* Events Panel */
.hero-calendar-events-panel {
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.hero-calendar-events-panel.active {
    max-height: 300px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.hero-calendar-events-header {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 12px;
}

.hero-calendar-events-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hero-calendar-event-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.hero-calendar-event-tournament {
    background: rgba(245, 218, 90, 0.15);
}

.hero-calendar-event-tournament:hover {
    background: rgba(245, 218, 90, 0.3);
}

.hero-calendar-event-event {
    background: rgba(76, 175, 80, 0.1);
}

.hero-calendar-event-event:hover {
    background: rgba(76, 175, 80, 0.2);
}

.hero-calendar-event-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hero-calendar-event-tournament .hero-calendar-event-icon {
    background: var(--csb-yellow);
    color: var(--csb-black);
}

.hero-calendar-event-event .hero-calendar-event-icon {
    background: #4CAF50;
    color: #fff;
}

.hero-calendar-event-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.hero-calendar-event-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
    color: #888;
}

.hero-calendar-event-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--csb-black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-calendar-event-location {
    font-size: 0.75rem;
    color: #888;
}

.hero-calendar-event-location i {
    font-size: 0.7rem;
}

.hero-calendar-event-arrow {
    color: #ccc;
    font-size: 1rem;
}

/* Mobile calendar adjustments */
@media (max-width: 767.98px) {
    .hero-calendar {
        max-width: 100%;
        padding: 15px;
        border-radius: 12px;
    }

    .hero-calendar-day {
        border-radius: 8px;
    }

    .hero-calendar-day-number {
        font-size: 0.8rem;
    }

    .hero-calendar-title {
        font-size: 1.1rem;
    }

    .hero-calendar-weekday {
        font-size: 0.65rem;
    }
}

/* Desktop: hide mobile calendar, show desktop */
.hero-calendar-mobile {
    display: none;
}

@media (max-width: 991.98px) {
    .hero-calendar-desktop {
        display: none;
    }

    .hero-calendar-mobile {
        display: block;
    }
}