/* Doubles Tournament Styles */

/* Tournament Type Toggle */
.tournament-type-toggle {
    display: flex;
    gap: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #2B5A9E;
    width: fit-content;
}

.type-toggle-btn {
    padding: 0.75rem 2rem;
    border: none;
    background: white;
    color: #2B5A9E;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.type-toggle-btn.active {
    background: #2B5A9E;
    color: white;
}

.type-toggle-btn:hover:not(.active) {
    background: #e8f0fe;
}

/* Doubles Format Section */
#doubles-format-section {
    margin-top: 1rem;
}

#doubles-format-section h2 {
    color: #2c3e50;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.doubles-format-select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
}

/* Doubles Badge on Tournament Cards */
.doubles-badge {
    display: inline-block;
    background: #8e44ad;
    color: white;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Team Cards in Settings */
.teams-section {
    margin-top: 1.5rem;
}

.teams-section h3 {
    color: #2c3e50;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.team-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 0.75rem;
    border: 1px solid #e0e0e0;
}

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

.team-card-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1rem;
}

.team-card-partner {
    color: #666;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.team-card-status {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

.team-card-status.pending {
    background: #fff3cd;
    color: #856404;
}

.team-card-status.accepted {
    background: #d4edda;
    color: #155724;
}

.team-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.team-btn {
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.team-btn-accept {
    background: #27ae60;
    color: white;
}

.team-btn-accept:hover {
    background: #219a52;
}

.team-btn-decline {
    background: #e74c3c;
    color: white;
}

.team-btn-decline:hover {
    background: #c0392b;
}

.team-btn-edit {
    background: #f39c12;
    color: white;
    padding: 0.4rem 0.5rem;
    font-size: 1rem;
    line-height: 1;
}

.team-btn-edit:hover {
    background: #e67e22;
}

.team-btn-leave {
    background: #95a5a6;
    color: white;
}

.team-btn-leave:hover {
    background: #7f8c8d;
}

.team-btn-create {
    background: #2B5A9E;
    color: white;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
}

.team-btn-create:hover {
    background: #1e4a8a;
}

.no-teams-msg {
    color: #999;
    font-style: italic;
    padding: 1rem 0;
}

.no-teams-msg a,
#team-create-hint a {
    color: #2B5A9E;
    text-decoration: underline;
}

/* Header layout: My Teams + limit on left, Create button on right */
.friends-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.team-limit-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

.header-create-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-create-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.team-limit-info {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.5rem;
}

/* Modal form actions */
.modal-form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.modal-cancel-btn {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 2px solid #ddd;
    background: white;
    color: #666;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-cancel-btn:hover {
    border-color: #bbb;
    color: #333;
    background: #f5f5f5;
}

.modal-submit-btn {
    flex: 2;
    padding: 0.7rem 1rem;
    border: none;
    background: linear-gradient(135deg, #2B5A9E 0%, #4A90E2 100%);
    color: white;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(43, 90, 158, 0.3);
}

/* Team Select on Registration Page */
#team-select-section {
    margin-bottom: 1.5rem;
}

#team-select-section select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
}

.team-partner-info {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: #f0f7ff;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #2c3e50;
}

/* Doubles Results Table */
.team-result-name {
    font-weight: 600;
}

.team-result-players {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.15rem;
}

/* Doubles Format Info on Tournament Detail */
.doubles-format-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.format-round-tag {
    display: inline-block;
    background: #f0f0f0;
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #333;
}

.format-round-tag strong {
    color: #2B5A9E;
}

/* Create Team Modal */
.create-team-modal .modal-content {
    max-width: 500px;
}

.create-team-form .form-group {
    margin-bottom: 1rem;
}

.create-team-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #2c3e50;
}

.create-team-form input,
.create-team-form select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 0.95rem;
}

/* Responsive */
@media (max-width: 768px) {
    .tournament-type-toggle {
        width: 100%;
    }

    .type-toggle-btn {
        flex: 1;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }

    .team-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .team-card-actions {
        margin-left: 0;
        width: 100%;
    }

    .team-btn {
        flex: 1;
        text-align: center;
    }
}

/* Player Search in Team Creation */
#partner-search-wrapper {
    position: relative;
}

#team-partner-search {
    width: 100%;
    box-sizing: border-box;
}

.player-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: none;
}

.player-search-results.active {
    display: block;
}

.player-search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f0f0f0;
}

.player-search-result-item:last-child {
    border-bottom: none;
}

.player-search-result-item:hover {
    background: #f0f7ff;
}

.player-search-result-name {
    font-size: 0.95rem;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.friend-badge {
    font-size: 0.7rem;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
}

.player-search-result-action {
    font-size: 0.8rem;
    color: #2B5A9E;
    font-weight: 600;
    white-space: nowrap;
}

.player-search-no-results {
    padding: 0.8rem;
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}

.player-search-hint {
    padding: 0.8rem;
    text-align: center;
    color: #aaa;
    font-size: 0.85rem;
}

.selected-partner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    margin-top: 0.5rem;
}

.selected-partner span {
    font-weight: 600;
    color: #1565c0;
    font-size: 0.95rem;
}

.remove-partner-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0.3rem;
    line-height: 1;
    margin-left: auto;
}

.remove-partner-btn:hover {
    color: #e53935;
}
