/* ====== Light and Dark Mode ====== */
:root {
    --bg:           rgba(245, 248, 250, 1);
    --surface:      white;
    --text:         rgba(40, 40, 40, 1);
    --text-muted:   rgba(60, 60, 60, 1);
    --text-light:   rgba(80, 80, 80, 1);
    --border:       rgba(230, 230, 230, 1);
    --red:          rgba(220, 38, 38, 1);
    --red-dark:     rgba(185, 28, 28, 1);
    --red-light:    rgba(239, 68, 68, 1);
    --red-faint:    rgba(220, 38, 38, 0.1);
    --red-faint2:   rgba(220, 38, 38, 0.2);
    --red-faint3:   rgba(220, 38, 38, 0.3);
    --nav-bg:       rgba(40, 40, 40, 1);
    --footer-bg:    rgba(40, 40, 40, 1);
    --shadow-sm:    rgba(0, 0, 0, 0.06);
    --shadow:       rgba(0, 0, 0, 0.1);
    --shadow-md:    rgba(0, 0, 0, 0.15);
    --shadow-lg:    rgba(0, 0, 0, 0.4);
    --input-color:  rgba(40, 40, 40, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:           rgba(18, 18, 18, 1);
        --surface:      rgba(30, 30, 30, 1);
        --text:         rgba(235, 235, 235, 1);
        --text-muted:   rgba(200, 200, 200, 1);
        --text-light:   rgba(170, 170, 170, 1);
        --border:       rgba(60, 60, 60, 1);
        --red:          rgba(220, 38, 38, 1);
        --red-dark:     rgba(185, 28, 28, 1);
        --red-light:    rgba(239, 68, 68, 1);
        --red-faint:    rgba(220, 38, 38, 0.15);
        --red-faint2:   rgba(220, 38, 38, 0.25);
        --red-faint3:   rgba(220, 38, 38, 0.35);
        --nav-bg:       rgba(15, 15, 15, 1);
        --footer-bg:    rgba(15, 15, 15, 1);
        --shadow-sm:    rgba(0, 0, 0, 0.2);
        --shadow:       rgba(0, 0, 0, 0.4);
        --shadow-md:    rgba(0, 0, 0, 0.5);
        --shadow-lg:    rgba(0, 0, 0, 0.7);
        --input-color:  rgba(235, 235, 235, 1);
    }
}

/* ====== General CSS ====== */
* {
    font-family: system-ui, -apple-system, sans-serif;
    margin: 0;
    box-sizing: border-box;
}

p {
    font-size: 1.1rem;
    line-height: 1.6;
}

img {
    max-width: 100%;
    display: block;
}

/* ====== top style ====== */
/* Header style */
header {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-light) 100%);
    padding: 1.5em;
    display: grid;
    grid-template-columns: auto 1fr auto;  /* add auto for the buttons column */
    align-items: center;
    gap: 1.5em;
    box-shadow: 0 4px 6px var(--shadow);
}

header h1 {
    color: white;
    text-shadow: 2px 2px 4px var(--shadow-lg);
    font-size: 2rem;
}

.icon {
    max-width: 80px;
    height: auto;
    filter: drop-shadow(2px 2px 4px var(--shadow-lg));
}

/* Header Auth Buttons */
.header-auth {
    display: flex;
    gap: 0.75em;
    align-items: center;
}

.basic-btn {
    background-color: var(--surface);
    color: var(--text);
    text-decoration: none;
    padding: 0.5em 1.2em;
    margin: 2em;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 2px solid rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.basic-btn:hover {
    background: var(--red);
    color: white;
}

.login-btn, .register-btn, .account-btn, .logout-btn {
    color: white;
    text-decoration: none;
    padding: 0.5em 1.2em;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 2px solid rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.login-btn:hover, .register-btn:hover, .account-btn:hover, .logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: white;
}

/* Navigation */
nav {
    background-color: var(--nav-bg);
    padding: 0;
    display: flex;
    justify-content: center;
    box-shadow: 0 2px 4px var(--shadow);
}

nav a {
    color: white;
    text-decoration: none;
    padding: 1.2em 2em;
    display: inline-block;
    transition: all 0.3s ease;
    font-weight: 500;
    border-bottom: 3px solid transparent;
}

nav a:hover {
    background-color: var(--red-faint2);
    border-bottom-color: var(--red);
}

nav a.activePage {
    background-color: var(--red);
    border-bottom-color: var(--red-dark);
    color: white;
}

/* ====== Body style ====== */
body {
    background-color: var(--bg);
    text-align: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    padding: 2em;
    min-height: 30em;
    flex: 1;
}

main h1 {
    color: var(--text);
    margin-bottom: 1.5em;
    font-size: 2.5rem;
}

/* About Section */
.about-section {
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
    background: var(--surface);
    padding: 2.5em;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow);
}

.about-section h2 {
    color: var(--red);
    margin-top: 1.5em;
    margin-bottom: 0.8em;
    font-size: 1.8rem;
}

