@import url('navbar.css');

@import url("https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css");
@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css");

* {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    font-family: 'Karantina', sans-serif;
}

:root {
    --primary-color: #962a87;
    --secondary-color: #ffd7f2;
    --light-gradient: linear-gradient(45deg, rgba(255, 255, 255, 1) 0%, rgba(232, 232, 232, 1) 24%, rgba(235, 232, 232, 1) 52%, rgba(255, 255, 255, 1) 84%, rgba(237, 237, 237, 1) 100%);
    --light-color: #f7f7f7;
    --text-color: #c0c0c0;
    --text-secondary-color: #ffd7f2;
    --text-color-light: #f7f7f7;

    font-family: "Outfit", sans-serif;
    scroll-behavior: smooth;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--primary-color) 0%, rgba(150, 42, 135, 0.4) 100%);
    border-radius: 20px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #b83ca6 0%, var(--primary-color) 100%);
    border: 2px solid transparent;
    background-clip: padding-box;
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) rgba(0, 0, 0, 0.3);
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    background-color: #111;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background: #111 url(/img/PPP-website.png) no-repeat center/cover;
    z-index: -1;
}

.container {
    position: relative;
    margin-top: 70px;
    width: 1120px;
    min-height: calc(100dvh - 120px);
    padding-bottom: 30px;

    display: flex;
    flex-direction: column;
    /* Řádky se budou řadit pod sebe */
    align-items: center;
    justify-content: flex-start;
    /* Začínáme odshora */
    box-sizing: border-box;
}

a {
    all: unset;
    color: var(--text-color);
    cursor: pointer;
}

p {
    color: var(--text-color);
    line-height: 21px;
    letter-spacing: 1px;
    text-align: justify;
}

h1 {
    margin: 0;
    font-size: 32px;
    color: var(--text-secondary-color);
    margin-bottom: 30px;
}

h2 {
    margin: 20px 10px;
    color: var(--primary-color);
}

h3 {
    color: var(--text-secondary-color);
}

li {
    font-size: 18px;
    color: var(--text-color);
}

button {
    all: unset;
}

button.btn {
    position: relative;
    padding: 10px 20px;

    color: white;
    font-weight: bold;
    text-transform: uppercase;
    border-radius: 8px;
    overflow: hidden;
    z-index: 1;
    cursor: pointer;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Button */
button.btn::before {
    content: '';
    position: absolute;
    width: calc(var(--width, 100px) + 60px);
    height: calc(var(--width, 100px) + 60px);
    top: 50%;
    left: 50%;

    background: linear-gradient(to right, var(--primary-color) 50%, var(--secondary-color) 50%);
    transform: translate(-50%, -50%) rotate(45deg);
    will-change: transform;
    z-index: -2;
    transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
}

/* Černá maska */
button.btn::after {
    content: '';
    position: absolute;
    inset: 3px;
    background: #111;
    border-radius: 5px;
    z-index: -1;
}

button.btn:hover::before {
    transform: translate(-50%, -50%) rotate(225deg);
}

button.btn .bi {
    font-size: 22px;
}

hr {
    padding-top: 0;
    border: none;
    height: 2px;
    width: 100px;
    background-color: var(--secondary-color);
}


.row {
    display: flex;
    flex-wrap: nowrap;
    gap: 15px;
    width: 100%;
    /* OPRAVA: Místo height: 100% řekneme flexboxu, ať vyplní veškeré zbývající místo */
    flex: 1;
    padding: 10px 0;
}

.col-50 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-width: 0;
    padding: 2rem;
    /* Zaručí, že oba sloupce budou mít vždy stejnou výšku podle toho vyššího */
    align-self: stretch;
}

.box {
    position: relative;
    padding: 30px;
    backdrop-filter: blur(12px);
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    height: auto;
    width: 100%;
    flex: 1;
}

.box.box-fixed {
    /* 1. Vypnutí flex roztažení směrem dolů */
    flex: none;
    flex-shrink: 0;
    /* Nedovolí prohlížeči box jakkoliv smrštit */

    /* 2. Nastavení tvých pevných rozměrů */
    width: 400px;
    height: 500px;

    /* 3. Vynucení přesných rozměrů v box-sizingu */
    box-sizing: border-box;
}

.box-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    padding: 30px;
    box-sizing: border-box;

    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
    opacity: 1;
    z-index: 2;

    transition: clip-path 1s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.5s ease-in-out;
}

