/**
 * Member Portal: Competitors List Styling
 */
.competitors-list-section {
    padding-top: 40px;
    padding-bottom: 100px;
    background: #fdfdfd;
}

.competitors-list-section .container {
    max-width: 96% !important;
    width: 96%;
}

.member-competitors-container {
    max-width: 100%;
    margin: 0 auto;
}

/* Modal System Styles */
.competitors-modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    justify-content: center;
    align-items: center;
}

.competitors-modal.active {
    display: flex;
}

.modal-content-card {
    background-color: #fff;
    width: 90%;
    max-width: 600px;
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modalPop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header-box {
    padding: 20px 30px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header-box h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #0f172a;
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #64748b;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close-modal:hover {
    color: #ef4444;
}

.modal-body-content {
    padding: 30px;
}

.modal-team-name {
    font-size: 1.4rem;
    font-weight: 900;
    color: #1e40af;
    margin-bottom: 20px;
    text-align: center;
}

.modal-members-table {
    width: 100%;
    border-collapse: collapse;
}

.modal-members-table th {
    text-align: left;
    padding: 10px;
    color: #64748b;
    font-size: 0.75rem;
    text-transform: uppercase;
    border-bottom: 2px solid #e2e8f0;
}

.modal-members-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
}

.modal-members-table tr:last-child td {
    border-bottom: none;
}

.modal-ath-name {
    font-weight: 700;
    color: #1e293b;
}

.team-link {
    color: #1e40af;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}

.team-link:hover {
    color: #2563eb;
}

/* Nút bấm xem Card mini trên Bảng */
.btn-mini-card {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 5px;
}
.btn-mini-card:hover {
    background: #2563eb;
    color: white;
}

/* Category Card */
.member-category-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    margin-bottom: 50px;
    overflow: hidden;
    border: 1px solid #f1f5f9;
}

.member-category-card .card-header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    padding: 25px 35px;
    color: white;
}

.member-category-card .card-header h2 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 1px;
}

.member-category-card .card-header h2 i {
    margin-right: 15px;
    color: #fbbf24;
}

.member-level-block {
    padding: 30px 35px;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
}

.member-level-block:not(:first-child) {
    border-top: 2px dashed #f1f5f9;
}

.member-level-block:last-child {
    border-bottom: none;
}

.level-label {
    font-size: 1.2rem;
    color: #1e40af;
    font-weight: 800;
    margin-bottom: 25px;
    padding: 10px 20px;
    background: #f8fafc;
    border-left: 5px solid #3b82f6;
    border-radius: 0 8px 8px 0;
    display: flex;
    align-items: center;
    width: fit-content;
}

/* Member Table */
.member-table-competitors {
    width: 100%;
    border-collapse: collapse;
}

