/**
 * Court Color Picker — Frontend Styles
 *
 * @package Court_Color_Picker
 * @since   1.0.0
 */

/* ── Container ── */
.ccp-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

/* ── Tabs ── */
.ccp-tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.ccp-tab {
    padding: 10px 15px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    background: #eee;
    border: 2px solid #ddd;
    border-radius: 5px;
    transition: all 0.2s;
    color: #555;
    text-transform: uppercase;
    flex: 1;
    min-width: 120px;
    text-align: center;
    user-select: none;
}

.ccp-tab:hover {
    background: #e0e0e0;
}

.ccp-tab.active {
    background: #d00;
    color: #fff;
    border-color: #b00;
}

/* ── Court SVG Wrapper ── */
.ccp-court-svg-wrapper {
    text-align: center;
    margin-bottom: 30px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    max-width: 900px;
    overflow: hidden;
}

.ccp-court-svg {
    width: 100%;
    height: auto;
    max-width: 800px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin: 0 auto;
    display: block;
}

/* ── Palettes (rộng hơn khung sân 900px — đủ chỗ 3 cột màu, không cần cuộn ngang) ── */
.ccp-palettes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 1220px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.ccp-palette-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
}

.ccp-palette-row .ccp-palette-group {
    flex: 0 0 auto;
    /* Không nén nhỏ hơn nội dung — tránh grid chồng lên nhau */
}

.ccp-palette-group {
    display: none;
}

.ccp-palette-group.active {
    display: block;
}

.ccp-palette-title {
    color: #d00;
    font-weight: bold;
    text-transform: uppercase;
    text-align: left;
    margin-bottom: 12px;
    font-size: 15px;
    letter-spacing: 0.5px;
}


.ccp-colors {
    --ccp-swatch: 38.5px;
    --ccp-swatch-gap: 5px;
    display: grid;
    grid-template-columns: repeat(6, var(--ccp-swatch));
    gap: var(--ccp-swatch-gap);
    justify-content: start;
}

/* ── Color Swatches ── */
.ccp-color-swatch {
    box-sizing: border-box;
    width: var(--ccp-swatch, 28px);
    height: var(--ccp-swatch, 28px);
    cursor: pointer;
    border: 1px solid #ccc;
    border-radius: 3px;
    transition: transform 0.1s ease, border-color 0.1s ease;
}

.ccp-color-swatch:hover,
.ccp-color-swatch:active {
    transform: scale(1.1);
    border-color: #333;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* ── SVG Area Transitions ── */
.area-border,
.area-court,
.area-nvz,
.area-key {
    transition: fill 0.3s ease;
}

/* ── Notes ── */
.ccp-notes {
    margin-top: 25px;
    margin-left: auto;
    margin-right: auto;
    max-width: 900px;
    font-size: 13px;
    font-style: italic;
    color: #555;
    line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .ccp-tabs {
        gap: 5px;
    }

    .ccp-tab {
        font-size: 13px;
        padding: 8px 5px;
        min-width: 30%;
    }

    .ccp-colors {
        gap: 5px;    
        grid-template-columns: repeat(8, var(--ccp-swatch));
    }

    .ccp-court-svg-wrapper {
        margin-bottom: 20px;
    }

    .ccp-palette-row {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        flex-direction: column;
    }
    .ccp-colors {
        --ccp-swatch: 31.5px;
        --ccp-swatch-gap: 5px;
        display: grid;
        gap: var(--ccp-swatch-gap);
        justify-content: start;
        width: 100%;
    }
}


@media (max-width: 650px) {
    .ccp-tabs {
        gap: 5px;
    }

    .ccp-tab {
        font-size: 13px;
        padding: 8px 5px;
        min-width: 30%;
    }

    .ccp-colors {
        gap: 5px;    
    }

    .ccp-court-svg-wrapper {
        margin-bottom: 20px;
    }

    .ccp-palette-row {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        flex-direction: column;
    }
    .ccp-colors {
        --ccp-swatch: 31.5px;
        --ccp-swatch-gap: 5px;
        display: grid;
        grid-template-columns: repeat(10, var(--ccp-swatch))!important;
        gap: var(--ccp-swatch-gap);
        justify-content: start;
        width: 100%;
    }
    .ccp-palette-group.active{width: 100%;}
 
    .ccp-colors{
        grid-template-columns:repeat(10, 1fr) !important;
        gap:5px;
        width:100%;
    }

    .ccp-color-swatch{
        width:100% !important;
        aspect-ratio:1/1;
    }

}