/* Styles for both editor preview and frontend display */

/* Block placeholder */
.abato-product-block-placeholder {
    padding: 40px;
    text-align: center;
    background: #f0f0f1;
    border: 2px dashed #c3c4c7;
    border-radius: 4px;
    color: #646970;
}

/* Loading state */
.abato-product-block-loading {
    padding: 40px;
    text-align: center;
    background: #f8f9fa;
    border-radius: 4px;
}

.abato-product-block-loading p {
    margin-top: 10px;
    color: #646970;
}

/* Block preview in editor */
.abato-product-block-preview {
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.abato-product-block-preview__header {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #17456F 0%, #17456F 100%);
    color: #fff;
}

.abato-product-block-preview__image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.abato-product-block-preview__info {
    flex: 1;
}

.abato-product-block-preview__title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.abato-product-block-preview__brand {
    margin: 0 0 4px;
    font-size: 14px;
    opacity: 0.9;
}

.abato-product-block-preview__type {
    margin: 0;
    font-size: 12px;
    opacity: 0.7;
}

.abato-product-block-preview__sections {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e2e4e7;
    flex-wrap: wrap;
}

.abato-product-block-preview__section-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 11px;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Compact style */
.abato-product-block-preview--compact .abato-product-block-preview__header {
    padding: 12px 16px;
}

.abato-product-block-preview--compact .abato-product-block-preview__image {
    width: 50px;
    height: 50px;
}

.abato-product-block-preview--compact .abato-product-block-preview__title {
    font-size: 14px;
    margin-bottom: 4px;
}

.abato-product-block-preview--compact .abato-product-block-preview__brand,
.abato-product-block-preview--compact .abato-product-block-preview__type {
    font-size: 11px;
}

/* Specs only style */
.abato-product-block-preview--specs-only .abato-product-block-preview__header {
    background: #f0f0f1;
    color: #1d2327;
}

.abato-product-block-preview--specs-only .abato-product-block-preview__title {
    color: #1d2327;
}

/* ==========================================================================
   Frontend Styles
   ========================================================================== */

.abato-product {
    --product-primary: #17456F;
    --product-secondary: #17456F;
    --product-accent: #f59e0b;
    --product-border: #e2e4e7;
    --product-bg-light: #f8f9fa;
    --product-text: #1d2327;
    --product-text-soft: #646970;
}

.abato-product {
    width: 100%;
    max-width: none;
    margin: 0 auto 3rem;
    color: var(--product-text);
}

/* Product Header */
.abato-product__header {
    display: flex;
    gap: 24px;
    padding: 32px;
    background: linear-gradient(135deg, var(--product-primary) 0%, var(--product-secondary) 100%);
    color: #fff;
    border-radius: 12px 12px 0 0;
}

.abato-product__image {
    flex-shrink: 0;
}

.abato-product__image img {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.abato-product__title-area {
    flex: 1;
}

.abato-product__title {
    margin: 0 0 12px;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
}

.abato-product__meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.abato-product__brand,
.abato-product__type {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.2;
}

/* Model codes in header */
.abato-product__models {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.abato-product__models-label {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.8;
}

.abato-product__model-code {
    display: inline-block;
    padding: 4px 10px;
    background: var(--product-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    font-family: monospace;
}

/* Emissions in header */
.abato-product__emissions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.abato-product__emissions-label {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.8;
}

.abato-product__emissions-value {
    font-size: 12px;
    font-weight: 600;
}

/* Content Sections */
.abato-product__content {
    background: #fff;
    border: 1px solid var(--product-border);
    border-top: none;
    border-radius: 0 0 12px 12px;
}

.abato-product__section {
    padding: 24px 32px;
    border-bottom: 1px solid var(--product-border);
}

.abato-product__section:last-child {
    border-bottom: none;
}

.abato-product__section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 20px;
    font-size: 16px;
    font-weight: 600;
    color: var(--product-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.abato-product__section-title::before {
    display: none;
}

.abato-product__section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    min-width: 40px;
    background: linear-gradient(90deg, rgba(23, 69, 111, 0.22) 0%, rgba(23, 69, 111, 0) 100%);
}

/* Specs Grid */
.abato-product__specs-grid {
    display: grid;
    --abato-product-spec-columns-desktop: 3;
    --abato-product-spec-columns-tablet: 2;
    --abato-product-spec-columns-mobile: 1;
    grid-template-columns: repeat(var(--abato-product-spec-columns-desktop), minmax(0, 1fr));
    gap: 16px;
}

.abato-product__spec-item {
    margin: 0;
    background: #fff;
    border: 1px solid #dbe3ee;
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
        0 1px 2px rgba(23, 69, 111, 0.05),
        0 10px 24px rgba(23, 69, 111, 0.05);
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.abato-product__spec-item:hover {
    border-color: #c7d4e4;
    transform: translateY(-2px);
    box-shadow:
        0 2px 6px rgba(23, 69, 111, 0.08),
        0 16px 32px rgba(23, 69, 111, 0.08);
}

.abato-product__spec-label {
    display: block;
    margin: 0;
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--product-primary) 0%, var(--product-secondary) 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.abato-product__spec-value {
    display: block;
    margin: 0;
    padding: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
    line-height: 1.35;
}

/* Power Ratings Table */
.abato-product__table-label {
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--product-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.abato-product__table-wrapper {
    margin-bottom: 18px;
    overflow-x: auto;
}

.abato-product__table-wrapper:last-child {
    margin-bottom: 0;
}

.abato-product__power-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.abato-product__power-table th,
.abato-product__power-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--product-border);
}

.abato-product__power-table th {
    background: var(--product-bg-light);
    font-weight: 600;
    color: var(--product-primary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.abato-product__power-table td {
    color: #1d2327;
}

.abato-product__power-table tbody tr:nth-child(even) td {
    background: #fbfcfd;
}

.abato-product__power-table tr:last-child td {
    border-bottom: none;
}

.abato-product__power-table tr:hover td {
    background: #f0f7ff;
}

.abato-product__power-highlight {
    font-weight: 700;
    color: var(--product-primary);
}

/* Power Ratings Groups (for PSI-style with fuel types) */
.abato-product__power-group {
    margin-bottom: 24px;
}

.abato-product__power-group:last-child {
    margin-bottom: 0;
}

.abato-product__power-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--product-primary) 0%, var(--product-secondary) 100%);
    cursor: pointer;
    list-style: none;
    border-radius: 8px;
}

.abato-product__power-group-toggle::-webkit-details-marker {
    display: none;
}

.abato-product__power-group-title {
    display: block;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.02em;
}

.abato-product__power-group-content {
    padding: 14px 0 0;
}

/* Downloads List */
.abato-product__downloads-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.abato-product__download-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--product-bg-light);
    border-radius: 8px;
    transition: background 0.2s, transform 0.2s;
}

.abato-product__download-item:hover {
    background: #e3f2fd;
    transform: translateX(4px);
}

.abato-product__download-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ef4444;
    color: #fff;
    border-radius: 8px;
}

