/* Basic styling for Kato Quiz UI */
h1 {font-size: 32px !important;}
.kq-container {
    font-family: 'Roboto Condensed', sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px 48px;
}
.kq-card {
    /* Glass card to match React app */
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.35);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}
.kq-flex {
    gap: 12px;
    flex-wrap: wrap;
}
.kq-field {
    flex: 1 1 220px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 20px;
    /* Important for flexbox: allow this field (which contains the belt carousel)
       to shrink inside the row without forcing horizontal overflow */
    min-width: 0;
}
.kq-label {
    font-weight: 600;
    font-size: 14px;
}
.kq-input, .kq-select {
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.kq-input:focus, .kq-select:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.15);
}
.kq-button {
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.kq-button:hover {
    box-shadow: 0 8px 18px rgba(239,68,68,0.25);
    transform: translateY(-1px);
}
.kq-button:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
    box-shadow: none;
}
.kq-quiz {
    margin-top: 12px;
}
.kq-question {
    margin-bottom: 18px;
    padding: 14px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}
.kq-question h4 {
    margin: 0 0 10px;
    font-size: 18px;
    color: #fff;
}
.kq-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
}
.kq-option {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.1s ease;
}
.kq-option:hover {
    border-color: #ef4444;
    box-shadow: 0 8px 16px rgba(239,68,68,0.12);
    transform: translateY(-1px);
}
.kq-option.selected {
    border-color: #ef4444;
    background: #fff5f5;
}
.kq-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 15px;
}
.kq-progress-bar {
    flex: 1;
    height: 10px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}
.kq-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f97316);
    width: 0;
    transition: width 0.25s ease;
}
.kq-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.kq-stat {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
}
.kq-leaderboard table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
.kq-leaderboard th, .kq-leaderboard td {
    color: #fff;
    padding: 10px 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}
.kq-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #fff5f5;
    color: #b91c1c;
    font-weight: 700;
    font-size: 13px;
}
.kq-muted { font-size: 14px; }
.kq-title { margin: 0 0 10px; font-size: 22px; color: #fff;}
.kq-title-black { margin: 0 0 10px; font-size: 22px; color: #2e2e2e;}
.kq-subtitle { margin: 0 0 6px; font-size: 16px;}

@media (max-width: 640px) {
    .kq-options { grid-template-columns: 1fr; }
    .kq-flex { flex-direction: column; }
}

/* Belt carousel */
.kq-belt-carousel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%; /* ensure the carousel doesn't exceed its container */
    /* Hide any horizontal overflow from the scrollable track/cards so
       they don't bleed outside the card/container on narrow layouts */
    overflow: hidden;
}
/* Swiper integration */
.kq-belt-swiper { flex: 1 1 auto; min-width: 0; width: 100%;}
.kq-belt-swiper .swiper-wrapper { align-items: stretch; padding: 30px 0;}
.kq-belt-swiper .swiper-slide { width: auto; /* allow slidesPerView:'auto' */ }
.kq-belt-swiper .swiper-pagination { position: static; margin-top: 6px; }

.kq-belt-item {
    scroll-snap-align: start;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 110px;
    border: 1px solid #d1d5db;
    background: #ffffff1a;
    border-radius: 10px;
    padding: 10px 0 12px;
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.2s ease, transform 0.1s ease;
}
.kq-belt-item:hover {
    border-color: #ef4444;
    box-shadow: 0 8px 16px rgba(239,68,68,0.12);
    transform: translateY(-1px);
}
.kq-belt-item.selected {
    /* Brighter selected style akin to Tailwind demo */
    border-color: rgba(255,255,255,0.8);
    border-width: 2px;
    background: rgba(255,255,255,0.2);
    box-shadow: 0 0 15px rgba(255,255,255,0.2);
    transform: scale(1.05);
}
.kq-belt-swatch {
    height: 25px;
    border-radius: 3px;
    position: relative;
    overflow: hidden;
    margin: auto 0;
}
.kq-belt-swatch:hover {
    transform: rotate(5deg);
    transition: transform 0.2s ease;
}
.kq-belt-swatch-inner {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 5px;
    border-radius: 0;
    transform: translateY(-50%);
}
.kq-belt-shadow {
    position: absolute;
    height: 25px;
    background-color: #0000004d;
    transform: rotate(15deg);
    border-radius: 3px;
    overflow: hidden;
    margin: -26px 0 0;
    top: 50%;
    width: 5rem;
    z-index: -1;
}
.kq-belt-name {
    font-weight: 700;
    font-size: 14px;
    text-align: center;
}

/* Style Swiper nav buttons to match the previous round buttons */
.kq-belt-carousel .swiper-button-prev,
.kq-belt-carousel .swiper-button-next {
    /* Overlay the buttons centered vertically & reveal on hover like the React markup */
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
    z-index: 20;
    opacity: 0; /* shown on hover via group */
}
.kq-belt-carousel .swiper-button-prev:after,
.kq-belt-carousel .swiper-button-next:after {
    font-size: 16px;
}
.kq-belt-carousel .swiper-button-prev:hover,
.kq-belt-carousel .swiper-button-next:hover { box-shadow: 0 8px 18px rgba(0,0,0,0.35); background: rgba(0,0,0,0.8); }
.kq-belt-carousel .swiper-button-prev:active,
.kq-belt-carousel .swiper-button-next:active { background: #f3f4f6; }

/* Button side positioning */
.kq-belt-carousel .swiper-button-prev { left: 0; }
.kq-belt-carousel .swiper-button-next { right: 0; }

/* Reveal buttons when hovering the carousel wrapper */
.kq-belt-carousel:hover .swiper-button-prev,
.kq-belt-carousel:hover .swiper-button-next { opacity: 1; }

/* Locked belt card visual (dim and block interactions) */
.kq-belt-item.locked { position: relative; opacity: 0.5; cursor: not-allowed; }
.kq-belt-item.locked * { pointer-events: none; }
.kq-belt-item .kq-locked-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    border-radius: 12px;
    z-index: 10;
    text-align: center;
}
.kq-wrapper {
    background-image: linear-gradient(to right bottom, rgb(0, 0, 0), rgba(127, 29, 29, 0.8), rgb(0, 0, 0));
    margin-top: -22px;
    padding-top: 22px;
}

/* Flashcards Styles */
.kato-flashcards-container {
    margin: 20px 0;
}

.flashcards-toolbar {
    text-align: center;
    margin-bottom: 30px;
}

.kato-print-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #ef4444;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.kato-print-button:hover {
    box-shadow: 0 8px 18px rgba(239,68,68,0.25);
    transform: translateY(-1px);
}

