:root {
    --mu-red: #DA291C;
    --mu-dark: #1a0505;
    --mu-gold: #FBE122;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
}

img {
    max-width: 100%;
}

a {
    text-decoration: none;
}

.section-title {
    font-weight: 800;
    color: var(--mu-red);
    margin-top: 3rem;
    margin-bottom: 2rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--mu-gold);
    margin: 10px auto 0;
}

/* Navbar */
.navbar-brand img {
    height: 40px;
}

.top-content {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
    line-height: 1.8;
    margin-bottom: 3rem;
}

/* Match Cards */
.match-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 1rem;
    padding: 1.5rem;
    border-left: 5px solid var(--mu-red);
    transition: transform 0.2s;
}

.match-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.match-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.team {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 700;
    font-size: 1.1rem;
}

.team img {
    width: 50px;
    height: 50px;
    object-fit: contain;
}

.text-end.team {
    flex-direction: row-reverse;
}

.score {
    font-size: 2rem;
    font-weight: 900;
    color: var(--mu-dark);
    line-height: 1;
}

.subtitle {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Squad Section */
.search-wrapper {
    max-width: 600px;
    margin: 0 auto 2rem;
    text-align: center;
}

.search-wrapper input {
    padding: 12px 20px;
    border-radius: 30px;
    border: 2px solid #ddd;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    text-align: center;
    font-weight: 600;
}

.search-wrapper input:focus {
    border-color: var(--mu-red);
    box-shadow: 0 0 0 0.2rem rgba(218, 41, 28, 0.25);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 3rem;
}

.player-card {
    height: 340px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1);
    transform-style: preserve-3d;
}

.player-card:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.card-front {
    background: white;
    display: flex;
    flex-direction: column;
}

.card-back {
    background: linear-gradient(145deg, var(--mu-dark) 0%, #000 100%);
    color: white;
    transform: rotateY(180deg);
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    border: 2px solid var(--mu-gold);
}

.player-name {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--mu-gold);
    text-transform: uppercase;
}

.player-info {
    margin-bottom: 10px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 5px;
}

.info-label {
    color: #ccc;
    font-size: 0.9rem;
}

.info-value {
    font-weight: bold;
}

.frame {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #f0f2f5;
}

.img-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    transition: transform 0.3s;
}

.player-card:hover .img-wrap img {
    transform: scale(1.05);
}

.placeholder {
    font-size: 4rem;
    font-weight: 900;
    color: #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
}

.namebar {
    background: var(--mu-red);
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.squad-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--mu-gold);
    color: var(--mu-dark);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    z-index: 2;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-size: 1.1rem;
}

/* Formation Pitch */
.formation {
    margin: 4rem 0;
}

.formation h4 {
    text-align: center;
    margin-bottom: 2rem;
    font-weight: 700;
}

.pitch-wrap {
    background: #2e8b57;
    border-radius: 12px;
    padding: 20px;
    position: relative;
    height: 700px;
    /* Taller pitch */
    overflow: hidden;
    border: 4px solid white;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    max-width: 900px;
    margin: 0 auto;
}

.pitch {
    position: relative;
    height: 100%;
    width: 100%;
    /* Grass Pattern */
    background-image:
        linear-gradient(0deg, transparent 24%, rgba(255, 255, 255, .2) 25%, rgba(255, 255, 255, .2) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, .2) 75%, rgba(255, 255, 255, .2) 76%, transparent 77%, transparent),
        linear-gradient(90deg, transparent 24%, rgba(255, 255, 255, .2) 25%, rgba(255, 255, 255, .2) 26%, transparent 27%, transparent 74%, rgba(255, 255, 255, .2) 75%, rgba(255, 255, 255, .2) 76%, transparent 77%, transparent);
    background-size: 50px 50px;
    background-color: #3cb371;
}

/* Center circle/lines would be complex, keeping simple for now or adding basic lines */
.pitch::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(255, 255, 255, 0.4);
}

.pitch::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
}

.pos {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 90px;
    z-index: 5;
    transition: transform 0.2s;
}

.pos:hover {
    transform: translate(-50%, -60%) scale(1.1);
    z-index: 10;
}

.pos img {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    background: #f0f0f0;
    object-fit: cover;
    margin-bottom: 8px;
}

.pos span {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.coach-box {
    position: absolute;
    top: 20px;
    left: 20px;
    background: white;
    padding: 10px 15px;
    border-radius: 12px;
    display: flex;
    gap: 12px;
    align-items: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 100;
    border-left: 4px solid var(--mu-red);
}

.coach-box img {
    width: 55px;
    height: 55px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
}

.coach-box .name {
    font-weight: 800;
    color: var(--mu-dark);
}

/* Standings Table */
.table-standings {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
}

.table thead th {
    background: var(--mu-dark);
    color: white;
    border: none;
    padding: 15px;
    font-weight: 600;
}

.table tbody td {
    padding: 12px 15px;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
    font-weight: 500;
}

.club {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    color: #333;
}

.club img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.badge-form {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.badge-W,
.badge-M {
    background: #28a745;
    color: white;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
}

.badge-D,
.badge-B {
    background: #6c757d;
    color: white;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
}

.badge-L,
.badge-K {
    background: #dc3545;
    color: white;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 800;
}

/* Bench */
.bench {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 2rem;
    padding: 20px;
    background: white;
    border-radius: 15px;
}

.bench-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    text-align: center;
    transition: transform 0.2s;
}

.bench-player:hover {
    transform: translateY(-5px);
}

.bench-player img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 8px;
    object-fit: cover;
    border: 3px solid #eee;
}

.bench-player span {
    font-size: 0.8rem;
    font-weight: 700;
    color: #555;
    line-height: 1.2;
}

/* Footer */
footer {
    border-top: 1px solid #ddd;
    padding-top: 2rem;
    color: #666;
}

/* Responsive */
@media (max-width: 768px) {
    .team small {
        display: none;
        /* Hide team names on mobile match cards if tight */
    }

    .score {
        font-size: 1.5rem;
    }

    .formation {
        overflow-x: auto;
    }

    .pitch-wrap {
        min-width: 600px;
        /* Allow scroll on mobile */
    }
}