/* ==========================================================================
   Elsafwa Trading Est. - Catalog Hub Style Guide
   Isolated namespace styling for tires and batteries hub
   ========================================================================== */

/* 1. Catalog Grid and Cards styling */
.catalog-hub-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.catalog-hub-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.catalog-hub-card .media {
    aspect-ratio: 4 / 3;
    background: #f9fafb;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 12px;
}

.catalog-hub-card .media img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.catalog-hub-card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.catalog-hub-card-brand {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #b97a22;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.catalog-hub-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.catalog-hub-card-meta {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 12px;
}

.catalog-hub-card-specs {
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 0.8125rem;
    color: #4b5563;
    margin-bottom: 16px;
}

.catalog-hub-card-specs span {
    display: inline-block;
}

.catalog-hub-card-specs strong {
    color: #111827;
}

.catalog-hub-card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.catalog-hub-card-actions .btn {
    padding: 10px;
    font-size: 0.8125rem;
    text-align: center;
}

/* 2. Drawer Backdrop (Overlay) */
.catalog-hub-drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    justify-content: flex-end;
}

.catalog-hub-drawer-backdrop.open {
    opacity: 1;
    visibility: visible;
}

/* 3. Drawer Body Slider */
.catalog-hub-drawer {
    width: 100%;
    max-width: 800px;
    background: #fff;
    height: 100%;
    box-shadow: -4px 0 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.catalog-hub-drawer-backdrop.open .catalog-hub-drawer {
    transform: translateX(0);
}

.catalog-hub-drawer-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #1e3a5f;
    color: #fff;
}

.catalog-hub-drawer-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
}

.catalog-hub-drawer-close {
    background: transparent;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #fff;
    line-height: 1;
    padding: 0 4px;
}

.catalog-hub-drawer-close:hover {
    color: #b97a22;
}

.catalog-hub-drawer-body {
    flex-grow: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 4. Drawer Content Layout */
.drawer-intro-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
}

@media (max-width: 767px) {
    .drawer-intro-grid {
        grid-template-columns: 1fr;
    }
}

.drawer-gallery {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drawer-main-image {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    aspect-ratio: 4/3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    overflow: hidden;
}

.drawer-main-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.drawer-thumbnails {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.drawer-thumbnail-btn {
    border: 2px solid #e5e7eb;
    background: #fff;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    width: 60px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.drawer-thumbnail-btn.active {
    border-color: #b97a22;
}

.drawer-thumbnail-btn img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.drawer-meta-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.drawer-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.drawer-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.drawer-badge--brand {
    background-color: #fef3c7;
    color: #d97706;
}

.drawer-badge--category {
    background-color: #dbeafe;
    color: #2563eb;
}

.drawer-badge--tech {
    background-color: #dcfce7;
    color: #166534;
}

.drawer-meta-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    font-size: 0.875rem;
}

@media (max-width: 480px) {
    .drawer-meta-list {
        grid-template-columns: 1fr;
    }
}

.drawer-meta-list-item strong {
    color: #1f2937;
}

.drawer-meta-list-item span {
    color: #4b5563;
}

.drawer-description {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: #4b5563;
}

.drawer-features {
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.drawer-features h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0 0 10px 0;
}

.drawer-features-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    padding-left: 0;
    list-style: none;
    font-size: 0.875rem;
    color: #4b5563;
}

@media (max-width: 480px) {
    .drawer-features-list {
        grid-template-columns: 1fr;
    }
}

.drawer-features-list li {
    position: relative;
    padding-left: 16px;
}

.drawer-features-list li::before {
    content: "•";
    color: #b97a22;
    font-size: 1.25rem;
    position: absolute;
    left: 0;
    top: -2px;
}

/* 5. Inquire / WhatsApp Section */
.drawer-inquire-section {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

@media (max-width: 580px) {
    .drawer-inquire-section {
        flex-direction: column;
        align-items: stretch;
    }
}

.drawer-inquire-text {
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.4;
}

.drawer-inquire-text strong {
    color: #111827;
}

.btn-whatsapp-inquire {
    background-color: #25d366;
    color: #fff;
    border: none;
    padding: 12px 20px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.btn-whatsapp-inquire:hover {
    background-color: #128c7e;
    color: #fff;
}

.btn-whatsapp-inquire svg {
    fill: currentColor;
    width: 20px;
    height: 20px;
}

/* 6. Specifications Table Section */
.drawer-specs-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.drawer-specs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.drawer-specs-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e3a5f;
    margin: 0;
}

.drawer-table-search {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.8125rem;
    width: 100%;
    max-width: 240px;
    outline: none;
}

.drawer-table-search:focus {
    border-color: #b97a22;
}

.drawer-specs-table-wrap {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.drawer-specs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    text-align: left;
}

.drawer-specs-table th {
    position: sticky;
    top: 0;
    background-color: #f3f4f6;
    color: #374151;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 2px solid #e5e7eb;
    z-index: 2;
}

.drawer-specs-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    color: #4b5563;
}

.drawer-specs-table tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.drawer-specs-table tbody tr:hover {
    background-color: #f9fafb;
}

.drawer-specs-table tbody tr.selected {
    background-color: #fef3c7;
    font-weight: 600;
}

.drawer-specs-table tbody tr.hidden-row {
    display: none;
}

/* Empty matching specs row */
.specs-empty-row {
    text-align: center;
    padding: 24px;
    color: #6b7280;
    font-style: italic;
}

/* Null value fallback formatting */
.spec-null-val {
    color: #9ca3af;
}

/* Helper details drawer animation helper */
body.drawer-open {
    overflow: hidden;
}

/* Matching / non-matching rows styling */
.drawer-specs-table tbody tr.spec-non-match-row {
    opacity: 0.6;
}

.drawer-specs-table tbody tr.spec-match-row {
    background-color: #f0fdf4;
    color: #15803d;
}

.drawer-specs-table tbody tr.spec-match-row td strong {
    color: #15803d;
}

.drawer-specs-table tbody tr.spec-match-row.selected {
    background-color: #fef3c7;
    color: #111827;
}
