/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Bootstrap-like Card Component */
.card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Row and Column Bootstrap-like Grid */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.5rem;
    margin-left: -0.5rem;
}

.col-md-5 {
    flex: 0 0 41.666667%;
    padding-right: 0.5rem;
    padding-left: 0.5rem;
}

.justify-content-center {
    justify-content: center;
}

.text-center {
    text-align: center;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.w-100 {
    width: 100%;
}

/* Form Controls */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Button Styles */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 4px;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    cursor: pointer;
}

.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    color: #fff;
    background-color: #0056b3;
    border-color: #004085;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    color: #fff;
    background-color: #545b62;
    border-color: #4e555b;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    color: #fff;
    background-color: #c82333;
    border-color: #bd2130;
}

/* Header and Navigation */
header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

nav h1 {
    font-size: 1.5rem;
    margin: 0;
}

nav > ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
    margin: 0;
    padding: 0;
}

nav ul {
    list-style: none;
}

nav > a {
    color: white;
    text-decoration: none;
}

nav > ul > li > a {
    color: white;
    text-decoration: none;
    transition: color 0.3s;
}

nav > ul > li > a:hover {
    color: #3498db;
}

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

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

th {
    background-color: #34495e;
    color: white;
    font-weight: 600;
}

tr:hover {
    background-color: #f5f5f5;
}

/* Alert Styles */
.alert {
    padding: 0.75rem 1.25rem;
    margin-bottom: 1rem;
    border-radius: 4px;
    border: 1px solid transparent;
}

.alert-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}

.alert-error,
.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}

.alert-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 0;
    color: #666;
    border-top: 1px solid #ecf0f1;
    margin-top: 4rem;
}

/* Utility Classes */
.mb-0 {
    margin-bottom: 0;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.pt-3 {
    padding-top: 1rem;
}

.text-muted {
    color: #6c757d;
}

.text-danger {
    color: #dc3545;
}

.text-success {
    color: #28a745;
}

/* Responsive */
@media (max-width: 768px) {
    .col-md-5 {
        flex: 0 0 100%;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
    }

    nav > ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .container {
        padding: 0 1rem;
    }
}

.team-title a {
    color: #2c3e50;
    text-decoration: none;
}
/* Team Detail Page - Responsive Styles */
.team-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    gap: 1rem;
}

.team-header-info {
    flex: 1;
}

.team-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.team-detail-grid {
    display: grid;
    grid-template-columns: 1fr 3fr;
    gap: 1rem;
}