.box-content.hidden {
    clip-path: polygon(0% 0%, 100% 0%, 100% 0%, 0% 15%);
    pointer-events: none;

    opacity: 0;
    z-index: 1;

    transition: clip-path 1s cubic-bezier(0.25, 1, 0.5, 1),
        opacity 0.3s ease-in-out,
        z-index 0s linear 1s;
}

.box span.team {
    width: 80%;
    max-width: 80%;
    text-align: center;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

form {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    width: 90%;

}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    transition: background-color 5000s ease-in-out 0s;
    -webkit-text-fill-color: var(--text-color, #374151) !important;
}

input {
    width: 100%;
    position: relative;
    padding: 10px 12px;
    margin-bottom: 20px;
    border: none;
    background-color: rgba(0, 0, 0, 0.2);
    font-size: 16px;
    color: var(--text-color);
    border-bottom: 2px solid var(--primary-color);
    border-radius: 0;
    transition: all 0.25s ease;
}

input:focus {
    outline: none;
    border-radius: 0;
    border-color: var(--secondary-color);
}

.input-group {
    width: 100%;
    display: inline-flex;
    align-items: center;
    font-size: 16px;
    position: relative;

    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 3px solid var(--primary-color);

    margin-bottom: 20px;
}

.input-group label {
    font-weight: bold;
    padding: 10px 6px 10px 12px;
    text-wrap: nowrap;
    color: var(--text-color);
}

.input-group input {
    background: none;
    border: none;
    border-radius: 0;
    height: 100%;
    flex: 1;

    padding: 10px 12px 10px 6px;
    font-size: 16px;
    color: var(--text-color);
}

.input-group input:focus {
    outline: none;
    border-radius: 0;
    border-color: var(--secondary-color);
}

.color-input-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 44px;
    margin-bottom: 20px;

    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 2px solid var(--primary-color);
    padding: 0 12px;
    box-sizing: border-box;
    transition: all 0.25s ease;
    cursor: pointer;
}

.color-input-group label {
    font-size: 16px;
    color: var(--text-color);
    cursor: pointer;
    line-height: 44px;
    user-select: none;
}

.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-value {
    font-size: 14px;
    color: var(--text-color-light);
    opacity: 0.7;
    transition: opacity 0.25s ease, color 0.25s ease;
}

.color-input-group input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;

    width: 26px;
    height: 26px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    margin: 0;
    display: block;

    border-radius: 50%;
    overflow: hidden;

    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    transition: transform 0.2s ease;
}

.color-input-group input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
}

.color-input-group input[type="color"]::-webkit-color-swatch {
    border: none;
    padding: 0;
    border-radius: 0;
}

.color-input-group input[type="color"]::-moz-color-swatch {
    border: none;
    padding: 0;
    border-radius: 0;
}

.color-input-group:hover {
    background-color: rgba(0, 0, 0, 0.25);
}

.color-input-group:hover .color-value {
    opacity: 1;
    color: var(--secondary-color);
}

.color-input-group:hover input[type="color"] {
    transform: scale(1.1);
}

.color-input-group:focus-within {
    outline: none;
    background-color: rgba(0, 0, 0, 0.3);
    border-color: var(--secondary-color);
}

.tournament-info {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    margin: 20px 0;

    color: var(--secondary-color);
}

.tournament-info div {
    flex: 1;
    text-align: center;
    border-left: 2px solid var(--secondary-color);
}


.tournament-info div .bi {
    margin-right: 10px;
}

.tournament-info div:first-child {
    border: none;
}

#success {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    width: 100%;
    color: var(--text-color-light, #fff);
    text-align: center;
    font-family: sans-serif;
}

#success.hidden {
    display: none !important;
}

.success-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.checkmark-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: moveUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 1.2s;
}

.checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: block;
    stroke-width: 3;
    stroke: #4bb543;
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px #4bb543;
    animation: fill .4s ease-in-out .4s forwards, scale .3s ease-in-out .9s forwards;
}

.checkmark__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 3;
    stroke-miterlimit: 10;
    stroke: #4bb543;
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark__check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

.success-content {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInContent 0.6s ease-out forwards;
    animation-delay: 1.5s;
    margin-top: 20px;
    max-width: 500px;
}

