/* --- Custom Ranking Table Styles -- */
.ranking-table .team-name-cell {
    text-align: left;
}

.team-icon-ranking {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 1rem;
}

/* General Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    margin: 0;
    background-color: #f2f2f7;
    color: #1c1c1e;
    overflow-x: hidden;
    -webkit-user-select: none; /* Safari */
    -moz-user-select: none; /* Firefox */
    -ms-user-select: none; /* IE 10 and IE 11 */
    user-select: none; /* Standard syntax */
}

a {
    color: #007aff;
    text-decoration: none;
}

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

/* Header and Navigation */
.top-nav {
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e5ea;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    transition: background-color 0.3s ease;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1c1c1e;
    display: flex;
    align-items: center;
}

.logo img {
    height: 60px;
    width: auto;
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex; /* show nav links; script.js fills content */
    gap: 1.5rem;
}

.nav-links a {
    font-weight: 500;
    color: #333;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: #007aff;
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, #f2f2f7, #e5e5ea);
    position: relative;
}

.hero-content h1 {
    font-size: 6rem;
    font-weight: 800;
    margin: 0;
    color: #1c1c1e;
    letter-spacing: -2px;
}

.hero-logo {
    max-width: 80%;
    height: auto;
    max-height: 200px; /* Adjust as needed */
    margin-bottom: 1rem;
}

.hero-content p {
    font-size: 1.5rem;
    color: #888;
    margin-top: 0.5rem;
}

.hero-buttons {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

.btn {
    background-color: #007aff;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 0.8rem 1.8rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
    transition: all 0.3s ease;
}

.btn.btn-secondary {
    background-color: #e5e5ea;
    color: #1c1c1e;
    box-shadow: none;
}

.btn.btn-secondary:hover {
    background-color: #d1d1d6;
    transform: none;
}

.btn:hover {
    background-color: #005ecb;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.3);
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    animation: bounce 2s infinite;
}

.scroll-indicator span {
    display: block;
    width: 24px;
    height: 24px;
    border-left: 2px solid #888;
    border-bottom: 2px solid #888;
    transform: rotate(-0deg);
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) rotate(-45deg);
    }
    40% {
        transform: translateY(-10px) rotate(-45deg);
    }
    60% {
        transform: translateY(-5px) rotate(-45deg);
    }
}

/* Main Content Tabs */
#main-content-container {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.content-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid #e5e5ea;
    padding-bottom: 1rem;
}

.tab-btn {
    padding: 0.75rem 0.25rem;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    background-color: transparent;
    color: #8e8e93; /* Slightly muted color for inactive tabs */
    cursor: pointer;
    transition: color 0.3s ease;
    position: relative; /* For the underline pseudo-element */
    margin: 0 1rem;
}

.tab-btn:hover {
    color: #1c1c1e;
}

.tab-btn.active {
    color: #007aff; /* Highlight color for the active tab text */
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -17px; /* Position the underline below the button */
    left: 0;
    right: 0;
    height: 3px;
    background-color: #007aff;
    border-radius: 1.5px;
}

.content-section {
    display: none; /* Hide all sections by default */
    animation: fadeIn 0.5s ease-in-out;
}

.content-section.active {
    display: block; /* Show only the active section */
}


/* Recent Matches Section */
.recent-matches-container {
    max-width: 500px;
    margin: 0 auto;
}

.match-card {
    background-color: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid #e5e5ea;
}

.match-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.match-card .match-date {
    font-size: 0.9rem;
    color: #888;
    margin-bottom: 1rem;
}

.match-card .match-teams {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.match-card .team-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
}

.match-card .team-name {
    font-weight: bold;
    font-size: 1.2rem;
    word-break: keep-all;
}

.match-card .score {
    font-size: 2rem;
    font-weight: bold;
    margin: 0 1rem;
}

.match-card-team-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
}

/* Ranking Section */
.ranking-section h2, .content-section h2 {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    margin-top: 0;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
    border-radius: 10px;
    overflow: hidden;
    table-layout: fixed;
}

.ranking-table th, .ranking-table td {
    padding: 1rem;
    text-align: center;
}

