* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --background: #0b1110;
    --panel: #121a18;
    --panel-light: #1a2522;
    --text: #f4f7f6;
    --muted: #94a39e;
    --green: #18c477;
    --red: #e74c3c;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(
            circle at top,
            #17231f,
            #080d0c 65%
        );

    color: var(--text);

    font-family:
        Arial,
        Helvetica,
        sans-serif;
}


/* =========================
   BARRA SUPERIOR
========================= */

.topbar {
    min-height: 72px;

    background: rgba(12, 18, 16, .95);

    border-bottom: 1px solid #26312e;

    padding: 0 30px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;
}

.brand {
    font-size: 22px;
    font-weight: 700;

    display: flex;
    align-items: center;
    gap: 10px;
}

.top-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.formation-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.formation-control label {
    color: var(--muted);
    font-size: 14px;
}

select,
button {
    font-family: inherit;
}

select,
button {
    background: var(--panel-light);

    border: 1px solid #34413d;

    color: white;

    border-radius: 8px;

    padding: 10px 14px;

    cursor: pointer;
}

button:hover,
select:hover {
    border-color: var(--green);
}

.lock-button.locked {
    background: rgba(231, 76, 60, .12);

    border-color: var(--red);

    color: #ffb4ab;
}

.lock-button.unlocked {
    background: rgba(24, 196, 119, .12);

    border-color: var(--green);

    color: var(--green);
}

button:disabled,
select:disabled {
    opacity: .4;

    cursor: not-allowed;
}

button:disabled:hover,
select:disabled:hover {
    border-color: #34413d;
}


/* =========================
   MAIN
========================= */

.main-container {
    max-width: 1450px;

    margin: auto;

    padding: 25px;
}


/* =========================
   EQUIPO
========================= */

.team-header {
    background: rgba(18, 26, 24, .85);

    border: 1px solid #293632;

    border-radius: 14px;

    padding: 15px 20px;

    margin-bottom: 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.team-details {
    display: flex;
    align-items: center;

    gap: 15px;
}

.team-shield {
    width: 55px;
    height: 55px;

    border-radius: 12px;

    background: #1d2925;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 25px;
}

#teamName {
    background: transparent;

    border: none;
    outline: none;

    color: white;

    font-size: 21px;
    font-weight: 700;

    width: 230px;
}

.team-details p {
    color: var(--muted);

    font-size: 12px;

    margin-top: 4px;
}

.team-actions {
    display: flex;
    gap: 10px;
}

.button {
    background: var(--panel-light);
    border: 1px solid #34413d;
    color: white;
    border-radius: 8px;
    padding: 10px 14px;
    cursor: pointer;
}

.button:hover {
    border-color: var(--green);
}

.primary {
    background: var(--green) !important;

    border-color: var(--green) !important;

    color: #04140c !important;

    font-weight: 700;
}

.danger {
    background: var(--red) !important;

    border-color: var(--red) !important;

    color: white;
}


/* =========================
   ESPACIO PRINCIPAL
========================= */

.content-grid {
    display: grid;

    grid-template-columns:
        minmax(500px, 1fr)
        310px;

    gap: 20px;
}


/* =========================
   CANCHA
========================= */

.pitch-wrapper {
    width: 100%;

    display: flex;

    justify-content: center;
}

.pitch {
    position: relative;

    width: min(850px, 100%);

    aspect-ratio: 1.55 / 1;

    overflow: hidden;

    border: 4px solid rgba(255,255,255,.8);

    border-radius: 8px;

    background:
        repeating-linear-gradient(
            90deg,
            #158348 0,
            #158348 10%,
            #197f47 10%,
            #197f47 20%
        );

    box-shadow:
        0 15px 50px rgba(0,0,0,.5);
}

.pitch-border {
    position: absolute;

    inset: 4%;

    border: 2px solid rgba(255,255,255,.75);

    pointer-events: none;
}

.center-circle-half {
    position: absolute;

    width: 30%;

    aspect-ratio: 2 / 1;

    left: 50%;
    top: 4%;

    transform:
        translateX(-50%);

    border:
        2px solid rgba(255,255,255,.75);

    border-top: none;

    border-radius: 0 0 999px 999px;
}

.center-dot {
    position: absolute;

    width: 8px;
    height: 8px;

    left: 50%;
    top: 4%;

    transform:
        translate(-50%, -50%);

    border-radius: 50%;

    background: white;
}