.about-section h2:first-child {
    margin-top: 0;
}

.about-section p {
    color: var(--text-muted);
    margin-bottom: 1em;
}

/* Sort Controls */
.sort-controls {
    margin: 2em 0;
    padding: 1.2em;
    background: var(--surface);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-sm);
}

.sort-controls span {
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 1em;
}

.sort-controls a {
    display: inline-block;
    padding: 0.6em 1.2em;
    margin: 0.3em;
    background-color: var(--border);
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sort-controls a:hover {
    background-color: var(--red-faint3);
    transform: translateY(-2px);
}

.sort-controls a.active-sort {
    background-color: var(--red);
    color: white;
}

/* Players Grid */
.players-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2em;
    margin-top: 2em;
}

/* Player Card */
.player-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s ease;
    text-align: left;
}

.player-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 24px var(--shadow-md);
}

.player-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.player-image-container {
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--red-faint3) 0%, var(--red-faint2) 100%);
}

.player-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-info {
    padding: 1.5em;
}

.player-info h2 {
    color: var(--text);
    font-size: 1.4rem;
    margin-bottom: 0.8em;
}

.wins-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    color: white;
    padding: 0.8em 1.2em;
    border-radius: 8px;
    margin-bottom: 1em;
    box-shadow: 0 2px 8px var(--red-faint3);
}

.wins-number {
    font-size: 1.8rem;
    font-weight: bold;
    display: block;
    line-height: 1;
}

.wins-label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    opacity: 0.9;
}

.player-bio {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* News Feed */
.news-feed {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2em;
}

.event-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow);
    transition: all 0.3s ease;
    text-align: left;
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-md);
}

.event-card-header {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    padding: 1.2em 1.5em;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
}

.event-card-header h2 {
    color: white;
    font-size: 1.3rem;
    margin: 0;
}

.event-date {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.4em 0.9em;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
}

.event-card-body {
    padding: 1.5em;
    color: var(--text-muted);
    line-height: 1.7;
}

.event-card-header .new-badge {
    background: rgba(33, 77, 167, 0.9);
    color: white;
    padding: 0.5em 1em;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* Responsive Design for players sort */
@media (max-width: 1200px) {
    .players-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .players-grid {
        grid-template-columns: 1fr;
    }
    
    header {
        grid-template-columns: 1fr;
        text-align: center;
        justify-items: center;
    }
    
    .icon {
        max-width: 60px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    nav {
        flex-direction: column;
    }
    
    nav a {
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .sort-controls {
        font-size: 0.9rem;
    }
    
    .sort-controls a {
        display: block;
        margin: 0.5em 0;
    }
}

/* ====== Account pages ====== */
.profile-card {
    max-width: 85%;
    margin: 5em auto;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow);
    overflow: hidden;
    display: grid;
    grid-template-columns: 250px 1fr;
    text-align: left;
}

.profile-img {
    width: 250px;
    height: 100%;
    min-height: 300px;
    overflow: hidden;
    background: linear-gradient(135deg, var(--red-faint3) 0%, var(--red-faint2) 100%);
}

.profile-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-info {
    padding: 2em;
    display: flex;
    flex-direction: column;
    gap: 1.2em;
    justify-content: center;
}

.profile-name h2 {
    font-size: 2rem;
    color: var(--text);
    margin-bottom: 0.2em;
}

.profile-wins h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.3em;
}

.profile-wins .wins-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
}

.profile-about p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
}

.profile-date p {
    color: var(--text-light);
    font-size: 0.85rem;
}

.profile-edit {
    display: inline-block;
    margin-top: 2em;
    padding: 0.7em 1.8em;
    background: transparent;
    color: var(--red);
    border: 2px solid var(--red);
    border-radius: 6px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
}

.profile-edit:hover {
    background: var(--red);
    color: white;
}

.subscription-status {
    color: var(--red);
}

@media (max-width: 600px) {
    .profile-card {
        grid-template-columns: 1fr;
    }

    .profile-img {
        width: 100%;
        height: 250px;
    }
}

/* ===== FORM PAGES (login, register, edit profile) ===== */
.form-section {
    max-width: 480px;
    margin: 0 auto;
    margin-bottom: 1em;
    background: var(--surface);
    padding: 2.5em;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow);
    text-align: left;
}

.form-section fieldset {
    border: none;
    padding: 0;
    margin-bottom: 1.5em;
}

.form-section legend {
    display: none;
}

.form-section h2 {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid var(--border);
}

.form-section .txt {
    display: flex;
    flex-direction: column;
    gap: 0.4em;
    margin-bottom: 1em;
}

.form-section label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-section input[type=text],
.form-section input[type=email],
.form-section input[type=password],
.form-section textarea {
    width: 100%;
    padding: 0.7em 1em;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    background: var(--bg);
    color: var(--input-color);
    transition: border-color 0.2s ease;
    margin-bottom: 0;
}

