/* General Reset & Base Styles */
body {
    font-family: 'Open Sans', sans-serif;
    background-color: #f0f2f5;
    margin: 0;
    padding: 0;
    color: #333;
    line-height: 1.6;
}

.app-container {
    max-width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

/* Header */
.app-header {
    background-color: #2c3e50; /* Dark blue-grey */
    color: #ecf0f1; /* Light grey text */
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.app-header .logo {
    display: flex;
    align-items: center;
}

.app-header .logo i {
    font-size: 2em;
    margin-right: 10px;
    color: #3498db; /* Brighter blue for icon */
}

.app-header h1 {
    font-family: 'Roboto', sans-serif;
    font-weight: 700;
    font-size: 1.8em;
    margin: 0;
}

.app-header .admin-nav a {
    color: #ecf0f1;
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.9em;
    transition: color 0.3s ease;
}

.app-header .admin-nav a:hover {
    color: #3498db;
}

.admin-settings-link i {
    margin-right: 5px;
}

/* Main Wrapper (for sidebar layout) */
.main-wrapper {
    display: flex;
    flex-grow: 1;
    padding: 20px;
}

/* Main Content Area */
.app-main-content {
    flex-grow: 1;
    /* padding: 20px; */ /* Padding now on main-wrapper */
}

/* Sidebar */
.app-sidebar {
    width: 300px;
    margin-left: 20px;
    flex-shrink: 0;
}

.sidebar-card h3 {
    font-family: 'Roboto', sans-serif;
    font-size: 1.2em;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.sidebar-card h3 i {
    margin-right: 8px;
    color: #3498db;
}

.overview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.95em;
}

.count-badge {
    background-color: #3498db;
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9em;
}

.no-players-message {
    text-align: center;
    padding: 20px 0;
    color: #7f8c8d;
}

.no-players-message .icon-large {
    font-size: 3em;
    margin-bottom: 10px;
    color: #bdc3c7;
}

.admin-settings-sidebar-link {
    display: block;
    background-color: #e9ecef;
    color: #2c3e50;
    text-decoration: none;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    margin-top: 15px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}
.admin-settings-sidebar-link i {
    margin-right: 5px;
}
.admin-settings-sidebar-link:hover {
    background-color: #ced4da;
}


/* Tabs */
.tabs {
    display: flex;
    margin-bottom: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 5px;
}

.tab-button {
    background-color: transparent;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    font-family: 'Roboto', sans-serif;
    font-size: 1em;
    font-weight: 500;
    color: #555;
    transition: all 0.3s ease;
    border-radius: 6px;
    margin-right: 5px;
}

.tab-button i {
    margin-right: 8px;
}

.tab-button:hover {
    background-color: #f0f2f5;
    color: #3498db;
}

.tab-button.active {
    background-color: #3498db;
    color: white;
    box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.content-header {
    margin-bottom: 20px;
}

.content-header h2 {
    font-family: 'Roboto', sans-serif;
    font-size: 1.6em;
    color: #2c3e50;
    margin: 0;
}

.content-header h2 i {
    margin-right: 10px;
    color: #3498db;
}

/* Player Registration Form Specifics */
#registration-form .form-section {
    margin-bottom: 25px;
    padding: 25px;
}

#registration-form h3 {
    font-family: 'Roboto', sans-serif;
    font-size: 1.3em;
    color: #3498db;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

#registration-form h3 i {
    margin-right: 8px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.95em;
    color: #555;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px; /* Prevents iOS auto-zoom on focus */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

/* Player Info Grid - for desktop single row */
.player-info-section .player-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* For larger screens, try to force 3 columns */
@media (min-width: 992px) {
    .player-info-section .player-info-grid {
        grid-template-columns: 1fr 1fr 1fr;
    }
    .player-name-group { grid-column: span 1; }
    .birth-year-group { grid-column: span 1; }
    .games-per-day-group { grid-column: span 1; }
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

/* Position Selector Enhancements */
.position-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px; /* Add some space below the selectors */
}

.position-box {
    background-color: #f0f2f5;
    border: 2px solid #e0e0e0;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.3s ease;
    min-width: 100px;
}

.position-box:hover {
    /* General hover can be removed if specific ones cover all cases or kept as a subtle default */
    /* border-color: #3498db; */
    /* background-color: #e9f5fd; */
}

.position-box.selected {
    /* General selected can be removed as specific ones cover all cases */
    /* border-color: #3498db; */
    /* background-color: #3498db; */
    /* color: white; */
    box-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Keep a consistent shadow for selected state */
}

.position-box .pos-abbr {
    font-weight: 700;
    font-size: 1.1em;
    display: block;
}

.position-box .pos-name {
    font-size: 0.8em;
    color: #555;
}

.position-box.selected .pos-name {
    color: #f0f2f5;
}

.position-box.disabled {
    background-color: #e0e0e0 !important; /* More prominent disabled state */
    cursor: not-allowed !important;
    opacity: 0.6;
    border-color: #ccc !important;
}

.position-box.disabled .pos-abbr,
.position-box.disabled .pos-name {
    color: #888 !important;
}

.preferred-positions .position-box.selected,
.secondary-positions .position-box.selected {
    border-width: 3px; /* Make selection more obvious */
    box-shadow: 0 0 8px rgba(0,0,0,0.3);
    transform: translateY(-2px);
}

/* Ensure labels for new selectors are clear */
.form-group > label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500; /* Make labels slightly bolder */
    color: var(--text-color-dark);
}

/* Style for the hidden inputs (though they are hidden, good practice) */
#preferredPosition,
#secondaryPosition {
    display: none;
}