.penalty-area {
    position: absolute;

    width: 17%;
    height: 42%;

    left: 50%;

    transform:
        translateX(-50%);

    border:
        2px solid rgba(255,255,255,.75);
}

.penalty-area.top {
    top: 4%;

    border-top: none;
}

.penalty-area.bottom {
    bottom: 4%;

    border-bottom: none;
}

.goal {
    position: absolute;

    width: 35%;
    height: 12%;

    left: 50%;

    transform:
        translateX(-50%);

    border: 2px solid white;
}

.penalty-area.top .goal {
    top: 0;
}

.penalty-area.bottom .goal {
    bottom: 0;
}

.penalty-dot {
    position: absolute;

    width: 6px;
    height: 6px;

    left: 50%;

    transform: translateX(-50%);

    border-radius: 50%;

    background: rgba(255,255,255,.75);
}

.penalty-dot.top {
    top: 16%;
}

.penalty-dot.bottom {
    bottom: 16%;
}


/* =========================
   ESQUINAS
========================= */

.corner {
    position: absolute;

    width: 25px;
    height: 25px;

    border:
        2px solid rgba(255,255,255,.7);

    border-radius: 50%;
}

.top-left {
    top: 3%;
    left: 3%;
}

.top-right {
    top: 3%;
    right: 3%;
}

.bottom-left {
    bottom: 3%;
    left: 3%;
}

.bottom-right {
    bottom: 3%;
    right: 3%;
}


/* =========================
   JUGADORES EN CANCHA
   (foto + número a la izquierda,
   nombre en una placa al lado,
   para que no se corte el texto)
========================= */

.player {
    position: absolute;

    display: flex;
    align-items: center;
    gap: 7px;

    width: max-content;

    transform:
        translate(-50%, -50%);

    cursor: grab;

    z-index: 10;

    user-select: none;

    touch-action: none;
}

.player:active {
    cursor: grabbing;
}

.player-photo {
    position: relative;

    width: 54px;
    height: 54px;

    flex-shrink: 0;

    border-radius: 50%;

    border: 3px solid white;

    overflow: hidden;

    background: #27332f;

    box-shadow:
        0 4px 10px rgba(0,0,0,.45);
}

.player-photo img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.player-number {
    position: absolute;

    left: -6px;
    top: -6px;

    width: 22px;
    height: 22px;

    border-radius: 50%;

    background: #111;

    border: 2px solid white;

    font-size: 11px;
    font-weight: bold;

    display: flex;
    align-items: center;
    justify-content: center;

    z-index: 2;
}

.player-name {
    max-width: 120px;

    background: rgba(0,0,0,.75);

    border: 1px solid rgba(255,255,255,.15);

    border-radius: 6px;

    padding: 4px 9px;

    font-size: 12px;
    font-weight: bold;

    line-height: 1.2;

    white-space: nowrap;

    overflow: hidden;

    text-overflow: ellipsis;

    box-shadow:
        0 3px 8px rgba(0,0,0,.4);
}


/* =========================
   SUPLENTES
========================= */

.bench {
    margin-top: 20px;

    background: rgba(18, 26, 24, .85);

    border: 1px solid #293632;

    border-radius: 14px;

    padding: 18px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 15px;
}

.bench-players {
    display: flex;

    flex-wrap: wrap;

    gap: 10px;
}

.bench-player {
    display: flex;
    align-items: center;

    gap: 10px;

    padding: 8px 10px;

    background: #17211f;

    border: 1px solid #26332f;

    border-radius: 9px;

    cursor: pointer;
}

.bench-player:hover {
    border-color: var(--green);
}

.bench-player img {
    width: 40px;
    height: 40px;

    object-fit: cover;

    border-radius: 50%;
}

.bench-player strong {
    font-size: 13px;

    margin-right: 4px;
}

.bench-player span {
    font-size: 13px;
}

.bench-player button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
}


/* =========================
   SIDEBAR
========================= */

.sidebar {
    background: rgba(18, 26, 24, .9);

    border:
        1px solid #293632;

    border-radius: 14px;

    padding: 18px;

    height: fit-content;
}

.sidebar-title {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 15px;
}

.player-list {
    display: flex;

    flex-direction: column;

    gap: 8px;
}

.player-item {
    display: flex;

    align-items: center;

    gap: 10px;

    padding: 8px;

    background: #17211f;

    border:
        1px solid #26332f;

    border-radius: 9px;

    cursor: pointer;
}

