/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
    --bg-dark: #121212;
    --bg-card: #1e1e1e;
    --bg-lighter: #2a2a2a;
    --text-main: #ffffff;
    --text-muted: #b0b0b0;
    --accent-red: #e62323;
    --accent-red-hover: #ff3333;
    --font-heading: 'Oswald', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --grid-gap: 1.5rem;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* ==========================================================================
   Reset & Basics
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    position: relative;
}

/* Global overflow prevention */
* {
    box-sizing: border-box;
}

h1, h2, h3, h4, h5, h6, p, a, span {
    overflow-wrap: break-word;
    word-wrap: break-word;
}


h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    text-transform: uppercase;
    font-weight: 600;
    line-height: 1.2;
}

a {
    color: var(--text-main);
    text-decoration: none;
    transition: var(--transition);
}

ul {
    list-style: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

img {
    max-width: 100%;
    height: auto;
}

.text-red {
    color: var(--accent-red);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background-color: var(--accent-red);
    color: white;
}

.btn-primary:hover {
    background-color: var(--accent-red-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #2f2f2f;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-secondary:hover {
    background-color: var(--accent-red);
    border-color: var(--accent-red);
}

.btn-outline {
    background-color: transparent;
    color: white;
    border: 1px solid var(--text-muted);
}

.btn-outline:hover {
    border-color: white;
}

/* ==========================================================================
   Header / Navbar
   ========================================================================== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(18, 18, 18, 0.96);
    backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1rem 0;
    transition: var(--transition);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    color: var(--accent-red);
    width: 40px;
    height: 40px;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: 1px;
}

.logo-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.main-nav ul {
    display: flex;
    gap: 1.5rem;
}

.main-nav a {
    font-family: var(--font-heading);
    font-size: 0.9rem;
    color: var(--text-main);
    text-transform: uppercase;
    position: relative;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--accent-red);
}

.main-nav a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent-red);
}

.nav-btn {
    padding: 0.7rem 1.2rem;
    font-size: 0.85rem;
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero {
    position: relative;
    min-height: 100vh;
    padding-top: 100px; /* Space for navbar */
    display: flex;
    flex-direction: column;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../assets/img/hero-bg.png');
    background-size: cover;
    background-position: center;
    z-index: -2;
}

.hero-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 50%, rgba(0,0,0,0) 100%);
    z-index: -1;
}

.hero-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-bottom: 250px;
}

.hero-tag {
    color: #4da6ff;
    font-family: var(--font-heading);
    font-weight: 500;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cross-icon {
    font-size: 1.5rem;
    font-family: Arial, sans-serif;
}

.hero-title {
    font-size: 5rem;
    letter-spacing: 2px;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.5);
}

/* ==========================================================================
   Hero Dashboard (Overlaid layout elements)
   ========================================================================== */
.hero-dashboard {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-top: -150px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    margin-bottom: 4rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    letter-spacing: 1px;
}

.slider-controls {
    display: flex;
    gap: 0.5rem;
}

.slider-btn {
    background-color: var(--bg-lighter);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.slider-btn:hover, .slider-btn.active-red {
    background-color: var(--accent-red);
}

.cards-wrapper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.small-card {
    background-color: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.small-card:hover {
    border-color: var(--accent-red);
    transform: translateY(-5px);
}

.card-icon {
    margin-bottom: 1rem;
    color: var(--text-main);
}

.red-icon {
    color: var(--accent-red);
}

.small-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.small-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Schedule Quick View */
.schedule-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    background-color: var(--bg-lighter);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.5rem 1.1rem;
    border-radius: 999px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active, .tab-btn.red-tab {
    background-color: var(--accent-red);
    border-color: var(--accent-red);
    color: #fff;
}

.schedule-grid-mini {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.grid-header {
    display: grid;
    grid-template-columns: 50px repeat(5, 1fr);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 0.5rem;
}

.grid-row {
    display: grid;
    grid-template-columns: 50px repeat(5, 1fr);
    gap: 4px;
    align-items: center;
}

.grid-row span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.cell {
    background-color: rgba(255,255,255,0.05);
    height: 30px;
    border-radius: 4px;
}

.cell.bg-lighter {
    background-color: rgba(255,255,255,0.15);
}

/* ==========================================================================
   Main Layout & Directions
   ========================================================================== */
.main-layout {
    display: grid;
    /* Як на макеті: ~40% напрямки / ~60% розклад */
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    gap: 2rem;
    padding-bottom: 5rem;
    align-items: start;
}

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

.direction-card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition);
}

.direction-card:hover {
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-5px);
}

