/* Google Fonts Import Fallback */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,400..900;1,400..900&display=swap');

/* Modal Backdrop Overlay */
.cabinet-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 999999;
    padding: 20px;
    box-sizing: border-box;
}

/* Modal Wrapper */
.cabinet-modal-wrapper {
    background: #ffffff;
    width: 100%;
    max-width: 980px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: cabinetFadeIn 0.3s ease-out;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333333;
    border-radius: 4px;
    overflow: hidden;
}

@keyframes cabinetFadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Close Button (X) */
.cabinet-modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #2b2b2b;
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 20px;
    line-height: 28px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    font-family: Arial, sans-serif;
}
.cabinet-modal-close-btn:hover {
    background: #000000;
}

/* Split Column Layout */
.cabinet-modal-inner {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* Left panel style (image display) */
.cabinet-modal-media-panel {
    background: #949599; 
    flex: 0 0 40%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    box-sizing: border-box;
}

.cabinet-modal-main-img-wrapper {
    background: #ffffff;
    padding: 0;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 290px;
    display: block;
}

.cabinet-modal-main-img {
    display: block;
    width: 100%;
    height: auto;
}

/* Right content details panel styling */
.cabinet-modal-content-panel {
    flex: 0 0 60%;
    padding: 40px 45px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start; /* Eliminates vertical flex stretching gap */
}

/* Top Row: Title & Description on Left, Technical Diagram on Right */
.cabinet-modal-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 22px;
}

.cabinet-modal-title-desc-wrap {
    flex: 1;
    min-width: 0;
}

/* Title Font: Playfair Display */
.cabinet-modal-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 42px;
    line-height: 1.1;
    margin: 0 0 10px 0;
    font-weight: 500;
    color: #1a1a1a;
}

.cabinet-modal-tech-img {
    max-width: 95px;
    flex-shrink: 0;
    margin-top: 5px;
}
.cabinet-modal-tech-img img {
    width: 100%;
    height: auto;
    display: block;
}

/* Description Text Styling: Inter font & Tight Spacing */
.cabinet-modal-description {
    margin-bottom: 0;
}

.cabinet-modal-description p {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #555555;
    line-height: 1.55;
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 400;
}

.cabinet-modal-description p:last-child {
    margin-bottom: 0;
}

.cabinet-modal-description p:empty {
    display: none;
}

/* Section Headings: Inter font */
.cabinet-modal-details-section h3,
.cabinet-modal-colors-section h3,
.cabinet-modal-species-section h3,
.cabinet-modal-extra-section h3 {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: #1a1a1a;
    margin: 0 0 10px 0;
    text-transform: none;
}

/* Wood Species Section & Pills */
.cabinet-modal-species-section {
    margin-bottom: 20px;
}
.cabinet-modal-species-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.cabinet-modal-species-pill {
    background: #f2f3f5;
    color: #333;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 16px;
    border: 1px solid #e2e4e8;
}

/* Door Details List */
.cabinet-modal-details-section {
    margin-bottom: 22px;
}

.cabinet-modal-details-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cabinet-modal-details-section li {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #555555;
    font-size: 14px;
    margin-bottom: 6px;
    position: relative;
    padding-left: 16px;
    line-height: 1.5;
}

.cabinet-modal-details-section li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #777777;
    font-size: 14px;
}

/* Swatches Grid */
.cabinet-modal-colors-section {
    margin-bottom: 15px;
}

.cabinet-modal-colors-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.cabinet-modal-color-item {
    text-align: center;
}

.cabinet-modal-color-swatch {
    width: 100%;
    padding-top: 100%; /* square ratio constraint */
    border-radius: 6px;
    background-size: cover;
    background-position: center;
    border: 1px solid #eaeaea;
    margin-bottom: 6px;
}

.cabinet-modal-color-label {
    display: block;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    line-height: 1.3;
    color: #2b2b2b;
    font-weight: 500;
}

/* Color Swatch Subtitle / Species Note */
.cabinet-modal-color-subtitle {
    display: block;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 10px;
    line-height: 1.2;
    color: #777777;
    margin-top: 3px;
}

/* Extra Custom Sections */
.cabinet-modal-extra-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px dashed #e0e0e0;
}

.cabinet-modal-extra-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.cabinet-modal-extra-section li {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #555555;
    font-size: 14px;
    margin-bottom: 6px;
    position: relative;
    padding-left: 16px;
    line-height: 1.5;
}

.cabinet-modal-extra-section li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #777777;
}

/* Prevent body scrolling while modal is active */
body.cabinet-modal-open {
    overflow: hidden !important;
}

/* Responsive Scaling: Stacked panels on screens under 768px */
@media (max-width: 768px) {
    .cabinet-modal-overlay {
        align-items: flex-start;
        overflow-y: auto;
    }
    .cabinet-modal-inner {
        flex-direction: column;
    }
    .cabinet-modal-media-panel, 
    .cabinet-modal-content-panel {
        flex: 0 0 100%;
        width: 100%;
    }
    .cabinet-modal-media-panel {
        padding: 30px;
    }
    .cabinet-modal-content-panel {
        padding: 30px 20px;
    }
    .cabinet-modal-colors-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}