.kato-print-button svg {
    flex-shrink: 0;
}

/* Print page setup */
@page {
    size: landscape !important;
    margin: 0;
}

.print-cards-wrapper {
    page-break-inside: avoid;
}

/* Print media query */
@media print {
    .banner-section,
    .breadcrumb-area,
    .header-section,
    .footer-section,
    .flashcards-toolbar,
    .kq-flashcards-toolbar,
    .kato-print-button {
        display: none !important;
    }

    /* Cards page: hide any regular page copy, but keep the flashcards/print markup.
       Scoped to the print button behavior (it adds `A4 landscape` on <body>). */
    body.A4.landscape .content-content > *:not(.kato-flashcards-container) {
        display: none !important;
    }

    /* Flashcards container: remove any remaining spacing so sheets sit flush. */
    body.A4.landscape .kato-flashcards-container {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Remove theme layout padding/margins so sheets sit flush on the page. */
    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
    }

    body.A4.landscape .content-section,
    body.A4.landscape .training-section--style,
    body.A4.landscape .training-details-section {
        margin: 0 !important;
        padding: 0 !important;
    }

    body.A4.landscape .content-section .container,
    body.A4.landscape .content-section .container-fluid {
        max-width: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.A4.landscape .content-section .row,
    body.A4.landscape .content-section [class^="col-"],
    body.A4.landscape .content-section [class*=" col-"] {
        margin: 0 !important;
        padding: 0 !important;
    }

    .print-cards-wrapper {
        display: block;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .sheet {
        display: flex;
        align-items: stretch;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    body { margin: 0; }
    body.A4.landscape { width: 297mm; }
}

/* Sheet layout */
.sheet {
    margin: 0;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
    page-break-after: always;
}

/* Paper sizes */
body.A4 .sheet { width: 210mm; height: 296mm; }
body.A4.landscape .sheet { width: 297mm; height: 209mm; }

/* For screen preview */
@media screen {
    .print-cards-wrapper {
        display: none;
    }
    
    .sheet {
        background: white;
        box-shadow: 0 .5mm 2mm rgba(0,0,0,.3);
        margin: 5mm;
    }
}

/* Print card styling */
.print-card-wrapper {
    width: 25%;
    height: 50%;
    padding: 25px;
    display: flex;
    backface-visibility: hidden;
    background-size: cover;
    color: #fff;
    text-align: center;
    align-items: center;
    justify-content: center;
}

.print-card-wrapper h2 {
    color: #ffffff;
    font-size: 30px !important;
    height: 100%;
    display: flex;
    padding: 0 10px;
    align-items: center;
}

.print-card {
    background: linear-gradient(rgb(0 0 0 / 75%), rgb(0 0 0 / 75%)), url(../../../themes/kato/images/cards/background4.webp) no-repeat center center;
    z-index: 2;
    height: 100%;
    width: 100%;
    border-radius: 25px;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.print-image {
    display: flex;
    justify-content: flex-end;
    padding: 10px;
    width: 100%;
}

.print-image img {
    max-width: 80px;
    height: auto;
}

.print-card-footer {
    background-color: #000;
    width: 100%;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.print-card-footer p {
    font-size: 11px;
    line-height: 17px;
    margin-bottom: 0;
    padding: 0 10px;
    color: #fff;
}

/* Flashcards print: 8 cards per sheet (each prints as a front+back pair, side-by-side)
   Layout: 2 columns x 4 rows = 8 pairs per landscape A4 sheet */
.print-card-pair {
    width: 50%;
    height: 25%;
    padding: 10px;
    display: flex;
    box-sizing: border-box;
}

.print-card-face {
    width: 50%;
    height: 100%;
    display: flex;
    box-sizing: border-box;
}

.print-card-face-front {
    padding-right: 6px;
    border-right: 1px dashed rgba(0, 0, 0, 0.25);
}

.print-card-face-back {
    padding-left: 6px;
}

.print-card-pair h2 {
    color: #fff;
    font-size: 20px !important;
    padding: 0 6px;
}

.print-card-pair .print-image img {
    max-width: 55px;
}

.print-card-pair .print-card {
    border-radius: 16px;
}

.print-card-pair .print-card-footer {
    height: 44px;
}

.print-card-pair .print-card-footer p {
    font-size: 9px;
    line-height: 12px;
}

.print-card.kq-print-front {
    background: linear-gradient(rgb(0 0 0 / 75%), rgb(0 0 0 / 75%)), url(../../../themes/kato/images/cards/background4.webp) no-repeat center center;
}

.print-card.kq-print-back {
    background: linear-gradient(rgb(0 0 0 / 75%), rgb(0 0 0 / 75%)), url(../../../themes/kato/images/cards/background1.webp) no-repeat center center;
}
