/**
 * JP Clubs Module CSS - Final Version 7.0
 * Optimized for Mobile & Desktop with Load More
 */

/* Gold color variables */
:root {
    --vgm26-gold-light: #FFE4A1;
    --vgm26-gold: #FFD700;
    --vgm26-gold-dark: #B8860B;
    --vgm26-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --popup-orange: #FF6B35;
    --popup-orange-light: #FF8C57;
}

/* Time/Rank Badge Styles */
.time-badge {
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: var(--vgm26-gold-dark);
    background: white;
    border: 1.5px solid var(--vgm26-gold);
    min-width: 120px;
    text-align: center;
    transition: all 0.3s ease;
    display: inline-block;
}

.time-badge:hover {
    background: linear-gradient(135deg, 
        rgba(255, 228, 161, 0.1) 0%, 
        rgba(255, 215, 0, 0.1) 50%, 
        rgba(184, 134, 11, 0.1) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.2);
}

.time-text {
    font-weight: 700;
    color: #333;
}

.label-fm {
    color: #d4a574;
    font-weight: 800;
    margin-left: 4px;
}

.label-hm {
    color: #b8860b;
    font-weight: 800;
    margin-left: 4px;
}

/* Top Rank Images */
.rank-top-img {
    width: 35px;
    height: 35px;
    object-fit: contain;
	margin-left: 29px;
}

/* Container for time stats */
.time-stats {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    margin: 15px 0;
}

.time-stats-mini {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 8px;
}

.time-stats-mini .time-badge {
    min-width: auto;
    padding: 4px 8px;
    font-size: 9px;
}

/* Rank badge in table */
.rank-badge {
    min-width: 22px !important;
    padding: 5px 10px !important;
    margin-left: 32px;
}

/* Loading Overlay */
.jp-clubs-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.jp-clubs-loading-overlay .loading-content {
    text-align: center;
}

.jp-clubs-loading-overlay .loading-text {
    display: block;
    margin-top: 10px;
    color: var(--vgm26-gold-dark);
    font-weight: 600;
}

/* Controls Section */
.jp-clubs-controls {
    padding: 20px;
    background: linear-gradient(135deg, rgba(244,228,188,0.1) 0%, rgba(244,228,188,0.05) 100%);
    border-radius: 10px;
    margin-bottom: 20px;
}

.jp-clubs-search {
    border: 2px solid var(--vgm26-gold-light) !important;
    transition: all 0.3s ease;
}

.jp-clubs-search:focus {
    border-color: var(--vgm26-gold) !important;
    box-shadow: 0 0 0 0.2rem rgba(212,175,55,0.25) !important;
}

.jp-clubs-refresh {
    background: linear-gradient(135deg, var(--vgm26-gold-light) 0%, var(--vgm26-gold) 100%);
    color: white !important;
    border: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.jp-clubs-refresh:hover {
    background: linear-gradient(135deg, var(--vgm26-gold) 0%, var(--vgm26-gold-dark) 100%);
    transform: translateY(-2px);
    box-shadow: var(--vgm26-shadow);
}

.jp-clubs-add {
    background: linear-gradient(135deg, #4A90E2 0%, #357abd 100%);
    color: white !important;
    border: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.jp-clubs-add:hover {
    background: linear-gradient(135deg, #357abd 0%, #2968a3 100%);
    transform: translateY(-2px);
    box-shadow: var(--vgm26-shadow);
}

/* Table Styles */
.jp-clubs-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    box-shadow: var(--vgm26-shadow);
    border-radius: 10px;
    overflow: hidden;
}

.jp-clubs-table thead {
    background: linear-gradient(135deg, var(--vgm26-gold-light) 0%, var(--vgm26-gold) 50%, var(--vgm26-gold-dark) 100%);
}

.jp-clubs-table thead th {
    padding: 15px 10px;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    white-space: nowrap;
}

/* Main Row */
.club-main-row {
    transition: all 0.3s ease;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.club-main-row:hover {
    background: linear-gradient(90deg, rgba(244,228,188,0.15) 0%, rgba(212,175,55,0.08) 100%);
}

.club-main-row.expanded {
    background: linear-gradient(90deg, rgba(244,228,188,0.3) 0%, rgba(212,175,55,0.15) 100%);
    border-left: 4px solid var(--vgm26-gold);
}

.club-main-row td {
    padding: 15px 10px;
    vertical-align: middle;
}

/* Images */
.club-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 8px;
    border: 2px solid var(--vgm26-gold-light);
    padding: 3px;
    background: white;
}

.club-outfit {
    width: 85px;
    height: 85px;
    object-fit: contain;
    border-radius: 8px;
}

.logo-placeholder,
.outfit-placeholder {
    width: 80px;
    height: 80px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 8px;
    font-size: 28px;
}

.outfit-placeholder {
    width: 85px;
    height: 85px;
}

/* Stars */
.stars-display {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: rgba(244,228,188,0.3);
    border-radius: 12px;
    font-size: 14px;
    white-space: nowrap;
}

/* Detail Row */
.club-detail-row td {
    padding: 0;
}

.club-detail-content {
    background: #fafafa;
    padding: 25px;
    margin: 15px;
    border-radius: 10px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.club-info-header {
    padding: 15px 20px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--vgm26-gold);
    margin-bottom: 20px;
}

.club-info-header h4 {
    color: var(--vgm26-gold-dark);
    font-size: 18px;
    margin: 0 0 10px 0;
    font-weight: 600;
}

.club-description-content {
    color: #555;
    line-height: 1.7;
    font-size: 14px;
}

/* Members Section */
.club-members-section {
    background: white;
    border-radius: 10px;
    padding: 20px;
}

.members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--vgm26-gold-light);
}

.members-header h5 {
    margin: 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
}

.members-header .uk-badge {
    background: var(--vgm26-gold);
    margin-left: 10px;
}

.members-filter-wrapper .uk-select {
    min-width: 120px;
    border-color: var(--vgm26-gold-light);
}

/* Members Search Box */
.members-search-box {
    margin: 15px 0;
    padding: 0 5px;
}

.members-search-box input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--vgm26-gold-light);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.members-search-box input:focus {
    border-color: var(--vgm26-gold);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.1);
}