.member-table-competitors th {
    text-align: left;
    padding: 15px;
    background: #f8fafc;
    color: #64748b;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

.member-table-competitors td {
    padding: 15px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    font-size: 1rem;
}

.member-table-competitors tr:hover {
    background: #f1f5f9;
}

.name-col {
    font-weight: 700;
    color: #2563eb;
}

.event-col {
    color: #64748b;
    font-style: italic;
    font-size: 0.9rem;
}

.unit-col {
    font-weight: 600;
}

/* States */
.status-box-placeholder {
    padding: 100px 20px;
    text-align: center;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    margin-top: 40px;
    position: relative;
    z-index: 10;
}

.icon-pulse {
    width: 80px;
    height: 80px;
    background: #eff6ff;
    color: #3b82f6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.status-box-placeholder h3 {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 10px;
}

.status-box-placeholder p {
    color: #64748b;
    font-size: 1.1rem;
}

.member-loading {
    padding: 100px;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Filter Box */
.competitors-filter-box {
    background: #fff;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    margin-bottom: 30px;
    border: 1px solid #f1f5f9;
}

.filter-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.filter-group {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.filter-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    color: #1e293b;
    outline: none;
    transition: all 0.3s ease;
    background: #f8fafc;
    box-sizing: border-box;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-group input:focus,
.filter-group select:focus {
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-group {
    flex: 2;
}

/* Mobile Optimization: Flatter Layout & Wide Width */
@media (max-width: 768px) {
    .competitors-filter-box {
        padding: 15px;
    }
    .filter-group {
        min-width: 100%;
    }
    .competitors-list-section {
        padding-top: 20px;
        background: #f8fafc; /* Lighter background for the whole section */
    }
    
    .competitors-list-section .container {
        max-width: 98% !important; /* Mở rộng tối đa bề ngang */
        width: 98%;
        padding-left: 5px;
        padding-right: 5px;
    }

    .member-category-card {
        background: transparent;
        border: none;
        box-shadow: none;
        margin-bottom: 25px;
        border-radius: 0;
    }

    .member-category-card .card-header {
        padding: 12px 15px;
        border-radius: 10px;
        margin-bottom: 10px;
    }

    .member-category-card .card-header h2 {
        font-size: 1.1rem; /* Thu nhỏ tiêu đề nhóm */
        text-align: center;
    }

    .member-table-competitors thead { display: none; }
    
    .member-table-competitors tr {
        display: block;
        background: #ffffff;
        border-radius: 12px;
        margin: 0 0 15px 0 !important;
        padding: 15px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        border: 1px solid #e2e8f0;
        position: relative;
    }

    .member-table-competitors td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px dashed #f1f5f9;
        font-size: 0.85rem;
    }

    .member-table-competitors td:last-child {
        border-bottom: none;
    }

    .member-table-competitors td::before {
        content: attr(data-label);
        font-weight: 500;
        color: #94a3b8;
        font-size: 0.75rem;
        text-transform: uppercase;
        flex-shrink: 0;
    }

    .member-table-competitors td.col-team-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .member-table-competitors td.col-team-info::before {
        margin-bottom: 5px;
    }
    
    .member-table-competitors td.col-team-info .member-team-view {
        width: 100%;
    }


    .member-level-block { padding: 10px 5px; } /* Giảm tối đa padding lùi biên */
    
    .member-level-block:not(:first-child) {
        border-top: none;
        margin-top: 5px;
    }

    .level-label { 
        width: 100%; 
        font-size: 0.95rem; /* Thu nhỏ tiêu đề cấp độ */
        margin-bottom: 12px;
        padding: 8px 12px;
        background: #f1f5f9;
        border-left: 4px solid #3b82f6;
        border-radius: 6px;
    }
    
    .name-col { font-size: 0.95rem; color: #1e40af; }
    .event-col { font-size: 0.85rem; font-style: normal; }

    #btnDownloadCard {
        display: none !important; /* Hide download card button on mobile */
    }
}

/* Entry Badges */
.entry-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    margin-bottom: 5px;
}
.badge-individual { background: #e0f2fe; color: #0369a1; }
.badge-team { background: #fef3c7; color: #92400e; }

/* Team Display */
.team-row-name { font-size: 1.1rem; font-weight: 800; color: #1e40af; margin-bottom: 5px; }
.member-sub-list { margin-top: 10px; padding: 10px; background: #f8fafc; border-radius: 8px; border-left: 3px solid #3b82f6; }
.msl-title { font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; margin-bottom: 5px; }

/* Thành viên trong Đội (Vertical Layout) */
.msl-names-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.msl-member-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.msl-mem-info {
    display: flex;
    flex-direction: column;
    line-height: 1.4;
}

.msl-mem-name {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
}

.msl-mem-meta {
    font-size: 0.8rem;
    color: #64748b;
}

/* Spinner loader cho iframe card */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: iframeSpin 1s linear infinite;
}

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

.btn-download-card:hover {
    background: #1e3a8a !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.card-preview-content {
    animation: zoomIn 0.3s ease-out;
}
@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Summary Mode Styles */
.summary-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.summary-card {
    background: white;
    border-radius: 24px;
    padding: 40px 30px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.summary-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    border-color: #3b82f6;
}

.summary-card .accent-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--primary-blue);
}

.summary-card h3 {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 20px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.summary-card .count-number {
    font-size: 4.5rem;
    font-weight: 900;
    color: #1e293b;
    line-height: 1;
    margin-bottom: 15px;
    display: block;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.02);
}

.summary-card .count-label {
    color: #94a3b8;
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

@media (max-width: 768px) {
    .summary-card {
        padding: 30px 20px;
        border-radius: 16px;
        margin: 0 5px;
    }
    .summary-card .count-number {
        font-size: 3.5rem;
    }
    .summary-card h3 {
        font-size: 0.9rem;
    }
}