.team-sidebar {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.team-main-content {
    min-width: 0; /* Allows grid item to shrink below content size */
}

.standings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.standings-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Hide columns on smaller screens */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    table th,
    table td {
        padding: 0.5rem 0.4rem;
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    table th,
    table td {
        padding: 0.4rem 0.3rem;
        font-size: 0.72rem;
    }
}

@media (max-width: 992px) {
    .hide-tablet {
        display: none !important;
    }
}

/* Mobile responsive layout */
@media (max-width: 992px) {
    .team-detail-grid {
        grid-template-columns: 1fr;
    }
    
    .team-sidebar {
        order: 2; /* Move sidebar below main content on mobile */
    }
    
    .team-main-content {
        order: 1;
    }
}

@media (max-width: 768px) {
    .team-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .team-header-actions {
        justify-content: flex-start;
    }
    
    .team-header-actions .btn {
        flex: 1 1 auto;
        text-align: center;
        margin-left: 0 !important;
    }
    
    .standings-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .standings-header h3 {
        margin-bottom: 0.5rem;
    }
    
    .standings-actions {
        width: 100%;
    }
    
    .standings-actions .btn {
        flex: 1;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .team-header-actions {
        flex-direction: column;
    }
    
    .team-header-actions .btn {
        width: 100%;
    }
}

/* Admin List Page - Responsive Styles */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.admin-list-item {
    padding: 1rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.admin-info {
    flex: 1;
    min-width: 0; /* Allow text to wrap */
}

.admin-actions {
    flex-shrink: 0;
}

/* Mobile responsive layout for admin page */
@media (max-width: 992px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .page-header .btn {
        text-align: center;
    }
    
    .admin-list-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-actions {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .admin-actions .btn {
        width: 100%;
        text-align: center;
    }
}

/* Standings Page - Responsive Styles */
.filter-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Mobile responsive layout for filter form */
@media (max-width: 768px) {
    .filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
        justify-content: space-between;
    }
    
    .filter-group select,
    .filter-group input {
        flex: 1;
        max-width: 200px;
    }
    
    .filter-form .btn {
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group select,
    .filter-group input {
        max-width: 100%;
    }
}

/* Session Submit Page - Responsive Styles */
.session-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.player-scores-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.player-card {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.submit-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Tablet view - 2 columns for players */
@media (max-width: 992px) {
    .player-scores-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile view - single column */
@media (max-width: 768px) {
    .session-info-grid {
        grid-template-columns: 1fr;
    }
    
    .player-scores-grid {
        grid-template-columns: 1fr;
    }
    
    .player-card {
        padding: 1.5rem;
    }
}

/* Small mobile - stack buttons */
@media (max-width: 480px) {
    .submit-actions {
        flex-direction: column;
    }
    
    .submit-actions .btn {
        width: 100%;
    }
}

/* Sessions Page - Responsive Styles */
.session-card {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 1.5rem;
    background-color: #f9f9f9;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.session-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.scoring-formula-info {
    color: #666;
    font-style: italic;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
    flex-wrap: wrap;
}

/* Mobile responsive layout for sessions */
@media (max-width: 768px) {
    .session-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .session-header h3 {
        font-size: 1rem;
        word-break: break-all;
    }
    
    .session-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .session-card {
        padding: 1rem;
    }
    
    .scoring-formula-info {
        font-size: 0.8rem;
        line-height: 1.5;
    }
    
    .pagination-controls {
        gap: 0.25rem;
    }
    
    .pagination-controls .btn,
    .pagination-controls span {
        padding: 6px 8px !important;
        font-size: 0.8rem !important;
    }
}

@media (max-width: 480px) {
    .session-header h3 {
        font-size: 0.9rem;
    }
    
    .session-actions a.btn {
        font-size: 0.75rem !important;
        padding: 4px 8px !important;
        margin-left: 0 !important;
    }
    
    .scoring-formula-info {
        display: none; /* Hide complex formula on very small screens */
    }
}

/* Dropdown Styles for Export */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: white;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1000;
    right: 0;
    border-radius: 4px;
    margin-top: 5px;
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    transition: background-color 0.2s;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.dropdown-content a:first-of-type {
    border-top-left-radius: 4px;
    border-top-right-radius: 4px;
}

.dropdown-content a:last-of-type {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* OAuth / Social Login */
.social-login {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.social-login-button-wrap {
    display: flex;
    justify-content: center;
    width: 100%;
}

a.btn-social,
a.btn-social:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-width: 260px;
    max-width: 100%;
    padding: 0.7rem 1.25rem;
    border-radius: 4px;
    text-align: center;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.25;
    border: 1px solid transparent;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

a.btn-social:hover,
a.btn-social:focus,
a.btn-social:active {
    text-decoration: none;
}

.btn-social-icon {
    display: flex;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.btn-social-icon svg,
.btn-social-icon img {
    display: block;
    width: 100%;
    height: 100%;
}

.btn-social-label {
    flex: 0 1 auto;
}

a.btn-social-google,
a.btn-social-google:visited {
    background: #fff;
    color: #3c4043;
    border-color: #dadce0;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
}

a.btn-social-google:hover,
a.btn-social-google:focus,
a.btn-social-google:active {
    background: #f8f9fa;
    border-color: #d2e3fc;
    color: #3c4043;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.12);
}

a.btn-social-facebook,
a.btn-social-facebook:visited {
    background: #1877f2;
    color: #fff;
}

a.btn-social-facebook:hover,
a.btn-social-facebook:focus,
a.btn-social-facebook:active {
    background: #166fe0;
    color: #fff;
}

a.btn-social-x,
a.btn-social-x:visited {
    background: #000;
    color: #fff;
}

a.btn-social-x:hover,
a.btn-social-x:focus,
a.btn-social-x:active {
    background: #222;
    color: #fff;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: #999;
    font-size: 0.875rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #ddd;
}

.auth-divider span {
    padding: 0 1rem;
}

/* Legal pages */
.legal-page {
    max-width: 720px;
    margin: 2rem auto;
    background: white;
    padding: 2.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.legal-page h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.legal-page h2 {
    font-size: 1.15rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

.legal-page p,
.legal-page li {
    color: #444;
    margin-bottom: 0.75rem;
}

.legal-page ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.legal-meta {
    color: #999;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.legal-page a {
    color: #3498db;
}

footer a {
    color: #666;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Home page */
.home-hero {
    max-width: 760px;
    margin: 2rem auto 3rem;
    text-align: center;
}

.home-hero h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #2c3e50;
}

.home-tagline {
    font-size: 1.15rem;
    color: #555;
    margin-bottom: 1rem;
}

.home-description {
    color: #666;
    line-height: 1.7;
    margin-bottom: 2rem;
}

.home-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.home-features {
    max-width: 960px;
    margin: 0 auto 3rem;
}

.home-features h2 {
    text-align: center;
    font-size: 1.35rem;
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

.home-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.home-feature-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.home-feature-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.home-feature-card p {
    color: #666;
    font-size: 0.95rem;
    margin: 0;
}

.home-links {
    text-align: center;
    margin-bottom: 2rem;
}

.home-links a {
    color: #3498db;
    text-decoration: none;
}

.home-links a:hover {
    text-decoration: underline;
}