.main-directions .card-content {
    text-align: left;
}

.card-content {
    padding: 1.25rem 1.1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-content h3 {
    font-size: 1.05rem;
    margin-bottom: 0.65rem;
    min-height: 2.5rem;
}

.card-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.1rem;
    flex-grow: 1;
    line-height: 1.45;
}

.direction-card .card-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: auto;
}

.card-actions .btn {
    padding: 0.55rem 1rem;
    font-size: 0.75rem;
    flex: 1;
    max-width: 100%;
}

.card-image {
    height: 150px;
    background-color: var(--bg-lighter);
    /* For real photos, use background-image here */
}

/* ==========================================================================
   Full Schedule Section
   ========================================================================== */
.schedule-container {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.75rem 1.5rem;
    border: 1px solid var(--accent-red);
    box-shadow: 0 0 0 1px rgba(230, 35, 35, 0.15);
}

.main-directions .section-header h2 {
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    letter-spacing: 0.5px;
    line-height: 1.2;
    max-width: 90%;
}

.full-schedule .section-header {
    margin-bottom: 1.1rem;
}

.full-schedule .section-header h2 {
    font-size: clamp(1.35rem, 2.5vw, 1.75rem);
    letter-spacing: 2px;
}

.schedule-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.dropdowns {
    display: flex;
    gap: 0.5rem;
}

.schedule-select {
    background-color: var(--bg-dark);
    color: var(--text-main);
    border: 1px solid var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
}

.schedule-grid-full {
    overflow-x: auto;
    padding-bottom: 2rem;
}