/* Members Grid - Desktop */
.members-auto-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    padding: 15px;
    background: #fafafa;
    border-radius: 8px;
}

/* Member Card */
.member-card {
    background: white;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
}

.member-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(212,175,55,0.2);
    border-color: var(--vgm26-gold-light);
}

.member-avatar {
    width: 70px;
    height: 70px;
    margin: 0 auto 8px;
    position: relative;
}

.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--vgm26-gold-light);
}

.member-name {
    font-weight: 600;
    color: #2c3e50;
    font-size: 11px;
    line-height: 1.3;
    margin: 5px 0;
    min-height: 28px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* Load More Button */
.load-more-wrapper {
    padding: 20px;
    text-align: center;
    border-top: 1px solid #eee;
    margin-top: 20px;
}

.load-more-btn {
    background: linear-gradient(135deg, var(--vgm26-gold-light) 0%, var(--vgm26-gold) 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(255, 215, 0, 0.3);
}

.load-more-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--vgm26-gold) 0%, var(--vgm26-gold-dark) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}

.load-more-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.load-more-btn .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Member Popup Modal */
.jp-member-popup-modal .uk-modal-dialog {
    width: 600px;
    max-width: 95%;
    border-radius: 20px;
    overflow: hidden;
    padding: 0;
}

.jp-member-popup-modal .uk-modal-close-default {
    position: absolute;
    top: 15px;
    right: 15px;
    background: white;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    color: var(--popup-orange);
    z-index: 10;
}

.jp-popup-content {
    background: white;
    border: 3px solid var(--popup-orange);
    border-radius: 20px;
    overflow: hidden;
}

/* Avatar Section */
.jp-popup-avatar-section {
    text-align: center;
    padding: 30px 20px 20px;
    background: white;
}

.jp-popup-avatar {
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
    position: relative;
}

.jp-popup-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #ddd;
}

.jp-popup-name {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    margin: 0 0 10px 0;
}

.jp-popup-club {
    font-size: 16px;
    color: var(--popup-orange);
    font-weight: 600;
}

/* Stats Section */
.jp-popup-stats-section {
    background: #fafafa;
    padding: 30px 20px;
}

.jp-popup-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.jp-popup-stat-box {
    background: white;
    border: 2px solid var(--popup-orange);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    position: relative;
}

.jp-popup-stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--popup-orange);
    margin: 0 0 10px 0;
}

.jp-popup-stat-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    margin: 0 0 5px 0;
}

.jp-popup-stat-distance {
    font-size: 12px;
    color: #666;
    margin: 0 0 15px 0;
}

.jp-popup-time-badge {
    background: linear-gradient(135deg, var(--vgm26-gold-light) 0%, var(--vgm26-gold) 100%);
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    margin-top: 10px;
}

/* Loading */
.members-loading {
    text-align: center;
    padding: 20px;
    color: var(--vgm26-gold-dark);
}

/* Pagination */
.jp-clubs-pagination {
    padding: 20px 0;
}

.jp-clubs-pagination .uk-pagination > * > * {
    min-width: 35px;
    height: 35px;
    line-height: 33px;
    background: white;
    border: 2px solid var(--vgm26-gold-light);
    color: var(--vgm26-gold-dark);
    font-weight: 600;
}

