/**
 * Custom Product Fields - Modern Frontend Specifications Styling
 * Designed for Avvni E-Commerce Store
 * Matches Brand Aesthetic and Design System Palette
 */

/* Container & Card Isolation */
.cpf-product-specifications,
.cpf-specifications-container,
.cpf-specifications-card {
    margin: 18px 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #EAEAEA;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Layout Variations */
.cpf-layout-borderless {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    margin: 10px 0 !important;
}

.cpf-layout-borderless .cpf-card-header {
    background: transparent !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    border-bottom: 2px solid #EAEAEA !important;
}

.cpf-layout-compact .cpf-card-header {
    padding: 10px 14px !important;
}

.cpf-layout-compact .cpf-spec-label,
.cpf-layout-compact .cpf-spec-value {
    padding: 8px 14px !important;
    font-size: 12.5px !important;
}

/* Card Header */
.cpf-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    background: #F9F9F9;
    border-bottom: 1px solid #EAEAEA;
    gap: 12px;
}

.cpf-card-title-wrap {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.cpf-card-icon {
    width: 16px;
    height: 16px;
    color: #FF4F40;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.cpf-card-title {
    margin: 0;
    font-family: 'Plus Jakarta Sans', 'Jost', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 13.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #171717;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cpf-badge-count {
    font-size: 11px;
    font-weight: 600;
    color: #666666;
    background: #EEEEEE;
    padding: 3px 9px;
    border-radius: 12px;
    letter-spacing: 0.3px;
    line-height: 1.2;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Specifications Table */
.cpf-specifications-table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    margin: 0;
    border: none;
    font-size: 13px;
    line-height: 1.5;
    background: transparent;
}

.cpf-specifications-table thead {
    display: none;
}

.cpf-specifications-table tbody tr {
    background-color: #FFFFFF;
    border-bottom: 1px solid #F0F0F0;
    transition: background-color 0.15s ease;
}

.cpf-specifications-table tbody tr:hover {
    background-color: #FAFAFA;
}

.cpf-specifications-table tbody tr:last-child {
    border-bottom: none;
}

/* Smooth fade-in when collapsed rows are revealed */
.cpf-row-collapsed {
    animation: cpf-row-reveal 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cpf-row-reveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Row Label (th) */
.cpf-spec-label {
    width: 34%;
    min-width: 110px;
    max-width: 155px;
    padding: 11px 18px;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.5;
    color: #666666;
    border: none;
    text-align: left;
    vertical-align: top;
    box-sizing: border-box;
    background: transparent;
}

/* Row Value (td) */
.cpf-spec-value {
    width: 66%;
    padding: 11px 18px;
    font-weight: 500;
    font-size: 13.5px;
    line-height: 1.55;
    color: #171717;
    border: none;
    text-align: left;
    vertical-align: top;
    box-sizing: border-box;
    word-break: break-word;
    background: transparent;
}

/* Collapsible "View More / View Less" Seamless Full-Width Footer Row */
.cpf-toggle-wrap {
    padding: 0;
    margin: 0;
    background: #FFFFFF;
    border-top: 1px solid #F0F0F0;
    text-align: center;
}

.cpf-toggle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 12px 18px;
    background: #FFFFFF;
    border: none;
    border-radius: 0;
    color: #4A4A4A;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    box-shadow: none;
    outline: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cpf-toggle-btn:hover {
    background: #FAFAFA;
    color: #FF4F40;
}

.cpf-toggle-btn:focus-visible {
    background: #F7F7F7;
    outline: 2px solid #FF4F40;
    outline-offset: -2px;
}

.cpf-chevron-icon {
    width: 13px;
    height: 13px;
    color: currentColor;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cpf-toggle-btn.is-expanded .cpf-chevron-icon {
    transform: rotate(180deg);
}

/* 2-Column Grid Layout for Wide Screens */
@media (min-width: 768px) {
    .cpf-columns-2 .cpf-specifications-table tbody {
        display: flex;
        flex-wrap: wrap;
    }

    .cpf-columns-2 .cpf-specifications-table tbody tr {
        width: 50%;
        display: flex;
        box-sizing: border-box;
        border-right: 1px solid #F0F0F0;
    }

    .cpf-columns-2 .cpf-specifications-table tbody tr:nth-child(even) {
        border-right: none;
    }
}

/* Mobile Responsive Layout */
@media (max-width: 600px) {
    .cpf-card-header {
        padding: 11px 14px;
    }

    .cpf-card-title {
        font-size: 12.5px;
        letter-spacing: 0.5px;
    }

    .cpf-badge-count {
        font-size: 10.5px;
        padding: 2px 7px;
    }

    .cpf-spec-label {
        width: 38%;
        min-width: 95px;
        font-size: 12px;
        padding: 9px 12px;
    }

    .cpf-spec-value {
        width: 62%;
        font-size: 12.5px;
        padding: 9px 12px;
    }

    .cpf-toggle-wrap {
        padding: 8px 12px;
    }

    .cpf-toggle-btn {
        width: 100%;
        padding: 7px 12px;
    }
}