.success-links {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.btn-link {
    display: inline-block;
    padding: 12px 24px;
    background-color: #962a87;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
    border-radius: 6px;
    transition: background 0.25s;
}

.btn-link.secondary {
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-link:hover {
    background-color: #bd3aa9;
}

.btn-link.secondary:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

@keyframes stroke {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes scale {

    0%,
    100% {
        transform: none;
    }

    50% {
        transform: scale3d(1.1, 1.1, 1);
    }
}

@keyframes fill {
    to {
        box-shadow: inset 0px 0px 0px 40px rgba(75, 181, 67, 0.1);
    }
}

@keyframes moveUp {
    to {
        transform: translateY(-10px);
    }
}

@keyframes fadeInContent {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Preload Index */

body.preload .col-50 h1,
body.preload .col-50 p,
body.preload .tournament-info>div,
body.preload #register-team,
body.preload .box {
    opacity: 0;
    transform: translateY(30px);
}

.col-50 h1,
.col-50 p,
.tournament-info>div,
#register-team,
.box {
    transition: opacity 0.8s cubic-bezier(0.2, 0.8, 0.2, 1),
        transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body:not(.preload) .col-50 h1 {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
}

body:not(.preload) .col-50 p {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.25s;
}

body:not(.preload) .tournament-info>div:nth-child(1) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.4s;
}

body:not(.preload) .tournament-info>div:nth-child(2) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.5s;
}

body:not(.preload) .tournament-info>div:nth-child(3) {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.6s;
}

body:not(.preload) #register-team {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.75s;
}

body:not(.preload) .box {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.45s;
}

/* --- TABULKA ZÁPASŮ --- */
.matches-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.matches-table th {
    padding: 14px 15px;
    background: rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.matches-table td {
    padding: 16px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
    font-size: 15px;
}

.matches-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}



.time-col {
    font-weight: bold;
    color: rgba(255, 255, 255, 0.8);
    width: 130px;
}

.team-name {
    font-weight: 600;
    width: 30%;
    color: var(--text-color);
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.text-center {
    text-align: center;
}

.placeholder-team {
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
    font-weight: 400;
}

.score-col {
    text-align: center;
    font-weight: bold;
    font-size: 16px;
    background: rgba(150, 42, 135, 0.15);
    color: var(--secondary-color);
    border-radius: 4px;
    padding: 6px 14px !important;
    display: inline-block;
    min-width: 50px;
}

/* Štítky (Badges) */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.badge-group {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.badge-group-a {
    background-color: #962a8840;
    color: #ffd7f2;
    border: 1px solid #962a88;
    box-shadow: 0 2px 8px rgba(150, 42, 135, 0.3);
    /* Jemná fialová záře */
}

/* Skupina B - Světlá růžovo-fialová s tmavým textem pro skvělý kontrast */
.badge-group-b {
    background-color: #ffd7f240;
    color: #ffd7f2;
    /* Tmavý text, na světlém pozadí skvěle čitelný */
    border: 1px solid #ffd7f2;
    box-shadow: 0 2px 8px rgba(255, 215, 242, 0.2);
}

.badge-playoff {
    background: rgba(255, 152, 0, 0.15);
    color: #ff9800;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.badge-final {
    background: rgba(233, 30, 99, 0.15);
    color: #e91e63;
    border: 1px solid rgba(233, 30, 99, 0.3);
}

.status {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

/* --- KASKÁDOVÁ ANIMACE NAČTENÍ --- */
body.preload .filter-box,
body.preload .table-box {
    opacity: 0;
    transform: translateY(20px);
}

.filter-box,
.table-box {
    transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1),
        transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body:not(.preload) .filter-box {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.1s;
}

body:not(.preload) .table-box {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.25s;
}

.loading-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    text-align: center;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #962a87;
    /* Barva ladící s vaším color pickerem */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.loading-wrapper p {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--primary-color);
    margin: 0;
}

.rules p{
    margin: 7px 0;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Media  */

@media screen and (max-width: 1300px) {
    .container {
        width: 95%;
        height: auto;
        
    }

    .rules p{
        text-align: center;
    }

    .row {
        flex-direction: column;
    }

    .box.box-fixed{
        width: 100%;
        max-width: 400px;
        height: auto;
        aspect-ratio: 4 / 5;
    }

    .box-content {
        scroll-margin-top: 30px;
    }

    .tournament-info {
        flex-direction: column;
        gap: 24px;
    }

    .tournament-info div {
        position: relative;
        border: none;
    }

    .tournament-info div::after {
        content: '';
        position: absolute;
        bottom: -12px;
        left: 50%;
        height: 2px;
        width: 40px;
        transform: translateX(-50%);
        background-color: var(--secondary-color);
    }

    .tournament-info div:last-child:after {
        display: none;
    }
}