/* Tournaments List Page Styles */

.tournaments-list-section {
    background: white;
    margin: 2rem auto;
    padding: 2rem 0;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    min-height: 70vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    margin-bottom: 2rem;
}

.page-header h1 {
    color: #2c3e50;
    font-size: 2rem;
    margin: 0;
}

.create-tournament-btn {
    background: linear-gradient(135deg, #2B5A9E 0%, #4A90E2 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.create-tournament-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(43, 90, 158, 0.4);
}

.btn-icon {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Filters Section */
.filters-container {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 0 20px 2rem 20px;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 150px;
}

.filter-group-compact {
    flex: 0 0 auto;
    min-width: 120px;
    max-width: 160px;
}

.filter-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9rem;
}

.filter-input,
.filter-select {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.filter-input:focus,
.filter-select:focus {
    outline: none;
    border-color: #2B5A9E;
    box-shadow: 0 0 0 3px rgba(43, 90, 158, 0.1);
}

.clear-filters-btn {
    background: transparent;
    color: #666;
    border: 2px solid #ddd;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    height: fit-content;
}

.clear-filters-btn:hover {
    border-color: #999;
    color: #333;
}

/* Table Styles */
.tournaments-table-container {
    padding: 0 20px;
    overflow-x: auto;
}

.tournaments-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.tournaments-table thead {
    background: linear-gradient(135deg, #2B5A9E 0%, #4A90E2 100%);
    color: white;
}

.tournaments-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
}

.tournaments-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.tournaments-table tbody tr:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tournaments-table td {
    padding: 1rem;
    color: #333;
}

.tournament-name {
    font-weight: 600;
    color: #2B5A9E;
    cursor: pointer;
}

.tournament-name:hover {
    text-decoration: underline;
}

/* PDGA Badges */
.pdga-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.non-pdga {
    background: #e0e0e0;
    color: #777;
}

.tier-c {
    background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
    color: white;
}

.tier-b {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    color: #333;
}

.tier-a {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #333;
}

.tier-silver {
    background: linear-gradient(135deg, #4A90D9 0%, #357ABD 100%);
    color: white;
}

.tier-elite {
    background: linear-gradient(135deg, #7B2D8E 0%, #5B1A6E 100%);
    color: white;
}

.tier-major {
    background: linear-gradient(135deg, #C41E3A 0%, #8B0000 100%);
    color: #FFD700;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-open {
    background: #d4edda;
    color: #155724;
}

.status-closed {
    background: #f8d7da;
    color: #721c24;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .create-tournament-btn {
        width: 100%;
        justify-content: center;
    }

    .filters-container {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

    .clear-filters-btn {
        width: 100%;
    }

    /* Mobile card layout for tournament table */
    .tournaments-table-container {
        padding: 0 12px;
    }

    .tournaments-table {
        border: none;
    }

    .tournaments-table thead {
        display: none;
    }

    .tournaments-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .tournaments-table tbody tr {
        display: flex;
        flex-direction: column;
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 10px;
        padding: 1rem;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
        cursor: pointer;
    }

    .tournaments-table tbody tr:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    }

    .tournaments-table td {
        padding: 0.25rem 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .tournaments-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #666;
        font-size: 0.8rem;
        min-width: 90px;
    }

    /* Tournament name - full width, prominent */
    .tournaments-table td:nth-child(2) {
        order: -2;
        justify-content: flex-start;
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
        border-bottom: 1px solid #eee;
    }

    .tournaments-table td:nth-child(2)::before {
        display: none;
    }

    .tournaments-table td:nth-child(2) .tournament-name {
        font-size: 1.05rem;
    }

    /* Date - right after name */
    .tournaments-table td:nth-child(1) {
        order: -1;
        font-size: 0.9rem;
    }

    /* Hide less important columns on mobile */
    .tournaments-table td:nth-child(4), /* League */
    .tournaments-table td:nth-child(6) { /* Director */
        display: none;
    }

    /* Registration and Signed Up on same row visually */
    .tournaments-table td:nth-child(7),
    .tournaments-table td:nth-child(8) {
        font-size: 0.9rem;
    }
}

/* Even more compact on small phones */
@media (max-width: 480px) {
    .tournaments-list-section {
        margin: 0.5rem;
        padding: 1rem 0;
        border-radius: 8px;
    }

    .page-header {
        padding: 0 12px;
        margin-bottom: 1rem;
    }

    .page-header h1 {
        font-size: 1.3rem;
    }

    .filters-container {
        margin: 0 12px 1rem;
        padding: 1rem;
    }

    .filter-group label {
        font-size: 0.85rem;
    }

    .filter-input,
    .filter-select {
        padding: 0.6rem;
        font-size: 0.9rem;
    }

    .tournaments-table tbody tr {
        padding: 0.75rem;
    }

    .tournaments-table td {
        font-size: 0.85rem;
    }

    .tournaments-table td::before {
        font-size: 0.75rem;
        min-width: 80px;
    }
}

/* Empty State */
.no-results {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.no-results-text {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.no-results-subtext {
    font-size: 0.95rem;
    color: #999;
}

/* Tournament Creation Modal */
.tournament-modal {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

.tournament-modal .modal-header {
    background: linear-gradient(135deg, #2B5A9E 0%, #4A90E2 100%);
    color: white;
    margin: 0;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
}

.tournament-modal .modal-header h2 {
    color: white;
    margin: 0;
}

.tournament-modal .modal-header .close-modal {
    color: white;
    opacity: 0.9;
}

.tournament-modal .modal-header .close-modal:hover {
    opacity: 1;
}

.tournament-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2B5A9E;
    box-shadow: 0 0 0 3px rgba(43, 90, 158, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-section-header {
    font-weight: 700;
    font-size: 1.1rem;
    color: #2B5A9E;
    margin-top: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.radio-group,
.checkbox-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 400;
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1.5rem;
    border-top: 2px solid #e0e0e0;
}

.cancel-btn {
    background: transparent;
    color: #666;
    border: 2px solid #ddd;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    border-color: #999;
    color: #333;
}

/* Date Column Styling */
.tournament-date {
    white-space: nowrap;
    color: #666;
    font-weight: 500;
}

/* Categories Section */
.categories-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.category-group h4 {
    color: #2B5A9E;
    font-size: 1rem;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

.category-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.layout-quick-assign {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #fff3cd;
    border-radius: 8px;
    border: 1px solid #ffc107;
}

.layout-assignments-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.layout-assignment-row {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.layout-assignment-row label {
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.layout-assignment-row select {
    padding: 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 0.95rem;
}

@media (max-width: 1200px) {
    .categories-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .tournament-modal {
        max-width: 95%;
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-actions {
        flex-direction: column;
    }

    .cancel-btn,
    .submit-btn {
        width: 100%;
    }

    .categories-section {
        grid-template-columns: 1fr;
    }

    .layout-assignment-row {
        grid-template-columns: 1fr;
    }
}

/* Rich Text Editor Styles */
.rich-text-toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    align-items: center;
}

.toolbar-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.toolbar-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.toolbar-btn:active {
    background: #dee2e6;
}

.toolbar-divider {
    color: #ddd;
    margin: 0 0.25rem;
}

.rich-text-editor {
    min-height: 350px;
    max-height: 700px;
    width: 100%;
    overflow-y: auto;
    padding: 1.25rem;
    border: 3px solid #2B5A9E;
    border-radius: 0 0 8px 8px;
    background: white;
    font-family: inherit;
    font-size: 1.05rem;
    line-height: 1.6;
    outline: none;
    box-shadow: 0 2px 8px rgba(43, 90, 158, 0.1);
}

.rich-text-editor:focus {
    border-color: #4A90E2;
    box-shadow: 0 0 0 4px rgba(43, 90, 158, 0.2);
}

.rich-text-editor:empty:before {
    content: attr(data-placeholder);
    color: #999;
    font-style: italic;
}

.rich-text-editor img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1rem 0;
    border-radius: 8px;
    cursor: pointer;
}

.rich-text-editor p {
    margin: 0.5rem 0;
}

.rich-text-editor strong {
    font-weight: 600;
}

.rich-text-editor em {
    font-style: italic;
}

.rich-text-editor u {
    text-decoration: underline;
}
