/* Advanced Search Specific Styles */

.advanced-search-card {
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 40px;
    margin-bottom: 30px;
    border: 1px solid #f0f0f0;
}

.filter-section {
    margin-bottom: 30px;
}

.filter-section:last-of-type {
    margin-bottom: 0;
}

.section-title {
    color: var(--secondary);
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #f5f5f5;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--primary);
    margin-right: 12px;
    border-radius: 2px;
}

.filter-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 300px));
}

.basic-filters {
    grid-template-columns: repeat(auto-fit, minmax(160px, 280px));
}

.performance-filters {
    grid-template-columns: repeat(auto-fit, minmax(180px, 300px));
}

.filter-item {
    display: flex;
    flex-direction: column;
}

.filter-label {
    color: var(--text-dark);
    font-weight: 600;
    font-size: 0.95em;
    margin-bottom: 8px;
    display: block;
}

.filter-select {
    padding: 12px 16px;
    border: 2px solid #e8e8e8;
    border-radius: 12px;
    background: var(--white);
    color: var(--text-dark);
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(243, 146, 0, 0.1);
    transform: translateY(-1px);
}

.filter-select:hover {
    border-color: var(--secondary);
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.search-button-container {
    text-align: left;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #f0f0f0;
}

#searchButton {
    background: linear-gradient(135deg, #f39200 0%, #e8860f 100%) !important;
    color: white !important;
    border: none !important;
    padding: 16px 40px !important;
    border-radius: 8px !important;
    font-size: 1.1em !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 16px rgba(243, 146, 0, 0.3) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    min-width: 200px !important;
    justify-content: center !important;
}

.search-button {
    background: linear-gradient(135deg, #f39200 0%, #e8860f 100%);
    color: white;
    border: none;
    padding: 16px 40px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(243, 146, 0, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    justify-content: center;
}

.search-button:hover {
    background: linear-gradient(135deg, #e8860f 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(243, 146, 0, 0.4);
}

.search-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(243, 146, 0, 0.3);
}

.search-icon {
    font-size: 1.2em;
}

/* Performance section animation */
.filter-section {
    transition: all 0.3s ease;
}

/* Utility to hide elements */
.is-hidden {
    display: none !important;
}

/* Results container (moved from inline) */
.results-card {
    background: var(--white);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 32px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.results-title {
    color: var(--secondary);
    font-weight: 700;
    margin: 0;
}

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

/* Table styles */
.standings-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.standings-table thead th {
    text-align: left;
    background: var(--table-header);
    color: var(--white);
    font-weight: 700;
    padding: 10px 8px;
}

.standings-table thead th:first-child {
    border-top-left-radius: 10px;
}

.standings-table thead th:last-child {
    border-top-right-radius: 10px;
}

.standings-table tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid #eee;
    background: var(--white);
    text-align: left;
}

.text-center { text-align: center; }
.text-strong { font-weight: 600; }
.text-muted { color: var(--text-light); }

.name-link {
    color: var(--secondary);
    text-decoration: none;
    font-weight: 700;
}

.team-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* No results */
.no-results {
    text-align: center;
    padding: 40px;
}

.no-results-icon {
    color: var(--text-light);
    font-size: 3em;
    margin-bottom: 16px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .advanced-search-card {
        padding: 25px;
        margin: 0 -15px 20px -15px;
        border-radius: 0;
    }
    
    .filter-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .section-title {
        font-size: 1.2em;
        margin-bottom: 15px;
    }
    
    .filter-select {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .search-button {
        padding: 14px 30px;
        font-size: 1em;
        min-width: 180px;
    }
    
    .search-button-container {
        margin-top: 30px;
        padding-top: 25px;
    }
}

@media (max-width: 480px) {
    .advanced-search-card {
        padding: 20px;
    }
    
    .filter-section {
        margin-bottom: 25px;
    }
    
    .section-title {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .section-title::before {
        width: 3px;
        height: 20px;
        margin-right: 10px;
    }
    
    .filter-select {
        padding: 12px 14px;
    }
    
    .search-button {
        padding: 12px 25px;
        font-size: 0.95em;
        min-width: 160px;
    }
}

/* Focus states for accessibility */
.filter-select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.search-button:focus-visible {
    outline: 2px solid var(--white);
    outline-offset: 2px;
}

/* Animation for filter appearance */
.filter-item {
    animation: fadeInUp 0.3s ease forwards;
    opacity: 0;
    transform: translateY(10px);
}

.filter-item:nth-child(1) { animation-delay: 0.1s; }
.filter-item:nth-child(2) { animation-delay: 0.15s; }
.filter-item:nth-child(3) { animation-delay: 0.2s; }
.filter-item:nth-child(4) { animation-delay: 0.25s; }
.filter-item:nth-child(5) { animation-delay: 0.3s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
               transform: translateY(0);
    }
}

/* Dark mode support (if implemented in the future) */
@media (prefers-color-scheme: dark) {
    .advanced-search-card {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .filter-select {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .section-title {
        color: #fff;
        border-bottom-color: #333;
    }
}

/* Loading overlay and spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-weight: 600;
    font-size: 18px;
    background: rgba(0, 0, 0, 0.8);
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.loading-spinner .spin {
    animation: spin 1s linear infinite;
}

.search-button-container {
    position: relative;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Table column styling for desktop */
.standings-table th,
.standings-table td {
    text-align: left !important;
}

/* Center only the numeric data columns (goals, matches) */
.standings-table th:nth-child(2),
.standings-table th:nth-child(3),
.standings-table td:nth-child(2),
.standings-table td:nth-child(3) {
    text-align: center !important;
}

/* Name column width control */
.col-name {
    width: 22%;
    max-width: 22%;
}

.col-name .name-link {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Club column with ellipsis */
.standings-table td:last-child {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.standings-table td:last-child .team-link {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Profile page specific: Club column in players table */
.profile-page .standings-table td:nth-child(6) {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-page .standings-table td:nth-child(6) .team-link {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Player role icons in goals column */
.profile-page .standings-table .player-role-icon {
    width: 16px;
    height: 16px;
    margin-left: 6px;
    vertical-align: middle;
}

/* Goalkeeper goals conceded in red */
.profile-page .standings-table tbody tr.goalkeeper-row td:nth-child(2) {
    color: #dc3545;
    font-weight: 600;
}

/* Advanced search specific styles */
.standings-table .player-name-wrapper {
    display: flex;
    align-items: center;
    width: 100%;
}

.standings-table .player-follow-buttons-inline {
    display: inline-flex;
    gap: 6px;
    margin-left: auto;
    vertical-align: middle;
}

.standings-table .col-club {
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.standings-table .col-club .team-link {
    display: inline-block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}


/* ===========================
   FILTER TOGGLE FUNCTIONALITY
   =========================== */

.filter-toggle-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    margin-left: auto;
}

.filter-toggle-btn:hover {
    background: var(--secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.filter-toggle-btn .toggle-icon {
    font-size: 1em;
}

/* Ensure results header is flex to align filter button to right */
.results-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.results-title {
    flex: 1;
}

/* Hide filters when results are shown */
.filters-hidden #filtersContainer {
    display: none;
}

/* ===========================
   MOBILE CARD VIEW STYLES
   =========================== */

/* Show table on desktop, hide cards */
.desktop-only {
    display: flex;
}

.mobile-only {
    display: none !important;
}

/* Mobile card specific styles */
.player-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-item {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item.no-border {
    border-bottom: none;
    padding: 4px 0;
    display: flex;
    justify-content: flex-start;
    grid-template-columns: none;
}

.stat-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}

.stat-label {
    font-weight: 600;
    color: var(--secondary);
    font-size: 1em;
}

.stat-value {
    font-weight: 700;
    color: var(--text-dark);
    font-size: 1.05em;
}

.stat-item.no-border .stat-value {
    text-align: left;
    flex: none;
}

.stat-value .team-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.stat-value .team-link:hover {
    text-decoration: underline;
}

.player-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    margin-right: 15px;
    font-size: 1.2em;
}

.card-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 700;
}

.card-header h3 a {
    color: var(--secondary);
    text-decoration: none;
}

.card-header h3 a:hover {
    color: var(--primary);
    text-decoration: underline;
}

/* ===========================
   RESPONSIVE BREAKPOINTS
   =========================== */

@media (max-width: 768px) {
    /* Hide table on mobile, show cards */
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: block !important;
    }
    
    /* Adjust results header for mobile */
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .results-title {
        font-size: 1.5em;
    }
    
    /* Make pagination info smaller on mobile */
    .pagination-info {
        font-size: 0.85em;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .stat-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 10px 0;
    }
    
    .stat-label {
        min-width: auto;
        font-size: 0.95em;
    }
    
    .stat-value {
        text-align: left;
        font-size: 1em;
    }
    
    .card-header {
        padding: 16px;
    }
    
    .card-content {
        padding: 16px;
    }
    
    .player-icon {
        width: 35px;
        height: 35px;
        font-size: 1em;
        margin-right: 12px;
    }
    
    .card-header h3 {
        font-size: 1.15em;
    }
}

/* Shared goalkeeper indicator */
.shared-indicator {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.2em;
    margin-left: 4px;
    cursor: help;
}

.shared-indicator:hover {
    color: var(--secondary);
    transform: scale(1.1);
    transition: all 0.2s ease;
}