.player-item:hover {
    border-color: var(--green);
}

.player-item img {
    width: 40px;
    height: 40px;

    object-fit: cover;

    border-radius: 50%;
}

.player-item-info {
    flex: 1;
}

.player-item-name {
    font-size: 14px;

    font-weight: bold;
}

.player-item-position {
    font-size: 11px;

    color: var(--muted);
}


/* =========================
   DIRECTOR TÉCNICO
========================= */

.coach-section {
    margin-top: 25px;

    padding-top: 20px;

    border-top:
        1px solid #293632;
}

.coach-title h2 {
    font-size: 17px;

    margin-bottom: 12px;
}

.coach-card {
    display: flex;

    align-items: center;

    gap: 10px;

    padding: 10px;

    background: #17211f;

    border:
        1px solid #26332f;

    border-radius: 10px;
}

.coach-card:hover {
    border-color: var(--green);
}

.coach-photo {
    width: 52px;
    height: 52px;

    flex-shrink: 0;

    border-radius: 50%;

    overflow: hidden;

    border:
        2px solid var(--green);

    background: #26332f;
}

.coach-photo img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.coach-info {
    flex: 1;

    min-width: 0;
}

#coachName {
    width: 100%;

    background: transparent;

    border: none;

    outline: none;

    color: white;

    font-size: 14px;

    font-weight: bold;
}

.coach-info span {
    display: block;

    margin-top: 3px;

    color: var(--muted);

    font-size: 11px;
}

.edit-button {
    border: none;

    background: #26332f;

    color: white;

    border-radius: 7px;

    padding: 8px;

    cursor: pointer;
}

.edit-button:hover {
    background: var(--green);

    color: #06130d;
}


/* =========================
   MODAL
========================= */

.modal {
    position: fixed;

    inset: 0;

    background:
        rgba(0,0,0,.7);

    display: flex;

    align-items: center;
    justify-content: center;

    z-index: 100;
}

.hidden {
    display: none;
}

.modal-box {
    position: relative;

    width: min(420px, 90%);

    max-height: 90vh;

    overflow-y: auto;

    background: #141d1a;

    border:
        1px solid #34423d;

    border-radius: 15px;

    padding: 25px;

    box-shadow:
        0 20px 60px rgba(0,0,0,.6);
}

.modal-box h2 {
    margin-bottom: 20px;
}

.modal-close {
    position: absolute;

    right: 15px;
    top: 12px;

    border: none;

    background: none;

    color: white;

    font-size: 28px;

    cursor: pointer;
}

.modal-photo {
    width: 100px;
    height: 100px;

    margin:
        0 auto 20px;

    border-radius: 50%;

    overflow: hidden;

    border:
        3px solid var(--green);
}

.modal-photo img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}

.modal-box label {
    display: block;

    margin-top: 15px;

    color: var(--muted);

    font-size: 13px;
}

.modal-box input,
.modal-box select {
    display: block;

    width: 100%;

    margin-top: 6px;

    background: #0d1412;

    color: white;

    border:
        1px solid #35433e;

    border-radius: 8px;

    padding: 11px;

    outline: none;
}

.modal-box input:focus,
.modal-box select:focus {
    border-color: var(--green);
}

.modal-actions {
    display: flex;

    justify-content: space-between;

    align-items: center;

    margin-top: 25px;
}

.auth-box {
    text-align: left;
}

.auth-hint {
    color: var(--muted);

    font-size: 13px;

    margin-top: 4px;
}

.auth-error {
    color: var(--red);

    font-size: 13px;

    margin-top: 10px;
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {

    .topbar {
        padding: 15px;

        flex-direction: column;

        gap: 15px;
    }

    .top-controls {
        width: 100%;

        justify-content: center;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        order: 2;
    }

    .pitch {
        width: 100%;
    }
}

@media (max-width: 600px) {

    .main-container {
        padding: 10px;
    }

    .team-header {
        flex-direction: column;

        align-items: stretch;

        gap: 15px;
    }

    .team-actions {
        width: 100%;
    }

    .team-actions button {
        flex: 1;
    }

    .top-controls {
        flex-wrap: wrap;
    }

    .player {
        gap: 5px;
    }

    .player-photo {
        width: 42px;
        height: 42px;
    }

    .player-number {
        width: 18px;
        height: 18px;

        font-size: 9px;
    }

    .player-name {
        max-width: 80px;

        font-size: 10px;

        padding: 3px 6px;
    }
}