/*
 * CSF Group Buy Display Stylesheet
 * Version: 1.2.0
 * Author: CSF001
 *
 * --- STRUCTURE ---
 * 1. Global Styles (Tabs, Buttons, Base Layout)
 * 2. General Group Display Block
 * 3. User's Current Group Display Block
 * 4. Empty/Notice States
 * 5. Responsive Adjustments (Mobile)
 */

/* ============================================= */
/* 1. Global Styles (Tabs, Buttons, Base Layout) */
/* ============================================= */

/* --- Tabs --- */
.csf-group-tabs {
    display: flex;
    gap: 20px;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 16px;
}

.csf-group-tab {
    font-size: 16px;
    font-weight: 500;
    color: #666;
    padding: 8px 4px;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.csf-group-tab:hover {
    color: #333;
}

.csf-group-tab.active {
    font-weight: 600;
    color: #ff4d4f;
    border-bottom-color: #ff4d4f;
}

.csf-group-tab-content {
    padding-top: 10px;
}

/* --- Buttons (Base Styles) --- */
.csf-group-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 40px;
    padding: 0 24px;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    line-height: 1;
}

/* Primary / Default Button Style */
.csf-group-btn,
.csf-group-start-btn,
.csf-group-join-current-btn,
.csf-group-primary-btn {
    background-color: #ff4d4f;
    color: #fff;
}

.csf-group-btn:hover,
.csf-group-start-btn:hover,
.csf-group-join-current-btn:hover,
.csf-group-primary-btn:hover {
    background-color: #d9363e;
    color: #fff;
}

/* Secondary Button Style */
.csf-group-secondary-btn {
    background-color: #6c757d;
    color: #fff;
}
.csf-group-secondary-btn:hover {
    background-color: #5a6268;
}

/* Exit Button Style */
.csf-exit-btn {
    background-color: #fff;
    color: #ff4d4f;
    border-color: #ff4d4f;
}

.csf-exit-btn:hover {
    background-color: #ff4d4f;
    color: #fff;
}

/* Subtext inside buttons */
.csf-btn-subtext,
.csf-pay-btn small {
    font-size: 12px;
    margin-left: 6px;
    display: inline-block;
    line-height: 1;
}

/* ======================================= */
/* 2. General Group Display Block          */
/* ======================================= */

.csf-group-display {
    padding: 20px;
    background: #fafafa;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.csf-group-display h3 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 18px;
}

/* --- Price Section --- */
.csf-group-price {
    display: flex;
    gap: 8px;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.csf-group-discount-price {
    font-size: 24px;
    font-weight: 700;
    color: #ff4d4f;
}

.csf-group-original-price {
    font-size: 14px;
    color: #999;
    text-decoration: line-through;
}

.csf-group-price-save {
    background: #fff0f0;
    color: #ff4d4f;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
}

/* --- Progress & Time Section --- */
.csf-group-progress-container,
.csf-group-payment-progress-container {
    margin-top: 10px;
}

.csf-group-progress-text-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
}

.csf-group-progress-bar {
    width: 100%;
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.csf-group-progress-fill {
    height: 100%;
    background: #ff7875;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.csf-group-payment-fill {
    background: #52c41a;
}

/* --- Time & Status Section --- */
.csf-group-time-container {
    font-size: 14px;
    color: #666;
    margin-top: 12px;
}
.csf-group-status-display {
    font-size: 14px;
    font-weight: 600;
}
.csf-group-status-running { color: #fa8c16; }
.csf-group-status-pending-payment { color: #1890ff; }
.csf-group-status-success { color: #52c41a; }
.csf-group-status-failed { color: #f5222d; }

/* --- Users Avatars Section --- */
.csf-group-users-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
}

.csf-group-users-text {
    font-size: 14px;
    color: #333;
}

.csf-group-avatars {
    display: flex;
}

.csf-group-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #fff;
    margin-left: -8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.csf-group-avatar:first-child {
    margin-left: 0;
}
.csf-group-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Actions Area --- */
.csf-group-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.csf-group-more {
    margin-top: 16px;
    text-align: center;
}
.csf-group-more-link {
    font-size: 14px;
    color: #1890ff;
    text-decoration: none;
}
.csf-group-more-link:hover {
    text-decoration: underline;
}

/* ======================================= */
/* 3. User's Current Group Display Block   */
/* ======================================= */

.csf-group-user-display {
    border: 1px solid #ffe6e6;
    background: #fffafa;
}

.csf-group-user-display .csf-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 16px;
}

.csf-group-user-display .csf-group-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.csf-group-user-display .csf-group-status {
    font-size: 13px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 15px;
}
.csf-group-status-running { background-color: #fff7e6; color: #fa8c16; }
.csf-group-status-pending-payment { background-color: #e6f7ff; color: #1890ff; }
.csf-group-status-success { background-color: #f6ffed; color: #52c41a; }
.csf-group-status-failed { background-color: #fff1f0; color: #f5222d; }

/* Members List in User's Group */
.csf-group-members-container {
    margin-top: 20px;
}
.csf-group-members-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.csf-group-members-title {
    font-size: 15px;
    font-weight: 600;
}
.csf-group-members-count {
    font-size: 13px;
    color: #888;
}

.csf-group-members-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.csf-group-member {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 6px;
}
.csf-group-member-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: hidden;
}
.csf-group-member-name {
    flex: 1;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.csf-group-member-status {
    font-size: 12px;
    color: #888;
}
.csf-group-member-paid .csf-group-member-status { color: #52c41a; }
.csf-group-member-unpaid .csf-group-member-status { color: #f5222d; }
.csf-group-member-current {
    border-color: #ff7875;
}

.csf-group-user-actions {
    margin-top: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.csf-exit-wrapper {
    margin-left: auto;
}
.csf-exit-hint {
    font-size: 12px;
    color: #999;
    text-align: center;
    margin-top: 6px;
    display: none; /* Usually hidden on desktop */
}

/* ======================================= */
/* 4. Empty/Notice States                  */
/* ======================================= */

.csf-group-empty-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background-color: #fdfdfd;
    border: 1px dashed #e0e0e0;
    border-radius: 8px;
}

.csf-group-empty-icon {
    margin-bottom: 15px;
    color: #ff7875;
}

.csf-group-empty-notice h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.csf-group-empty-notice p {
    margin: 0;
    font-size: 14px;
    color: #888;
}

.csf-group-notice {
    padding: 12px 16px;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 16px;
}
.csf-group-warning {
    background-color: #fffbe6;
    border: 1px solid #ffe58f;
    color: #d46b08;
}

/* Special case for empty state to center the button */
.csf-group-empty-wrapper + .csf-group-actions {
    justify-content: center;
}

/* ======================================= */
/* 5. Responsive Adjustments (Mobile)      */
/* ======================================= */

@media (max-width: 768px) {
    .csf-group-display, .csf-group-user-display {
        padding: 16px;
    }

    .csf-group-tabs {
        gap: 16px;
    }
    .csf-group-tab {
        font-size: 15px;
    }

    .csf-group-btn {
        width: 100%;
        padding: 12px 0;
    }
    
    .csf-group-actions, .csf-group-user-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .csf-exit-wrapper {
        margin-left: 0;
        width: 100%;
    }
    .csf-exit-hint {
        display: block;
    }
    
    /* Responsive button text for exit button */
    .csf-desktop-text {
        display: none;
    }
    .csf-mobile-text {
        display: inline;
    }

    .csf-group-members-list {
        grid-template-columns: 1fr;
    }
} 