.schedule-grid-full table {
    width: 100%;
    border-collapse: collapse;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (min-width: 769px) {
    .schedule-grid-full {
        overflow-x: visible;
    }

    .schedule-grid-full table {
        table-layout: fixed;
    }
}

.schedule-grid-full th {
    font-size: 0.82rem;
    color: var(--accent-red);
    font-weight: 600;
    padding: 0.85rem 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background-color: rgba(0, 0, 0, 0.25);
}

.schedule-grid-full td {
    height: 72px;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    vertical-align: middle;
    text-align: center;
    padding: 4px;
    background-color: rgba(0, 0, 0, 0.15);
}

.schedule-grid-full td.time {
    background-color: rgba(230, 35, 35, 0.07);
    color: var(--text-main);
    font-weight: 700;
    font-size: 0.92rem;
    width: 4.25rem;
    min-width: 4.25rem;
    border-right: 2px solid var(--accent-red);
}

.class-block {
    width: 100%;
    height: 100%;
    min-height: 2.75rem;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.25rem;
    cursor: pointer;
    color: #fff;
    text-align: center;
    line-height: 1.25;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.class-block:hover {
    transform: scale(1.02);
    z-index: 10;
    position: relative;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
    filter: brightness(1.2);
}

.class-block small {
    font-size: 0.65rem;
    font-weight: 400;
    opacity: 0.8;
}

.schedule-grid-full .class-block.hidden-animation {
    display: none !important;
}

/* Colors for table cells */
.bg-blue { background-color: #2b5f8c; }
.bg-purple { background-color: #5c418c; }
.bg-red { background-color: #9c2e2e; }
.bg-green { background-color: #317454; }
.bg-dark { background-color: #4a4a4a; }

/* ==========================================================================
   Trainers Section
   ========================================================================== */
.trainers-section {
    padding: 2rem 2rem 5rem;
}

.trainers-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.trainer-card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255,255,255,0.05);
    overflow: hidden;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.trainer-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-red);
    box-shadow: 0 10px 30px rgba(230, 35, 35, 0.15);
}

.trainer-image {
    height: 350px;
    background-color: var(--bg-lighter);
    background-size: cover;
    background-position: center top;
}

.trainer-info {
    padding: 1.5rem;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.trainer-info h3 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.trainer-specialty {
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

.trainer-info p {
    font-size: 0.95rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    background-color: #000;
    padding: 4rem 0 2rem;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 3rem;
}

.footer-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 1rem;
}

.footer h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.footer ul li {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.footer-call-btn {
    display: block;
    width: 100%;
    max-width: 280px;
    margin-top: 1.25rem;
    padding: 0.9rem 1.25rem;
    text-align: center;
    box-sizing: border-box;
}

.scroll-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    background-color: var(--accent-red);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    box-shadow: 0 4px 10px rgba(230, 35, 35, 0.4);
    transition: var(--transition);
}

.scroll-top:hover {
    transform: translateY(-5px);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1200px) {
    .main-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .hero-dashboard {
        grid-template-columns: 1fr;
        margin-top: -50px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .trainers-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .main-nav, .nav-btn {
        display: none;
    }

    .hero-title {
        font-size: 2rem;
        text-align: center;
    }

    .container {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto;
        box-sizing: border-box;
    }

    .hero {
        max-width: 100%;
        overflow-x: hidden;
    }

    .hero-content {
        align-items: center;
        text-align: center;
    }

    .hero-content .btn-primary {
        align-self: center !important;
    }

    /* Одна колонка, без виходу за екран */
    .main-layout,
    .directions-grid,
    .cards-wrapper,
    .trainers-grid,
    .hero-dashboard,
    .footer-content {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        width: 100% !important;
        max-width: 100% !important;
        gap: 1.5rem !important;
    }

    .direction-card,
    .small-card,
    .trainer-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 auto 1rem auto !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center;
    }

    .hero-dashboard {
        margin-top: 0;
        padding: 1rem;
        box-shadow: none;
    }

    .full-schedule {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        min-width: 0;
    }

    .schedule-container {
        padding: 1rem 0.65rem;
        width: 100% !important;
        max-width: 100% !important;
        overflow: hidden;
        box-sizing: border-box;
    }

    .full-schedule .section-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .full-schedule .section-header h2 {
        font-size: 1.15rem;
        letter-spacing: 1px;
    }

    .schedule-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
        margin-bottom: 0.85rem;
    }

    .schedule-tabs {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .dropdowns {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.45rem;
        width: 100%;
    }

    .schedule-select {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
        font-size: 0.78rem;
        padding: 0.45rem 0.55rem;
    }

    /* Розклад: той самий вигляд, зменшений; без горизонтального скролу */
    .schedule-grid-full {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden !important;
        padding-bottom: 1rem;
        min-width: 0;
    }

    .schedule-grid-full table {
        display: table !important;
        table-layout: fixed !important;
        width: 100% !important;
        min-width: 0;
        border: 1px solid var(--accent-red);
    }

    .schedule-grid-full th {
        font-size: 0.56rem !important;
        letter-spacing: 0.04em;
        padding: 5px 1px !important;
        line-height: 1.15;
    }

    .schedule-grid-full th.col-time {
        width: 13.5% !important;
    }

    .schedule-grid-full th,
    .schedule-grid-full td {
        min-width: 0 !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .schedule-grid-full td {
        padding: 2px 1px !important;
        font-size: 0.55rem !important;
        height: auto;
        min-height: 46px;
        vertical-align: middle;
    }

    .schedule-grid-full td.time {
        width: 13.5% !important;
        min-width: 0 !important;
        max-width: none;
        font-size: 0.54rem !important;
        padding: 3px 1px !important;
        line-height: 1.15;
    }

    .schedule-grid-full .class-block {
        padding: 2px 1px !important;
        font-size: 0.54rem !important;
        min-height: 2.35rem;
        line-height: 1.12;
    }

    .schedule-grid-full .class-block small {
        display: block !important;
        font-size: 0.45rem !important;
        margin-top: 1px;
        opacity: 0.92;
    }

    .schedule-grid-full ::after {
        display: none !important;
    }

    .hidden-animation {
        display: none !important;
    }

    .card-image,
    .trainer-image {
        width: 100%;
        max-width: 100%;
        height: 220px;
    }

    .footer-content > div {
        width: 100%;
        max-width: 100%;
        margin-bottom: 2rem;
    }
}

/* Utility Classes */
.d-none { display: none !important; }
@media (min-width: 768px) {
    .d-md-inline { display: inline !important; }
    .d-md-block { display: block !important; }
}
@media (max-width: 767px) {
    .d-md-none { display: inline !important; }
}

/* Великий екран: уточнення під макет (пропорції вже 2fr / 3fr у .main-layout) */
@media (min-width: 1201px) {
    .main-layout {
        gap: 2.25rem;
    }

    .directions-grid {
        gap: 1.1rem;
    }

    .direction-card .card-content {
        padding: 1.2rem 1rem;
    }

    .direction-card .card-icon svg {
        width: 28px;
        height: 28px;
    }

    .direction-card .card-content h3 {
        font-size: 1rem;
        min-height: 2.4rem;
    }

    .direction-card .card-content p {
        font-size: 0.78rem;
    }

    .schedule-container {
        padding: 1.85rem 1.65rem;
    }

    .schedule-grid-full td {
        height: 68px;
    }

    .schedule-grid-full .class-block {
        font-size: 0.8rem;
    }

    .schedule-grid-full .class-block small {
        font-size: 0.62rem;
    }
}