.ranking-table thead {
    background-color: #f9f9f9;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #e5e5ea;
}

.ranking-table tbody tr {
    border-bottom: 1px solid #f2f2f7;
}

.ranking-table tbody tr:last-child {
    border-bottom: none;
}

.ranking-table tbody tr:hover {
    background-color: #f9f9f9;
}

.ranking-table tbody tr.team-row:hover {
    cursor: pointer;
    background-color: #f2f2f7;
}

.ranking-table td:first-child {
    font-weight: bold;
}

.team-icon-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-right: 8px;
}

/* Schedule Section */
#schedule-container {
    display: grid;
    gap: 1.5rem;
}

.schedule-item {
    background-color: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    align-items: center;
    text-align: center;
}

.schedule-team {
    font-weight: 600;
    font-size: 1.1rem;
}

.schedule-time {
    font-size: 0.9rem;
    color: #666;
}

.schedule-time strong {
    font-size: 1.2rem;
    color: #1c1c1e;
    display: block;
}

/* --- Match Report Page Styles --- */
.report-text-block {
    background-color: #fff;
    padding: 2rem;
    border-radius: 12px;
    line-height: 1.7;
    font-size: 1.1rem;
}

.report-list-block .list-item {
    background-color: #fff;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

.mvp-card {
    background-color: #fff;
    border-radius: 15px;
    padding: 2rem;
    text-align: center;
    max-width: 300px;
    margin: 0 auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
}

.mvp-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem auto;
    border: 4px solid #007aff;
}

.mvp-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
}

.mvp-team {
    font-size: 1.1rem;
    color: #888;
    margin-top: 0.25rem;
}

.player-stat-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-stat-photo {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
}

.player-stat-name {
    font-weight: 600;
}

.player-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #007aff;
}

.player-stat-value-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.event-timestamp {
    font-size: 0.9rem;
    color: #888;
}

.card-indicator {
    width: 24px;
    height: 32px;
    border-radius: 4px;
}

.card-indicator.yellow {
    background-color: #ffcc00;
}

.card-indicator.red {
    background-color: #ff3b30;
}


/* Footer */
.footer {
    text-align: center;
    padding: 2rem;
    font-size: 0.9rem;
    color: #888;
    background-color: #f2f2f7;
}
.footer p {
    margin: 0.3rem 0;
}
.footer .admin-link {
    font-size: 0.85rem;
    color: #aaa;
}
.footer .admin-link:hover {
    color: #007aff;
}

/* Custom Alert */
.custom-alert-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.custom-alert-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.custom-alert-popup {
    background: white;
    padding: 2rem 2.5rem;
    border-radius: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 90%;
    width: 400px;
}

.custom-alert-overlay.active .custom-alert-popup {
    transform: scale(1);
}

.custom-alert-popup p {
    margin: 0 0 1.5rem 0;
    font-size: 1.1rem;
    color: #333;
    line-height: 1.6;
}

.custom-alert-popup .custom-alert-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.custom-alert-popup .custom-alert-buttons .btn {
    width: auto;
    min-width: 80px;
    padding: 0.6rem 1.2rem;
    margin-top: 0;
}

/* --- Animations --- */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-in-out forwards;
}

/* --- MyPage Styles --- */
.mypage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.mypage-section {
    background-color: #fff;
    padding: 2rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}

.mypage-section h3 {
    margin-top: 0;
    border-bottom: 1px solid #e5e5ea;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid #f2f2f7;
}
.list-item:last-child { border-bottom: none; }

.item-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 1rem;
}
.item-details {
    flex-grow: 1;
}
.item-details h3 { margin: 0 0 0.25rem 0; }
.item-details p { margin: 0; color: #666; font-size: 0.9rem; }
.no-data {
    color: #888;
    text-align: center;
    padding: 1rem 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f2f2f7;
}
.stat-item:last-child { border-bottom: none; }
.stat-item strong { font-weight: 600; }

/* --- Team Management Page Styles --- */
.management-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}
.management-card {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}
.management-card h3 {
    margin-top: 0;
    border-bottom: 1px solid #e5e5ea;
    padding-bottom: 0.8rem;
    margin-bottom: 1rem;
}