/* Registration form specific adjustments if needed */
#registration-form .form-section.card {
    margin-bottom: 25px; /* Ensure adequate spacing between sections */
}

#registration-form h3 {
    margin-bottom: 1.2rem; /* Standardize heading margin */
}

.submit-button {
    background-color: #2ecc71; /* Green */
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.submit-button i {
    margin-right: 8px;
}

.submit-button:hover {
    background-color: #27ae60;
    transform: translateY(-1px);
}

.submit-button.secondary-button {
    background-color: #e67e22; /* Orange for secondary actions */
}
.submit-button.secondary-button:hover {
    background-color: #d35400;
}

/* Registration Status Banner on Player Reg Tab */
.registration-status-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-left: 5px solid #3498db; /* Default blue, will change with status */
}

.next-game-date {
    font-size: 1em;
    color: #555;
}
.next-game-date i {
    margin-right: 8px;
    color: #3498db;
}
.next-game-date strong.game-date {
    font-weight: 600;
    color: #2c3e50;
}

.registration-toggle-button {
    padding: 10px 20px;
    border-radius: 20px; /* More pill-shaped */
    font-weight: 500;
    font-size: 0.9em;
    color: white;
    display: flex;
    align-items: center;
    transition: background-color 0.3s ease;
}

.registration-toggle-button i {
    margin-right: 8px;
    font-size: 1.1em;
}

.registration-toggle-button.open {
    background-color: #2ecc71; /* Green */
}
.registration-status-banner.open-border {
    border-left-color: #2ecc71;
}

.registration-toggle-button.closed {
    background-color: #e74c3c; /* Red */
}
.registration-status-banner.closed-border {
    border-left-color: #e74c3c;
}

.registrations-closed-message.card {
    background-color: #fef5f5; /* Light red background */
    color: #c0392b; /* Darker red text */
    border-left: 5px solid #e74c3c; /* Red border */
    padding: 15px;
    text-align: center;
}

/* Generated Teams Tab */
#team-display-area .age-group-teams {
    margin-bottom: 25px;
}

#team-display-area h3 {
    font-family: 'Roboto', sans-serif;
    font-size: 1.4em;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

#team-display-area .team-card {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
}

