/* ============ GLOBAL STYLES ============ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2ecc71;
    --secondary-color: #3498db;
    --danger-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --border-color: #bdc3c7;
    --text-color: #2c3e50;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ============ NAVBAR ============ */

.navbar {
    background-color: var(--dark-color);
    color: white;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    flex: 1;
}

.navbar-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px 8px;
    cursor: pointer;
}

.navbar-toggle-bar {
    display: block;
    width: 20px;
    height: 2px;
    background-color: white;
    border-radius: 999px;
}

.navbar-toggle-bar + .navbar-toggle-bar {
    margin-top: 4px;
}

.navbar-panel {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo {
    color: white;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: bold;
    display: block;
    padding: 15px 0;
    transition: color 0.3s;
}

.logo:hover {
    color: var(--primary-color);
}

.navbar-menu {
    display: flex;
    list-style: none;
    gap: 30px;
}

.navbar-menu a {
    color: white;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.navbar-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-left: 20px;
}

.username {
    color: white;
    font-weight: 500;
    font-size: 0.95em;
}

.logout-btn {
    color: white;
    text-decoration: none;
    padding: 8px 15px;
    background-color: var(--danger-color);
    border-radius: 4px;
    transition: background-color 0.3s;
    font-size: 0.9em;
}

.logout-btn:hover {
    background-color: #c0392b;
}

/* ============ FOOTER ============ */

.footer {
    background-color: var(--dark-color);
    color: white;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
}

/* ============ BUTTONS ============ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    min-height: 40px;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--success-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #2980b9;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9em;
    min-height: 40px;
}

.btn-action-uniform {
    height: 40px;
    min-height: 40px;
    padding: 10px 20px;
    line-height: 1.2;
}

/* ============ FORMS ============ */

.form-container {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    max-width: 500px;
    margin: 20px auto;
}

.edit-tournament-layout {
    max-width: 1100px;
    margin: 20px auto;
}

.form {
    display: flex;
    flex-direction: column;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(46, 204, 113, 0.3);
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 30px;
}

/* ============ TABLES ============ */

.table-container {
    overflow-x: auto;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background-color: var(--dark-color);
    color: white;
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--light-color);
}

.data-table tbody tr:hover {
    background-color: #f9f9f9;
}

.data-table.small th,
.data-table.small td {
    padding: 10px 12px;
    font-size: 0.95em;
}

.player-name a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
}

.player-name a:hover {
    text-decoration: underline;
}

.record {
    font-weight: 500;
    color: var(--primary-color);
}

.action-link {
    color: var(--secondary-color);
    text-decoration: none;
    cursor: pointer;
    margin-right: 10px;
    padding: 4px 8px;
    border-radius: 3px;
    transition: background-color 0.3s;
}

.action-link:hover {
    background-color: var(--light-color);
}

.action-link.danger {
    color: var(--danger-color);
}

.action-link.danger:hover {
    background-color: rgba(231, 76, 60, 0.1);
}

/* ============ ALERTS ============ */

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: inherit;
}

/* ============ BADGES ============ */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.badge-beginner {
    background-color: #d4edda;
    color: #155724;
}

.badge-intermediate {
    background-color: #cfe2ff;
    color: #084298;
}

.badge-advanced {
    background-color: #fff3cd;
    color: #664d03;
}

.badge-professional {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-family {
    background-color: #d1f2ff;
    color: #0c5aa5;
}

.badge-all {
    background-color: #e2e3e5;
    color: #383d41;
}

/* ============ DASHBOARD ============ */

.dashboard {
    animation: fadeIn 0.5s;
}

.dashboard h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: var(--dark-color);
}

.subtitle {
    font-size: 1.2em;
    color: #7f8c8d;
    margin-bottom: 40px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 3em;
}