.btn-small { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-danger { background-color: #ff3b30; }
.btn-danger:hover { background-color: #c70000; }

.danger-zone {
    border: 2px solid #ff3b30;
}
.danger-zone h3 { color: #ff3b30; }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem; /* This replaces the margin-bottom on the h3 */
}

.card-header h3 {
    margin: 0; /* Remove default margin from h3 */
    border: none;
    padding: 0;
}

.btn-edit {
    background-color: #f0f0f0;
    color: #555;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    text-decoration: none;
}

.btn-edit:hover {
    background-color: #e0e0e0;
    transform: translateY(-1px);
}

.btn-save-squad {
    width: 100%;
    margin-top: 1rem;
    padding: 0.75rem;
    font-size: 0.9rem;
    background-color: #007aff;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-save-squad:hover {
    background-color: #005ecb;
}

.btn-save-squad:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.btn-recruit, .btn-release {
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
}

.btn-recruit {
    background-color: #e8f5e9; /* light green */
    color: #2e7d32; /* dark green */
}

.btn-recruit:hover {
    background-color: #c8e6c9;
    transform: translateY(-1px);
}

.btn-release {
    background-color: #ffebee;
    color: #c62828;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    line-height: 1;
}

.btn-release:hover {
    background-color: #ffcdd2;
    transform: translateY(-1px);
}

/* --- Squad Maker Styles --- */
.squad-maker-container {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.pitch {
    flex: 3;
    position: relative;
    background: #53a053;
    background-image: radial-gradient(circle at center, #60b460, #498d49);
    border: 2px solid #fff;
    border-radius: 12px;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 600px;
    overflow: hidden;
    min-width: 300px; /* Ensure pitch is visible on smaller screens */
}

.bench-area {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
}

.line {
    position: absolute;
    border-color: rgba(255, 255, 255, 0.4);
    border-style: solid;
}

.line.middle {
    top: 50%;
    left: 0;
    right: 0;
    border-width: 1px 0 0 0;
}

.line.center-circle {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-width: 2px;
    border-radius: 50%;
}

.line.penalty-box-top {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 80px;
    border-width: 0 2px 2px 2px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.line.penalty-box-bottom {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 120px;
    border-width: 2px 2px 0 2px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.position-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    z-index: 1;
}

.position-slot {
    width: 80px;
    height: 60px;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.position-slot.sortable-ghost {
    background-color: rgba(255, 255, 255, 0.2);
}

.player-chip {
    width: 100%;
    height: 100%;
    cursor: grab;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4px;
    box-sizing: border-box;
}

.player-chip-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #ccc;
    background-size: cover;
    background-position: center;
    border: 1px solid #fff;
}

.player-chip-name {
    font-size: 0.8rem;
    color: white;
    font-weight: 600;
    margin-top: 4px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
}

/* Adjustments for chips inside the bench */
.bench .player-chip {
    flex-direction: row;
    justify-content: flex-start;
    background-color: #fff;
    border-radius: 8px;
    padding: 8px;
    height: auto;
    width: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.bench .player-chip-name {
    color: #333;
    text-shadow: none;
    margin-top: 0;
    margin-left: 8px;
}

.bench .player-chip-photo {
    border-color: #ddd;
}

.bench-area {
    flex: 1;
    min-width: 200px;
}

.bench-area h4 {
    text-align: center;
    color: #666;
    margin-bottom: 1rem;
}

.bench {
    background-color: #e5e5ea;
    border-radius: 12px;
    padding: 1rem;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* --- Form Pages (Login, Signup, etc.) --- */
.form-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.form-box {
    background: #fff;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.form-box h1 {
    margin-bottom: 2rem;
}

.form-box input,
.form-box textarea {
    width: 100%;
    padding: 0.9rem;
    margin-bottom: 1rem;
    border-radius: 12px;
    border: 1px solid #ccc;
    font-size: 1rem;
    text-align: left;
    box-sizing: border-box;
    font-family: inherit;
}

.form-box .btn {
    width: 100%;
    margin-top: 1rem;
}

.form-box .switch-link {
    margin-top: 1.5rem;
    font-size: 0.9rem;
}

.input-error {
    color: #ff3b30;
    font-size: 0.8rem;
    text-align: left;
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    height: 1rem;
}


/* --- Responsive Styles --- */
.hamburger-menu {
    display: none; /* Hide hamburger by default */
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

@media screen and (max-width: 768px) {
    .nav-container {
        padding: 1rem;
    }

    .nav-links {
        /* display: none; Hide nav links by default on mobile */
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: rgba(255, 255, 255, 0.95);
        backdrop-filter: blur(10px);
        padding: 1rem 0;
        border-bottom: 1px solid #e5e5ea;

        /* Animation Properties */
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    }

    .nav-links.active {
        /* display: flex; Show when hamburger is clicked */
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .nav-links li {
        text-align: center;
        padding: 1rem 0;
    }

    .hamburger-menu {
        display: block; /* Show hamburger on mobile */
    }

    .hero-content h1 {
        font-size: 4rem;
    }
    .hero-content p {
        font-size: 1.2rem;
    }

    .content-tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .tab-btn {
        font-size: 1rem;
        margin: 0 0.5rem;
    }
    .tab-btn.active::after {
        bottom: -11px;
    }

    .container {
        padding: 0.5rem; /* Reduce padding for smaller screens */
    }

    .mypage-grid, .management-grid {
        grid-template-columns: 1fr; /* Stack items in a single column on mobile */
        gap: 1rem;
    }

    .mypage-section, .management-card, .form-box {
        padding: 1rem; /* Adjust section padding */
    }

    #team-ranking-content .ranking-table {
        display: block; /* Allow table to scroll horizontally */
        overflow-x: auto;
        white-space: nowrap; /* Prevent text wrapping in table cells */
    }
    .ranking-table th, .ranking-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .schedule-item {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .squad-maker-container {
        flex-direction: column;
    }
    .pitch {
        min-height: 500px;
    }
}

/* --- Recruit Player Page Styles --- */

.player-info-recruit {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
}

.recruit-player-photo,
.recruit-player-photo-placeholder {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #f2f2f7;
    flex-shrink: 0;
}

.recruit-player-photo-placeholder {
    background-color: #e9e9e9;
}

.player-team-tag {
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    background-color: #e5e5ea;
    color: #333;
}

/* Card Animation */
.fade-in-card {
    opacity: 0;
    transform: translateY(20px);
    animation: card-fade-in 0.5s ease-out forwards;
}

@keyframes card-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Add a hover effect to management cards for more interactivity */
.management-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.management-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
.player-profile-desc {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
    font-style: italic;
}

/* Styles for form checkboxes */
.form-check {
    text-align: left;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    opacity: 0;
    position: absolute;
    width: 0;
    height: 0;
}

.form-check label {
    font-size: 0.9rem;
    color: #555;
    position: relative;
    padding-left: 28px; /* space for custom checkbox */
    cursor: pointer;
}

.form-check label::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 2px solid #c7c7cc;
    border-radius: 6px;
    background-color: #fff;
    transition: all 0.2s ease;
}

.form-check label:hover::before {
    border-color: #8e8e93;
}

.form-check input[type="checkbox"]:checked + label::before {
    background-color: #007aff;
    border-color: #007aff;
}

.form-check input[type="checkbox"]:checked + label::after {
    content: '';
    position: absolute;
    left: 7px;
    top: 50%;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translateY(-60%) rotate(45deg);
}

.form-check a {
    text-decoration: underline;
}

/* --- Squad Editor Page Styles --- */
.squad-editor-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.07);
}

.formation-selection {
    text-align: center;
    margin-bottom: 1rem;
}

.formation-selection h3 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    color: #333;
}

/* --- Custom Select Dropdown --- */
.custom-select-wrapper {
    position: relative;
    display: inline-block;
    user-select: none;
    width: 150px;
}

.custom-select {
    position: relative;
}

.custom-select__trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    font-weight: 500;
    color: #1c1c1e;
    background-color: #f2f2f7;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-select__trigger:hover {
    border-color: #d1d1d6;
}

.custom-select.open .custom-select__trigger {
    border-color: #007aff;
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.25);
}

.custom-select__trigger .arrow {
    position: relative;
    height: 8px;
    width: 8px;
    border-left: 2px solid #555;
    border-bottom: 2px solid #555;
    transform: rotate(-45deg);
    transition: transform 0.3s ease;
}

.custom-select.open .arrow {
    transform: rotate(135deg);
}

.custom-options {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e5e5ea;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.custom-select.open .custom-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.custom-option {
    display: block;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    color: #333;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.custom-option:hover {
    background-color: #f2f2f7;
}

.custom-option.selected {
    background-color: #e5e5ea;
    font-weight: 600;
}

.custom-option:first-of-type {
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.custom-option:last-of-type {
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Re-using and adapting existing squad maker styles */
.squad-maker-container {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center; /* Center content within the container */
}

.pitch {
    flex: 3;
    position: relative;
    background: #53a053;
    background-image: radial-gradient(circle at center, #60b460, #498d49);
    border: 2px solid #fff;
    border-radius: 12px;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 600px;
    overflow: hidden;
    min-width: 300px; /* Ensure pitch is visible on smaller screens */
}

.line {
    position: absolute;
    border-color: rgba(255, 255, 255, 0.4);
    border-style: solid;
}

.line.middle {
    top: 50%;
    left: 0;
    right: 0;
    border-width: 1px 0 0 0;
}

.line.center-circle {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    border-width: 2px;
    border-radius: 50%;
}

.line.penalty-box-top {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50%;
    height: 80px;
    border-width: 0 2px 2px 2px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

.line.penalty-box-bottom {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 120px;
    border-width: 2px 2px 0 2px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
}

.position-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    z-index: 1;
}

.position-slot {
    width: 80px;
    height: 60px;
    border: 2px dashed rgba(255, 255, 255, 0.4);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
    font-weight: bold;
    transition: background-color 0.2s ease;
}

.position-slot.sortable-ghost {
    background-color: rgba(255, 255, 255, 0.2);
}

.player-chip {
    width: 100%;
    height: 100%;
    cursor: grab;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4px;
    box-sizing: border-box;
}

.player-chip-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #ccc;
    background-size: cover;
    background-position: center;
    border: 1px solid #fff;
}

.player-chip-name {
    font-size: 0.8rem;
    color: white;
    font-weight: 600;
    margin-top: 4px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70px;
}

/* Adjustments for chips inside the bench */
.bench .player-chip {
    flex-direction: row;
    justify-content: flex-start;
    background-color: #fff;
    border-radius: 8px;
    padding: 8px;
    height: auto;
    width: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.bench .player-chip-name {
    color: #333;
    text-shadow: none;
    margin-top: 0;
    margin-left: 8px;
}

.bench .player-chip-photo {
    border-color: #ddd;
}

.bench-area {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
}

.bench-area h4 {
    text-align: center;
    color: #666;
    margin-bottom: 1rem;
}

.bench {
    background-color: #e5e5ea;
    border-radius: 12px;
    padding: 1rem;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1; /* Allow bench to take available height */
}

@media screen and (max-width: 768px) {
    .squad-editor-container {
        padding: 1rem;
    }
    .squad-maker-container {
        flex-direction: column;
    }
    .pitch {
        min-height: 400px;
        width: 100%;
    }
    .bench-area {
        width: 100%;
    }

    .position-slot {
        width: 65px;
        height: 50px;
    }

    .player-chip-photo {
        width: 30px;
        height: 30px;
    }

    .player-chip-name {
        font-size: 0.7rem;
        max-width: 55px;
    }
}

/* --- Player Selection Modal --- */
.player-select-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.player-select-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.player-select-modal-popup {
    background: #fff;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.25);
    width: 90%;
    max-width: 350px;
    text-align: center;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.player-select-modal-overlay.active .player-select-modal-popup {
    transform: scale(1);
}

.player-select-modal-popup h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.player-select-list {
    max-height: 60vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.player-select-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background-color: #f2f2f7;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.player-select-item:hover {
    background-color: #e5e5ea;
}

.player-select-item .player-chip-photo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    margin-right: 1rem;
}

.player-select-item .player-chip-name {
    color: #1c1c1e;
    font-weight: 600;
    text-shadow: none;
}