#team-display-area .team-card h4 {
    font-size: 1.2em;
    color: #3498db;
    margin-top: 0;
    margin-bottom: 10px;
}

#team-display-area ul {
    list-style: none;
    padding-left: 0;
}

#team-display-area li {
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    font-size: 0.95em;
}

#team-display-area li:last-child {
    border-bottom: none;
}

#team-display-area strong.assigned-pos {
    color: #27ae60;
}

#team-display-area .remaining-players {
    margin-top: 15px;
    padding: 10px;
    background-color: #fff9e6;
    border: 1px solid #ffe082;
    border-radius: 4px;
}

#team-display-area .remaining-players h5 {
    color: #d35400;
    margin-top: 0;
    margin-bottom: 5px;
}

/* Dashboard Tab - New Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr; /* Main column takes full width */
    gap: 20px;
}

.dashboard-main-column {}
.dashboard-sidebar-column {
    /* This column is now effectively unused on the main dashboard. */
    /* If content is added back, adjust .dashboard-grid columns accordingly. */
}

.stats-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    padding: 20px;
}

.stat-card .stat-icon {
    font-size: 2.5em;
    color: #3498db;
    margin-right: 20px;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 2.2em;
    font-weight: 700;
    color: #2c3e50;
}

.stat-card .stat-label {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 2px;
}