.jp-clubs-pagination .uk-pagination > .uk-active > * {
    background: linear-gradient(135deg, var(--vgm26-gold-light) 0%, var(--vgm26-gold) 100%);
    color: white;
    border-color: var(--vgm26-gold);
}

/* Scrollbar */
.members-auto-grid::-webkit-scrollbar {
    width: 8px;
}

.members-auto-grid::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 4px;
}

.members-auto-grid::-webkit-scrollbar-thumb {
    background: var(--vgm26-gold);
    border-radius: 4px;
}

/* MOBILE OPTIMIZATIONS */
@media (max-width: 768px) {
    /* Controls layout for mobile - 2 rows */
    .jp-clubs-controls {
        padding: 15px;
    }
	    .rank-top-img {
        margin-left: 26px;
    }
	.rank-badge {
		margin-left: 26px;
	}
    
    /* Make search full width on first row */
    .jp-clubs-controls .uk-search {
        margin-bottom: 10px;
    }
    
    /* Buttons on second row */
    .jp-clubs-controls .uk-width-auto\@s {
        width: auto !important;
        flex: 1;
    }
    
    /* Make buttons equal width on mobile */
    .jp-clubs-controls .uk-button {
        width: 100%;
        padding: 0px 5px;
        font-size: 13px;
    }
    
    /* Hide text on mobile, keep icons */
    .jp-clubs-controls .uk-visible\@s {
        display: none !important;
    }
    
    /* Pagination on mobile - center it */
    .jp-clubs-pagination {
        justify-content: center;
        padding: 15px 0;
    }
    
    .jp-clubs-pagination .uk-pagination > * > * {
        min-width: 30px;
        height: 30px;
        line-height: 28px;
        font-size: 12px;
    }
    
    /* Table adjustments */
    .outfit-col,
    .stars-col,
    .jp-clubs-table td:nth-child(3),
    .jp-clubs-table td:nth-child(4) {
        display: none !important;
    }
    
    .jp-clubs-table thead th {
        font-size: 11px;
        padding: 12px 5px;
    }
    
    .club-main-row td {
        padding: 10px 5px;
        font-size: 13px;
    }
    
    .club-logo {
        width: 50px;
        height: 50px;
    }
    
    .club-outfit {
        width: 55px;
        height: 55px;
    }
    
    .rank-top-img {
        width: 28px;
        height: 28px;
    }
    
    /* Members Section Mobile */
    .club-members-section {
        padding: 15px;
    }
    
    .members-header {
        position: sticky;
        top: 0;
        background: white;
        z-index: 10;
        padding: 12px 0;
        margin-bottom: 15px;
    }
    
    /* Mobile Grid - 2 columns */
    .members-auto-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
        padding: 10px;
        max-height: none; /* Remove height limit on mobile */
    }
    
    /* Larger cards on mobile */
    .member-card {
        padding: 15px 10px;
        min-height: 160px;
        -webkit-tap-highlight-color: rgba(255, 215, 0, 0.2);
    }
    
    .member-avatar {
        width: 85px !important;
        height: 85px !important;
        margin-bottom: 10px;
    }
    
    .member-name {
        font-size: 13px !important;
        font-weight: 600;
        min-height: 32px;
        line-height: 1.4;
    }
    
    .time-stats-mini .time-badge {
        font-size: 10px !important;
        padding: 5px 8px;
        min-width: auto;
    }
    
    /* Search box mobile */
    .members-search-box input {
        padding: 12px 15px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Load more button mobile */
    .load-more-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 15px;
    }
    
    /* Detail content mobile */
    .club-detail-content {
        padding: 15px;
        margin: 10px;
    }
    
    /* Popup mobile */
    .jp-member-popup-modal .uk-modal-dialog {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    .jp-popup-content {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
        min-height: 100vh;
    }
    
    .jp-popup-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .jp-popup-avatar {
        width: 120px;
        height: 120px;
    }
    
    .jp-popup-name {
        font-size: 20px;
    }
    
    .jp-popup-stat-number {
        font-size: 28px;
    }
}

/* Landscape mode - 3 columns */
@media (max-width: 768px) and (orientation: landscape) {
    .members-auto-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    
    .member-card {
        min-height: 140px;
    }
    
    .member-avatar {
        width: 70px !important;
        height: 70px !important;
    }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .stars-col {
        display: none;
    }
    
    .members-auto-grid {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    
    .member-avatar {
        width: 75px;
        height: 75px;
    }
    
    .member-name {
        font-size: 12px;
    }
}

/* Large screens */
@media (min-width: 1440px) {
    .members-auto-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    
    .member-avatar {
        width: 80px;
        height: 80px;
    }
}