.abato-product__download-info {
    flex: 1;
    min-width: 0;
}

.abato-product__download-label {
    display: block;
    font-weight: 600;
    color: #1d2327;
    margin-bottom: 2px;
    overflow-wrap: break-word;
    word-break: break-word;
}

.abato-product__download-language {
    display: inline-block;
    padding: 2px 8px;
    background: #e3f2fd;
    color: #1565c0;
    font-size: 10px;
    font-weight: 600;
    border-radius: 999px;
    text-transform: uppercase;
}

.abato-product__download-link {
    text-decoration: none;
    color: inherit;
}

/* Gallery */
.abato-product__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.abato-product__gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
}

.abato-product__gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.abato-product__gallery-item:hover img {
    transform: scale(1.05);
}

/* Compact Style */
.abato-product--compact .abato-product__header {
    padding: 20px;
}

.abato-product--compact .abato-product__image img {
    width: 120px;
    height: 120px;
}

.abato-product--compact .abato-product__title {
    font-size: 20px;
}

.abato-product--compact .abato-product__section {
    padding: 16px 20px;
}

/* Specs Only Style */
.abato-product--specs-only .abato-product__header {
    display: none;
}

.abato-product--specs-only .abato-product__content {
    border-radius: 12px;
    border-top: 1px solid var(--product-border);
}