/* Specific Stat Card Icons (Optional: if you want different colors) */
.stat-card:nth-child(1) .stat-icon { color: #3498db; } /* Total Players - Blue */
.stat-card:nth-child(2) .stat-icon { color: #f1c40f; } /* Teams Generated - Yellow */
.stat-card:nth-child(3) .stat-icon { color: #9b59b6; } /* Age Groups - Purple */

.dashboard-card {
    /* Uses generic .card styles */
}

.dashboard-card h3, .dashboard-card h4 {
    font-family: 'Roboto', sans-serif;
    margin-top: 0;
    margin-bottom: 15px;
    color: #2c3e50;
}
.dashboard-card h3 i, .dashboard-card h4 i {
    margin-right: 8px;
    color: #3498db;
}

.no-data-placeholder {
    color: #95a5a6;
    text-align: center;
    padding: 20px 0;
}

/* Position Preferences Circles */
.position-preferences-card h3 {
    margin-bottom: 20px;
}

.position-circles-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 20px;
}

.position-circle-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 90px; /* Ensure some minimum width */
}

.position-circle-item .circle-value {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    font-weight: 700;
    color: #555;
    margin-bottom: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.position-circle-item .circle-label {
    font-size: 0.9em;
    font-weight: 500;
    color: #555;
}

/* Position Circle Colors for Dashboard - Updated */
.position-circle-item.light-green-box .circle-value {
    background-color: #d9f7e6; /* Light Green */
    color: #1e8e3e; /* Darker green text for better contrast on light green */
}
.position-circle-item.light-yellow-box .circle-value {
    background-color: #fff9c4; /* Light Yellow */
    color: #c77c00; /* Darker yellow/orange text for better contrast on light yellow */
}
.position-circle-item.light-red-box .circle-value {
    background-color: #ffebee; /* Light Red/Pink */
    color: #b71c1c; /* Darker red text for better contrast on light red */
}
.position-circle-item.default-box .circle-value {
    background-color: #f0f2f5; /* Default greyish */
    color: #333; /* Standard dark text */
}

/* Remove old specific dashboard color classes if they exist and are not used elsewhere */
/* .position-circle-item.blue .circle-value   { background-color: #3498db; } */
/* .position-circle-item.yellow .circle-value { background-color: #f1c40f; } */
/* .position-circle-item.green .circle-value  { background-color: #2ecc71; } */
/* .position-circle-item.grey .circle-value   { background-color: #95a5a6; } */

/* Quick Actions */
.quick-action-button {
    display: block;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: opacity 0.3s ease, transform 0.2s ease;
    color: white;
}

.quick-action-button i {
    margin-right: 8px;
}

.quick-action-button:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.quick-action-button.blue   { background-color: #3498db; }
.quick-action-button.green  { background-color: #2ecc71; }
.quick-action-button.yellow { background-color: #f1c40f; }
.quick-action-button.grey   { background-color: #bdc3c7; color: #7f8c8d; cursor: not-allowed; }
.quick-action-button.grey:hover { opacity: 1; transform: none; }

/* General Button Style (Moved from admin_settings.html) */
.button-style {
    background-color: #3498db; /* Default blue */
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
    margin-right: 5px; /* Adjusted margin for general use */
    text-decoration: none; /* Ensure links styled as buttons don't have underlines */
    display: inline-block; /* Proper alignment and sizing */
    text-align: center;
    vertical-align: middle;
}
.button-style:hover {
    background-color: #2980b9; /* Darker blue */
}
.button-style.red { background-color: #e74c3c; }
.button-style.red:hover { background-color: #c0392b; }
.button-style.green { background-color: #2ecc71; }
.button-style.green:hover { background-color: #27ae60; }
.button-style.yellow { background-color: #f1c40f; color: #333; } /* Ensure good contrast for yellow */
.button-style.yellow:hover { background-color: #e67e22; }
.button-style.grey { background-color: #bdc3c7; color: #7f8c8d; } /* For disabled-like appearance */
.button-style.grey:hover { background-color: #95a5a6; }

/* Icon-only button adjustments */
.button-icon-only {
    padding: 8px 10px; /* Reduced padding for a tighter fit */
    font-size: 0.9em; /* Slightly smaller font if text were present, affects icon scaling a bit */
    line-height: 1.2; /* Adjust line height for icon centering */
}
.button-icon-only i {
    margin-right: 0; /* No margin if it's just an icon */
}

/* New style for inactive, clickable grey buttons */
.button-style.inactive-grey {
    background-color: #e0e0e0; /* Light grey */
    color: #555; /* Darker text for readability */
    border: 1px solid #ccc;
}
.button-style.inactive-grey:hover {
    background-color: #d5d5d5; /* Slightly darker on hover */
    border-color: #bbb;
}

/* System Status */
.system-status-card .status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.9em;
    border-bottom: 1px solid #f0f2f5;
}
.system-status-card .status-item:last-child {
    border-bottom: none;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    color: white;
}

.status-badge.online, .status-badge.active  { background-color: #2ecc71; } /* Green */
.status-badge.offline { background-color: #e74c3c; } /* Red */
.status-badge.ready   { background-color: #f1c40f; color: #333; } /* Yellow */

/* Footer */
footer {
    background-color: #34495e; /* Darker blue-grey */
    color: #bdc3c7; /* Lighter grey text */
    text-align: center;
    padding: 15px;
    font-size: 0.9em;
    margin-top: auto; /* Pushes footer to bottom if content is short */
}

/* Flash Messages */
#flash-messages-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 300px;
    display: none; /* Hidden by default, JS will show */
}

.flash {
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 6px;
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    opacity: 1; /* JS handles fade out */
}

.flash.success { background-color: #2ecc71; }
.flash.warning { background-color: #f39c12; }
.flash.danger  { background-color: #e74c3c; }
.flash.info    { background-color: #3498db; }

/* ==============================================
   RESPONSIVE & MOBILE-FIRST STYLES
   ============================================== */

/* Hamburger Menu Button (hidden on desktop) */
.hamburger-menu {
    display: none;
    background: none;
    border: none;
    color: #ecf0f1;
    font-size: 1.5em;
    cursor: pointer;
    padding: 10px;
    min-width: 44px;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    line-height: 1;
    align-items: center;
    justify-content: center;
}

/* Table responsive wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ---- Desktop large (max-width: 1200px) ---- */
@media (max-width: 1200px) {
    .app-sidebar {
        width: 260px;
    }
}

/* ---- Tablet (max-width: 992px) ---- */
@media (max-width: 992px) {
    .main-wrapper {
        flex-direction: column;
        padding: 15px;
    }
    .app-sidebar {
        width: 100%;
        margin-left: 0;
        margin-top: 20px;
    }
    .app-main-content {
        order: 1;
    }
    .app-sidebar {
        order: 2;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-sidebar-column {
        margin-top: 20px;
    }
    .stats-cards-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .position-grid {
        grid-template-columns: 1fr;
    }
}

/* ---- Mobile landscape & small tablets (max-width: 768px) ---- */
@media (max-width: 768px) {
    /* Hamburger menu visibility */
    .hamburger-menu {
        display: flex;
    }

    /* Header: keep row layout with hamburger */
    .app-header {
        flex-wrap: wrap;
        padding: 10px 15px;
    }
    .app-header .logo {
        flex: 1;
    }

    /* Nav: hidden by default, toggled by hamburger */
    .app-header .admin-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        padding-top: 10px;
        margin-top: 10px;
        margin-left: 0;
        border-top: 1px solid rgba(255,255,255,0.15);
    }
    .app-header .admin-nav.active {
        display: flex;
    }
    .app-header .admin-nav a,
    .app-header .admin-nav span {
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 12px 0;
        border-bottom: 1px solid rgba(255,255,255,0.08);
        font-size: 1em !important;
        display: block;
    }

    /* Tabs: horizontal scroll instead of stacking */
    .tabs {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding: 5px;
        gap: 5px;
    }
    .tabs::-webkit-scrollbar {
        display: none;
    }
    .tab-button {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 10px 16px;
        font-size: 0.9em;
        margin-right: 0;
        margin-bottom: 0;
    }

    /* Form adjustments */
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .form-row .form-group {
        margin-bottom: 15px;
    }
    .player-info-section .player-info-grid {
        grid-template-columns: 1fr;
    }

    /* Position selector: 3-column grid for touch */
    .position-selector {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    .position-box {
        min-width: unset;
        padding: 12px 8px;
        min-height: 50px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    /* Stats cards: single column */
    .stats-cards-row {
        grid-template-columns: 1fr;
    }

    /* Position circles: 4 per row */
    .position-circles-container {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        justify-items: center;
    }

    /* Buttons: full width */
    .submit-button {
        width: 100%;
        text-align: center;
        display: flex;
        justify-content: center;
        padding: 14px 20px;
    }
    #generate-teams-btn,
    #admin-generate-teams-btn {
        width: 100%;
        text-align: center;
        display: block;
    }

    /* Flash messages: full width */
    #flash-messages-container {
        width: calc(100% - 20px) !important;
        left: 10px !important;
        right: 10px !important;
        top: 10px !important;
    }

    /* Registration status banner: stack */
    .registration-status-banner {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    /* Content header */
    .content-header h2 {
        font-size: 1.3em;
    }

    /* Card padding reduction */
    .card {
        padding: 15px;
    }
    #registration-form .form-section {
        padding: 15px;
    }

    /* Filter bars */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .filter-bar form {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .filter-bar select {
        width: 100%;
        min-height: 44px;
    }

    /* Admin tables */
    .admin-main-content th,
    .admin-main-content td {
        padding: 8px 6px;
        font-size: 0.85em;
    }

    /* Team card position grid */
    .position-grid {
        grid-template-columns: 1fr;
    }
    .position-slot {
        flex-wrap: wrap;
        gap: 4px;
    }
    .position-slot .pref-info {
        width: 100%;
        font-size: 0.75em;
    }

    /* Team actions: stack */
    .team-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .team-actions form {
        width: 100%;
    }
    .team-actions .button-style {
        width: 100%;
        text-align: center;
        display: flex;
        justify-content: center;
    }

    /* Add player / reassign forms */
    .add-player-form,
    .reassign-form.active {
        flex-direction: column;
        align-items: stretch;
    }
    .add-player-form select,
    .reassign-form select {
        width: 100%;
        min-height: 44px;
    }

    /* Sidebar quick links */
    .quick-action-button {
        padding: 14px 15px;
        font-size: 1em;
        min-height: 44px;
    }

    /* Login page */
    #login-form-section {
        margin-top: 0 !important;
    }

    /* Admin edit pages: inline flex containers stack on mobile */
    .admin-edit-flex-row {
        flex-direction: column !important;
        gap: 0 !important;
    }
    .admin-edit-flex-row .form-group {
        min-width: unset !important;
        flex: unset !important;
    }

    /* Filter bar actions (team management) */
    .filter-bar-actions {
        margin-left: 0 !important;
        width: 100%;
        flex-direction: column;
    }
    .filter-bar-actions .button-style {
        width: 100%;
        text-align: center;
        display: flex;
        justify-content: center;
        min-height: 44px;
    }
    .filter-bar-actions form {
        width: 100%;
    }
    .filter-bar-actions form .button-style {
        width: 100%;
    }

    /* Registration status buttons in admin */
    .registration-status-buttons {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    .registration-status-buttons .button-style {
        flex: 1;
        min-width: 120px;
        text-align: center;
        display: flex;
        justify-content: center;
        min-height: 44px;
    }
}

/* ---- Phone portrait (max-width: 480px) ---- */
@media (max-width: 480px) {
    .app-header .logo i { font-size: 1.5em; }
    .app-header h1 { font-size: 1.2em; }

    body { font-size: 15px; }

    .main-wrapper { padding: 10px; }

    .card { padding: 12px; }
    #registration-form .form-section { padding: 12px; }

    .content-header h2 { font-size: 1.15em; }
    #registration-form h3 { font-size: 1.05em; }

    /* Position selector: 2 columns on small phones */
    .position-selector {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Position circles: 3 per row */
    .position-circles-container {
        grid-template-columns: repeat(3, 1fr);
    }
    .position-circle-item .circle-value {
        width: 52px;
        height: 52px;
        font-size: 1.3em;
    }
    .position-circle-item .circle-label {
        font-size: 0.78em;
    }

    /* Stat cards: compact row */
    .stat-card {
        padding: 12px;
    }
    .stat-card .stat-icon {
        font-size: 1.8em;
        margin-right: 12px;
    }
    .stat-card .stat-value {
        font-size: 1.8em;
    }
    .stat-card .stat-label {
        font-size: 0.82em;
    }

    /* Buttons */
    .submit-button { font-size: 1em; padding: 14px 20px; }
    .button-style { padding: 10px 14px; font-size: 0.9em; min-height: 44px; }

    /* Team management */
    .team-card-admin { padding: 12px; }
    .team-badges { flex-wrap: wrap; }

    /* Reduce spacing */
    .form-group { margin-bottom: 12px; }
    .dashboard-grid { gap: 10px; }
    .stats-cards-row { gap: 10px; }

    /* Footer */
    footer { font-size: 0.8em; padding: 12px; }

    /* Tabs: smaller on phones */
    .tab-button {
        padding: 8px 12px;
        font-size: 0.82em;
    }
    .tab-button i {
        margin-right: 4px;
    }
}

/* New Preferred Position Colors for Registration Form */
.position-box.light-green-box {
    background-color: #d9f7e6; /* Light Green */
    border-color: #a3e9c0;
}
.position-box.light-green-box:hover {
    background-color: #c3f3d9;
    border-color: #8fdcaf;
}
.position-box.light-green-box.selected {
    background-color: #2ecc71; /* Vibrant Green for selected */
    border-color: #27ae60;
    color: white;
}
.position-box.light-green-box.selected .pos-name {
    color: #e8f5e9;
}

.position-box.light-yellow-box {
    background-color: #fff9c4; /* Light Yellow */
    border-color: #fff176;
}
.position-box.light-yellow-box:hover {
    background-color: #fff5b0;
    border-color: #ffeb3b;
}
.position-box.light-yellow-box.selected {
    background-color: #f1c40f; /* Vibrant Yellow for selected */
    border-color: #f39c12;
    color: #333; /* Darker text for yellow selected */
}
.position-box.light-yellow-box.selected .pos-name {
    color: #555;
}

.position-box.light-red-box {
    background-color: #ffebee; /* Light Red/Pink */
    border-color: #ffcdd2;
}
.position-box.light-red-box:hover {
    background-color: #ffdde0;
    border-color: #ef9a9a;
}
.position-box.light-red-box.selected {
    background-color: #e74c3c; /* Vibrant Red for selected */
    border-color: #c0392b;
    color: white;
}
.position-box.light-red-box.selected .pos-name {
    color: #ffebee;
}

/* Default box style if color not found (fallback) */
.position-box.default-box {
    background-color: #f0f2f5;
    border-color: #e0e0e0;
}
.position-box.default-box:hover {
    border-color: #3498db;
    background-color: #e9f5fd;
}
.position-box.default-box.selected {
    border-color: #3498db;
    background-color: #3498db;
    color: white;
}
.position-box.default-box.selected .pos-name {
    color: #f0f2f5;
}

/* Secondary Position Dull Box Style */
.position-box.secondary-dull-box {
    background-color: #e9ecef; /* Light grey - dull */
    border-color: #ced4da;
}
.position-box.secondary-dull-box:hover {
    background-color: #dee2e6;
    border-color: #adb5bd;
}
.position-box.secondary-dull-box.selected {
    background-color: #6c757d; /* Darker grey for selected secondary */
    border-color: #5a6268;
    color: white;
}
.position-box.secondary-dull-box.selected .pos-name {
    color: #e9ecef;
}

/* Admin Page Specific Styles */
.admin-main-content .card h3 i, .admin-sidebar .card h4 i {
    margin-right: 10px; /* Increased margin slightly */
}

.admin-main-content .table-responsive {
    margin-top: 10px; /* Added margin above table */
}

.admin-sidebar .sidebar-section h4 {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    font-size: 1.1em; /* Slightly larger for sidebar section titles */
}

.admin-quick-links .quick-links-group {
    margin-bottom: 15px;
}

.admin-quick-links .quick-links-group h5 { /* This was for a previous design with subgroups */
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1em;
    color: #555;
    font-weight: 600;
}

/* Removed admin-quick-links specific .quick-action-button style block as general one should suffice */
/* .admin-quick-links .quick-action-button { ... } */

/* Ensure settings form elements are well-spaced and styled */
.settings-form .form-section {
    padding: 15px;
    background-color: #fdfdfd; /* Slightly off-white background for form sections */
    border: 1px solid #f0f0f0;
    border-radius: 5px; /* Rounded corners for form sections */
    margin-bottom: 20px;
}

.settings-form .form-section:last-of-type {
    margin-bottom: 0; /* No bottom margin for the last form section before buttons */
}

.settings-form label {
    font-weight: 500;
    margin-bottom: 8px; /* More space below labels */
    display: block;
}

/* Ensure text/password inputs in .settings-form are full width like other .form-group inputs */
.settings-form .form-group input[type="text"],
.settings-form .form-group input[type="password"] {
    width: 100%;
    padding: 12px; /* Match general .form-group input padding */
    border: 1px solid #ddd; /* Match general .form-form-group input border */
    border-radius: 6px; /* Match general .form-group input radius */
    box-sizing: border-box;
    font-size: 1em;
}

.settings-form input[type="date"],
.settings-form select {
    width: 100%;
    padding: 10px;
    font-size: 0.95em;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}

.settings-form .button-style {
    margin-top: 10px; /* Space above submit button */
}

/* Ensure footer is at the bottom */
body, .app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-wrapper {
    flex-grow: 1;
}


/* Apply a max-width for very large screens to keep content centered and readable */
@media (min-width: 1400px) {
    .app-container {
        max-width: 1500px;
    }
}