.stat-content h2 {
    font-size: 2em;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-content p {
    color: #7f8c8d;
}

.quick-actions {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 40px;
}

.quick-actions h2 {
    margin-bottom: 20px;
    color: var(--dark-color);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.info-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.info-section h2 {
    margin-bottom: 20px;
    color: var(--dark-color);
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 10px 0;
    border-bottom: 1px solid var(--light-color);
}

.info-section li:last-child {
    border-bottom: none;
}

/* ============ PAGE HEADER ============ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.page-header h1 {
    color: var(--dark-color);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ============ EMPTY STATE ============ */

.empty-state {
    background: white;
    padding: 60px 20px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.empty-state p {
    font-size: 1.1em;
    color: #7f8c8d;
    margin-bottom: 20px;
}

/* ============ DETAIL PAGE ============ */

.detail-page {
    animation: fadeIn 0.5s;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.detail-grid-3col {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
    align-items: start;
}

.pool-section-inline {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid var(--light-color);
}

.pool-section-inline h3 {
    font-size: 1em;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.bracket-section-inline {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid var(--light-color);
}

.bracket-section-inline h3 {
    font-size: 1em;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.bracket-options {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.create-team-inline {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid var(--light-color);
}

.create-team-inline h3 {
    font-size: 1em;
    color: var(--dark-color);
    margin-bottom: 12px;
}

.detail-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.info-card {
    order: 1;
}

.add-players-card {
    order: 3;
}

.teams-card {
    order: 2;
}

.detail-card h2 {
    margin-bottom: 20px;
    color: var(--dark-color);
    border-bottom: 2px solid var(--light-color);
    padding-bottom: 10px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--light-color);
}

.info-row .label {
    font-weight: 600;
    color: var(--dark-color);
}

.info-row:last-child {
    border-bottom: none;
}

.stats-display {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: var(--light-color);
    border-radius: 4px;
}

.stat-value {
    font-size: 2em;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 5px;
}

.rating-display {
    background: var(--light-color);
    padding: 15px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rating-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

/* ============ TOURNAMENT GRID ============ */

.tournament-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.tournament-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s, box-shadow 0.3s;
}

.tournament-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.tournament-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 20px;
}

.tournament-header h2 {
    margin: 0;
    font-size: 1.15em;
    line-height: 1.25;
}

.tournament-header a {
    color: white;
    text-decoration: none;
}

.tournament-header a:hover {
    text-decoration: underline;
}

.tournament-details {
    padding: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--light-color);
}

.detail-row .label {
    font-weight: 600;
}

.detail-row:last-child {
    border-bottom: none;
}

.tournament-actions {
    padding: 0 20px 20px 20px;
    text-align: center;
}

/* Player tournament discovery cards: compact layout for My/Future sections */
.compact-tournament-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.compact-tournament-grid .tournament-card {
    border-radius: 6px;
}

.compact-tournament-grid .tournament-header {
    padding: 10px 12px;
}

.compact-tournament-grid .tournament-header h2 {
    font-size: 0.95em;
    line-height: 1.2;
}

.compact-tournament-grid .tournament-details {
    padding: 10px 12px;
}

.compact-tournament-grid .detail-row {
    padding: 4px 0;
    font-size: 0.88em;
}

.compact-tournament-grid .tournament-actions {
    padding: 0 12px 10px 12px;
}

.compact-tournament-grid .btn-small {
    padding: 4px 8px;
    font-size: 0.82em;
}

/* ============ ADD PLAYERS FORM ============ */

.add-players-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: var(--light-color);
    border-radius: 4px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============ ERROR PAGE ============ */

.error-page {
    text-align: center;
    padding: 60px 20px;
}

.error-page h1 {
    font-size: 2.5em;
    color: var(--danger-color);
    margin-bottom: 20px;
}

.error-message {
    font-size: 1.1em;
    color: #7f8c8d;
    margin-bottom: 30px;
}

.error-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ============ TEAM MANAGEMENT ============ */

.teams-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.team-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: linear-gradient(135deg, #e3f2fd, #f3e5f5);
    border-radius: 6px;
    border-left: 4px solid var(--primary-color);
}

.team-info {
    flex: 1;
}

.team-info strong {
    display: block;
    font-size: 1.1em;
    color: var(--dark-color);
    margin-bottom: 6px;
}

.team-players {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
}

.player-badge {
    background-color: white;
    padding: 3px 8px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-weight: 500;
}

.team-separator {
    color: var(--primary-color);
    font-weight: bold;
}

.team-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ============ RESPONSIVE DESIGN ============ */

@media (max-width: 768px) {
    .edit-tournament-layout {
        max-width: 500px;
        margin: 20px auto;
    }

    .container {
        padding: 15px;
    }

    .navbar-container {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 10px;
        padding: 10px 15px;
    }

    .navbar-brand {
        flex: none;
    }

    .logo {
        font-size: 1.2em;
        padding: 8px 0;
        text-align: left;
    }

    .navbar-toggle {
        display: inline-flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .navbar-panel {
        display: none;
        grid-column: 1 / -1;
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 12px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 12px;
    }

    .navbar-panel.is-open {
        display: flex;
    }

    .navbar-menu {
        flex-direction: column;
        gap: 6px;
    }

    .navbar-menu li {
        list-style: none;
    }

    .navbar-menu a {
        display: block;
        width: 100%;
        padding: 10px 12px;
        font-size: 0.95em;
        background-color: rgba(255, 255, 255, 0.05);
    }

    .navbar-user {
        justify-content: space-between;
        margin-left: 0;
        padding-top: 4px;
        flex-wrap: nowrap;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
    }

    .header-actions,
    .form-actions,
    .error-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .btn,
    .btn-small,
    .login-button,
    .logout-btn {
        width: 100%;
        text-align: center;
    }

    .dashboard h1,
    .error-page h1 {
        font-size: 2em;
    }

    .subtitle {
        font-size: 1em;
        margin-bottom: 24px;
    }

    .stat-card,
    .quick-actions,
    .info-section,
    .form-container,
    .detail-card,
    .empty-state,
    .tournament-card,
    .alert {
        padding: 18px;
    }

    .stat-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .stat-icon {
        font-size: 2.2em;
    }

    .detail-grid,
    .detail-grid-3col,
    .stats-grid,
    .tournament-grid,
    .action-buttons {
        grid-template-columns: 1fr;
    }

    .stats-display {
        grid-template-columns: 1fr;
    }

    .info-row,
    .detail-row,
    .player-item,
    .team-item,
    .rating-display {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .team-players {
        flex-wrap: wrap;
    }

    .table-container {
        border-radius: 6px;
    }

    .data-table th,
    .data-table td {
        padding: 10px 12px;
        font-size: 0.92em;
    }

    .data-table.small th,
    .data-table.small td {
        padding: 8px 10px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 12px;
    }

    .logo {
        font-size: 1.05em;
    }

    .navbar-panel {
        padding: 10px;
    }

    .navbar-menu a {
        font-size: 0.9em;
        padding: 9px 10px;
    }

    .navbar-user {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .username,
    .logout-btn {
        text-align: center;
    }

    .form-container,
    .detail-card,
    .quick-actions,
    .info-section,
    .empty-state,
    .stat-card,
    .tournament-card {
        padding: 16px;
    }

    .dashboard h1,
    .error-page h1 {
        font-size: 1.8em;
    }

    .stat-content h2,
    .rating-value,
    .stat-value {
        font-size: 1.4em;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px;
    }

    .badge {
        font-size: 0.8em;
        padding: 3px 8px;
    }

    .alert {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

.team-form .form-group {
    margin-bottom: 0;
}

.team-form button {
    align-self: flex-start;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

/* ============ POOL PLAY STYLES ============ */

.top-teams-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    border-top: 4px solid var(--primary-color);
}

.top-teams-section h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.3em;
}

.top-teams-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.top-team-card {
    background: linear-gradient(135deg, #f0f6ff, #f9f3ff);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 6px;
    text-align: center;
    transition: all 0.3s ease;
}

.top-team-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(46, 102, 205, 0.15);
    transform: translateY(-2px);
}

.team-rank {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 3px;
}

.top-team-card .team-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 6px;
    font-size: 0.75em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checked-in-team-badge {
    display: inline-block;
    margin-left: 0;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1.25;
    color: #ffffff;
    background-color: #27ae60;
    vertical-align: middle;
}

.unchecked-in-team-badge {
    display: inline-block;
    margin-left: 0;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 700;
    line-height: 1.25;
    color: #ffffff;
    background-color: #e74c3c;
    vertical-align: middle;
}

.team-stats {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 6px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.7em;
    padding: 3px 4px;
    background-color: white;
    border-radius: 4px;
    min-width: 30px;
}

.stat-label {
    color: var(--border-color);
    font-weight: 500;
    font-size: 0.85em;
}

.stat-value {
    font-weight: bold;
    color: var(--primary-color);
    font-size: 1em;
}

.tabs-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-top: 20px;
}

.tabs-nav {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    background-color: #f8f9fa;
    overflow-x: auto;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background-color: #f8f9fa;
    color: var(--dark-color);
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    min-width: 120px;
}

.tab-button:hover {
    background-color: #e9ecef;
    border-bottom-color: var(--primary-color);
}

.tab-button.active {
    background-color: white;
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tabs-content {
    padding: 0;
}

.pool-tab {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

.pool-tab.active {
    display: block;
}

.pools-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100%, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pool-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pool-section h2 {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.pool-card {
    margin-bottom: 25px;
}

.pool-card h3 {
    color: var(--dark-color);
    margin-bottom: 15px;
    font-size: 1.1em;
}

.standings-table {
    overflow-x: auto;
}

.standings-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.standings-table thead {
    background-color: #f5f5f5;
}

.standings-table th {
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.standings-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
}

.standings-table tbody tr:hover {
    background-color: #f9f9f9;
}

.matches-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.match-item {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
}

.match-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.team-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

.team-name {
    font-weight: 600;
    color: var(--dark-color);
    text-align: center;
    margin-bottom: 5px;
    font-size: 0.95em;
}

.team-score {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

.match-divider {
    color: var(--border-color);
    font-weight: bold;
    margin: 0 10px;
}

.match-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.score-input {
    width: 50px;
    padding: 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    font-size: 0.9em;
    font-weight: 600;
}

.score-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(46, 102, 205, 0.1);
}

.score-separator {
    font-weight: bold;
    color: var(--dark-color);
}

.match-status {
    margin-left: auto;
}

.btn-success {
    background-color: #28a745;
    color: white;
    border: none;
    cursor: pointer;
}

.btn-success:hover {
    background-color: #218838;
}

.btn-warning {
    background-color: #ffc107;
    color: #333;
    border: none;
    cursor: pointer;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.match-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

.match-inprogress {
    margin-left: auto;
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.start-match-form {
    display: flex;
    gap: 8px;
    align-items: center;
}

.court-input {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9em;
    width: 70px;
    text-align: center;
}

.in-progress-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid var(--warning-color);
}

.in-progress-section h2 {
    color: var(--warning-color);
    margin-bottom: 15px;
    font-size: 1.2em;
}

.in-progress-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.in-progress-card {
    background: linear-gradient(135deg, #fff9e6, #fffbf0);
    border: 2px solid var(--warning-color);
    border-radius: 6px;
    padding: 8px 6px;
    transition: all 0.3s ease;
}

.in-progress-card:hover {
    box-shadow: 0 4px 12px rgba(243, 156, 18, 0.2);
    transform: translateY(-2px);
}

.court-badge {
    display: block;
    text-align: center;
    background-color: var(--warning-color);
    color: white;
    padding: 3px 6px;
    border-radius: 20px;
    font-size: 0.7em;
    font-weight: 600;
    margin-bottom: 6px;
}

.in-progress-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 4px;
}

.ip-team {
    flex: 1;
    text-align: center;
    overflow: hidden;
}

.ip-team-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.72em;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ip-vs {
    color: #999;
    font-weight: bold;
    font-size: 0.7em;
    margin: 0 2px;
    flex-shrink: 0;
}

.in-progress-pool {
    text-align: center;
    font-size: 0.7em;
    color: #666;
    padding-top: 4px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.in-progress-round {
    text-align: center;
    font-size: 0.7em;
    color: #666;
    padding-top: 4px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.match-completed {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.completed-status {
    flex-shrink: 0;
}

.edit-score-form {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.pool-setup-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pool-setup-form .form-group {
    margin-bottom: 0;
}

.pool-setup-form select {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1em;
}

/* Responsive tabs */
@media (max-width: 768px) {
    .tab-button {
        padding: 12px 15px;
        font-size: 0.9em;
        min-width: 100px;
    }

    .match-form {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .score-input {
        width: 100%;
    }

    .match-item {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ============ SEARCH AND LOOKUP ============ */

.search-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.search-form {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.1);
}

.search-input::placeholder {
    color: #999;
}

/* ============ ORGANIZER BADGE ============ */

.organizer-badge {
    display: inline-block;
    background-color: #e8f4f8;
    color: #0066cc;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 500;
    border: 1px solid #cce5ff;
}

/* ============ OWNERSHIP INDICATORS ============ */

.player-row-own {
    background-color: rgba(46, 204, 113, 0.05);
}

.player-row-own:hover {
    background-color: rgba(46, 204, 113, 0.1);
}

.player-row-other {
    opacity: 0.9;
}

.ownership-badge {
    display: inline-block;
    margin-left: 8px;
    background-color: #d4edda;
    color: #155724;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.85em;
    font-weight: 600;
}

.info-banner {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 4px;
    color: #1565c0;
    font-size: 0.95em;
}

.permission-notice {
    display: inline-block;
    background-color: #fff3cd;
    color: #856404;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 0.9em;
    border: 1px solid #ffeeba;
    margin-left: 10px;
}

/* ============ TOURNAMENT PLAYER SEARCH ============ */

.tournament-search {
    background-color: #f8f9fa;
    padding: 10px;
    margin: 0 -20px 15px -20px;
}

.tournament-search .search-input {
    min-width: auto;
    flex: 1;
    padding: 8px 12px;
    font-size: 0.9em;
}

/* ============ PAGINATION ============ */

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

.page-info {
    font-size: 0.9em;
    color: #666;
    min-width: 100px;
    text-align: center;
}

    .match-content {
        width: 100%;
        justify-content: space-around;
    }

    .match-status {
        margin-left: 0;
        width: 100%;
    }
}

/* ============ ELIMINATION BRACKET ============ */

.bracket-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-top: 20px;
    border-left: 4px solid var(--primary-color);
}

.bracket-section h2 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.bracket-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.bracket-options form {
    display: inline-block;
}

.bracket-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.bracket-round {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.bracket-round h2 {
    font-size: 1.1em;
    color: var(--primary-color);
    margin-bottom: 15px;
    border-bottom: 2px solid var(--light-color);
    padding-bottom: 10px;
}

.bracket-matches {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.bracket-match-item {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    background-color: #f9f9f9;
    transition: all 0.3s ease;
}

.bracket-match-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.bracket-match {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.bracket-team {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    background-color: white;
    border-radius: 4px;
    border: 1px solid var(--light-color);
}

.bracket-team-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95em;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bracket-team-score {
    font-size: 1.1em;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 30px;
    text-align: center;
}

.bracket-divider {
    color: #999;
    font-weight: bold;
    font-size: 0.8em;
    padding: 0 5px;
}

.bracket-actions {
    display: flex;
    gap: 8px;
}

.bracket-score-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.bracket-inprogress {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: center;
}

.cancel-match-form {
    display: flex;
}

.bracket-completed {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.no-bracket {
    background: white;
    padding: 30px;
    text-align: center;
    border-radius: 8px;
    margin-top: 20px;
}

.no-bracket p {
    font-size: 1.1em;
    color: #666;
}

.no-bracket a {
    color: var(--primary-color);
    font-weight: 600;
}

/* ============ ANIMATIONS ============ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============ RESPONSIVE ============ */

@media (max-width: 1024px) {
    .detail-grid-3col {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .detail-grid-3col {
        grid-template-columns: 1fr;
    }

    .navbar-container {
        flex-direction: column;
    }

    .navbar-menu {
        gap: 15px;
        margin-top: 10px;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header .btn {
        margin-top: 10px;
        width: 100%;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .tournament-grid {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    .player-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .logo {
        font-size: 1.2em;
    }

    .navbar-menu {
        flex-direction: column;
        gap: 0;
    }

    .navbar-menu a {
        display: block;
        padding: 10px 0;
    }

    .dashboard h1 {
        font-size: 1.8em;
    }

    .subtitle {
        font-size: 1em;
    }
}