/* ==========================================================================
   Sidebar Layout
   ========================================================================== */

/* Two-column layout with sidebar */
.abato-product--with-sidebar {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.abato-product__main {
    min-width: 0;
}

/* Sidebar Styles */
.abato-product__sidebar {
    position: sticky;
    top: 24px;
    margin-bottom: 3rem;
}

.abato-product__related {
    background: #fff;
    border: 1px solid var(--product-border);
    border-radius: 12px;
    overflow: hidden;
}

.abato-product__related-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 16px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--product-primary) 0%, var(--product-secondary) 100%);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.abato-product__related-section {
    padding: 16px;
    border-bottom: 1px solid var(--product-border);
}

.abato-product__related-section:last-child {
    border-bottom: none;
}

.abato-product__related-section-title {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--product-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.abato-product__related-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.abato-product__related-card {
    display: flex;
    gap: 12px;
    padding: 10px;
    background: var(--product-bg-light);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s, transform 0.2s;
}

.abato-product__related-card:hover {
    background: #e3f2fd;
    transform: translateX(4px);
}

.abato-product__related-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--product-border);
}

.abato-product__related-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.abato-product__related-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.abato-product__related-name {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--product-text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.abato-product__related-brand,
.abato-product__related-type {
    font-size: 11px;
    color: #646970;
}

/* Collapsible Category Groups */
.abato-product__category-group {
    margin-bottom: 8px;
    border-radius: 8px;
    overflow: hidden;
}

.abato-product__category-group:last-child {
    margin-bottom: 0;
}

.abato-product__category-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px 14px;
    background: var(--product-bg-light);
    border: 1px solid var(--product-border);
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
    transition: background 0.2s, border-color 0.2s;
}

.abato-product__category-toggle::-webkit-details-marker {
    display: none;
}

.abato-product__category-toggle:hover {
    background: #e3f2fd;
    border-color: #90caf9;
}

.abato-product__category-group[open] .abato-product__category-toggle {
    border-radius: 8px 8px 0 0;
    border-bottom-color: transparent;
}

.abato-product__category-name {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--product-primary);
    text-align: left;
}

.abato-product__category-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: var(--product-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: 11px;
}

.abato-product__category-arrow {
    flex-shrink: 0;
    color: #646970;
    transition: transform 0.2s;
}

.abato-product__category-group[open] .abato-product__category-arrow {
    transform: rotate(180deg);
}

.abato-product__category-group > .abato-product__related-grid {
    padding: 12px;
    background: #fff;
    border: 1px solid var(--product-border);
    border-top: none;
    border-radius: 0 0 8px 8px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media screen and (max-width: 1024px) {
    /* Stack sidebar below main content on tablets */
    .abato-product--with-sidebar {
        grid-template-columns: 1fr;
    }

    .abato-product__sidebar {
        position: static;
    }

    .abato-product__related-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .abato-product__header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px;
    }

    .abato-product__image img {
        width: 150px;
        height: 150px;
    }

    .abato-product__title {
        font-size: 24px;
    }

    .abato-product__meta {
        justify-content: center;
    }

    .abato-product__section {
        padding: 20px;
    }

    .abato-product__power-section-toggle {
        padding: 13px 14px;
    }

    .abato-product__power-section-title {
        font-size: 14px;
    }

    .abato-product__power-section-content,
    .abato-product__power-group-content {
        padding: 12px;
    }

    .abato-product__power-group-toggle {
        padding: 11px 12px;
    }

    .abato-product__specs-grid {
        grid-template-columns: repeat(var(--abato-product-spec-columns-mobile), minmax(0, 1fr));
    }

    .abato-product__power-table {
        font-size: 12px;
    }

    .abato-product__power-table th,
    .abato-product__power-table td {
        padding: 10px 8px;
    }

    .abato-product__table-label {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .abato-product__downloads-list {
        grid-template-columns: 1fr;
    }

    .abato-product__gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Single column for related products on mobile */
    .abato-product__related-grid {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 1024px) and (min-width: 769px) {
    .abato-product__specs-grid {
        grid-template-columns: repeat(var(--abato-product-spec-columns-tablet), minmax(0, 1fr));
    }
}