.form-section input[type=text]:focus,
.form-section input[type=email]:focus,
.form-section input[type=password]:focus,
.form-section textarea:focus {
    outline: none;
    border-color: var(--red);
}

.form-section input[type=submit] {
    width: 100%;
    padding: 0.8em;
    background: var(--red);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
    grid-column: unset;
    margin-top: 0.5em;
}

.form-section input[type=submit]:hover {
    background: var(--red-dark);
}

.form-section .submit fieldset {
    margin-bottom: 0;
}
/* ====== Form ====== */
/*
form {
    display: grid;
    grid-template-columns: auto auto;
    justify-content: center;
    row-gap: 1em;
    column-gap: 1em;
}

input {
    margin-bottom: 1em;
    padding: 0.5em;
    color: var(--input-color);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
}

textarea {
    color: var(--input-color);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5em;
}

input[type=submit] {
    grid-column: span 2;
    border-radius: 0.5em;
    background-color: var(--red);
    color: white;
    font-size: large;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

input[type=submit]:hover {
    background-color: var(--red-dark);
}

input[type=number] {
    max-width: 3em;
    max-height: 1em;
}

.form-section {
    max-width: 600px;
    margin: 0 auto;
    background: var(--surface);
    padding: 2.5em;
    border-radius: 12px;
    box-shadow: 0 4px 12px var(--shadow);
    text-align: left;
}

.form-error {
    background: var(--red-faint);
    color: var(--red-dark);
    border: 1px solid var(--red-faint3);
    padding: 0.8em 1.2em;
    border-radius: 8px;
    margin-bottom: 1.5em;
    font-weight: 500;
}
*/
.form-success {
    background: rgba(34, 197, 94, 0.1);
    color: rgba(21, 128, 57, 1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    padding: 0.8em 1.2em;
    border-radius: 8px;
    margin-bottom: 1.5em;
    font-weight: 500;
}

/* ====== Admin Score Update Page ====== */
.score-update-table {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    border-collapse: separate;
    border-spacing: 0 0.5em; /* Creates a "card" look between rows */
}

.score-update-table th {
    padding: 1em;
    color: var(--text-light);
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 1px;
    text-align: left;
}

.score-update-table td {
    background-color: var(--surface);
    padding: 1.2em 1em;
    color: var(--text);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* Rounded corners for the row "cards" */
.score-update-table td:first-child {
    border-left: 1px solid var(--border);
    border-radius: 8px 0 0 8px;
}
.score-update-table td:last-child {
    border-right: 1px solid var(--border);
    border-radius: 0 8px 8px 0;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .score-update-table, 
    .score-update-table thead, 
    .score-update-table tbody, 
    .score-update-table th, 
    .score-update-table td, 
    .score-update-table tr {
        display: block; /* Stack everything vertically */
    }

    .score-update-table thead {
        display: none; /* Hide headers on mobile */
    }

    .score-update-table tr {
        margin-bottom: 1.5em;
        box-shadow: var(--shadow-md);
        border-radius: 12px;
        overflow: hidden;
    }

    .score-update-table td {
        border: none;
        border-radius: 0 !important;
        padding: 0.8em 1.5em;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Player Name Styling on Mobile */
    .score-update-table td:first-child {
        background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
        color: white;
        font-weight: bold;
        font-size: 1.1rem;
    }

    /* Add labels for the data using CSS since we hid the table headers */
    .score-update-table td:nth-child(2)::before {
        content: "Current Wins:";
        font-weight: 600;
        color: var(--text-light);
    }
    
    .score-update-table td:nth-child(3)::before {
        content: "Update To:";
        font-weight: 600;
        color: var(--text-light);
    }

    /* Make the input big enough for thumbs */
    .score-update-table input[type=number] {
        width: 80px !important;
        height: 45px;
        font-size: 1.2rem;
        text-align: center;
    }
}

/* Admin Button Styling */
.btn-primary {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    color: white;
    padding: 0.8em 2em;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 4px 6px var(--shadow);
}

.btn-secondary {
    display: inline-block;
    margin-left: 10px;
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
}

.btn-primary:active {
    transform: scale(0.95);
}

/* ====== Footer ====== */
footer {
    position: relative; /* This is the "anchor" for the secret button */
    background-color: var(--footer-bg); 
    color: white;
    padding: 1.5em;
    margin-top: auto;
}

/* The secret button styling */
.secret-btn {
    position: absolute;
    bottom: 5px;
    right: 10px;
    
    /* Make it "secret" by matching the background color */
    color: var(--footer-bg) !important; 
    font-size: 0.6rem;
    text-decoration: none;
    cursor: default;
    transition: color 0.3s ease;
}

/* Only show it when you know exactly where to hover */
.secret-btn:hover {
    color: var(--red-light) !important; 
    cursor: pointer;
}

footer a {
    color: var(--red-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

footer a:hover {
    color: rgba(252, 129, 129, 1);
}