/* Roof Preview Plugin Styles */

.roof-preview-container {
    font-family: 'NotoSansThai-regular';
}

.roof-preview-container .active img {
    border: 0px !important;
}

.roof-preview-wrapper {
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

/* Left Section: Main Image */
.roof-preview-main {
    flex: 1;
    display: flex;
}

.main-image-container-color {
    margin-bottom: 20px;
    max-height: 500px;
    margin: 0 10px 10px 10px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 50%, #e9ecef 100%);
    padding: 0 20px 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.main-image-container-color img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    transition: transform 0.3s ease;
    filter: drop-shadow(8px 8px 16px rgba(0, 0, 0, 0.15)) 
            drop-shadow(4px 4px 8px rgba(0, 0, 0, 0.1));
}
.main-image-container-project {
    margin-bottom: 20px;
    margin: 10px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    min-height: 500px;
    position: relative;
}

.main-image-container-project img {
    width: 100%;
    height: 100%;
    max-height: 500px;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.3s ease;
}

/* Hide inactive containers */
.main-image-container-color:not(.active),
.main-image-container-project:not(.active) {
    display: none;
}

/* Show active containers */
.main-image-container-color.active,
.main-image-container-project.active {
    display: flex;
    width: 100%;
}

.main-image-container:hover img {
    transform: scale(1.02);
}

/* Gallery and Color Container */
.gallery-color-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

/* Project Gallery */
.project-gallery {
    flex: 0 0 100px;
}

/* Desktop Gallery - Vertical */
.project-gallery-desktop {
    display: block;
}

.project-gallery-mobile {
    display: none;
}

.gallery-vertical {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

/* Mobile Gallery - Horizontal */
.gallery-horizontal {
    display: flex;
    flex-direction: row;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 0;
    max-height: 120px;
}

.gallery-vertical::-webkit-scrollbar {
    width: 6px;
}

.gallery-vertical::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.gallery-vertical::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.gallery-vertical::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.gallery-horizontal::-webkit-scrollbar {
    height: 6px;
}

.gallery-horizontal::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.gallery-horizontal::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.gallery-horizontal::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.gallery-item {
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
    width: 100%;
    aspect-ratio: 1;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.gallery-item.active {
    border-color: #0d223b;
    transform: translateY(-2px);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

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

/* Right Section: Product Info */
.roof-preview-info {
    flex: 1;
    color: #0d223b;
}

.product-header {
    margin-bottom: 30px;
}

.product-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #0d223b;
    margin-bottom: 0px !important;
    line-height: 1.2;
}

.product-subtitle {
    font-size: 2rem;
    color: #0d223b;
    margin: 0 0 15px 0;
    font-weight: 500;
}

.divider {
    height: 1px;
    background: linear-gradient(to right, #e5e7eb, transparent);
    margin: 15px 0;
}

/* Color Selection */
.color-selection {
    flex: 1;
    margin-bottom: 30px;
}

.color-category-container{
    display: flex;
    gap: 50px;
}

.color-category h3 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #374151;
    margin: 0 0 15px 0;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.color-item {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
}

.color-item:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.color-item.active {
    border: 3px solid #0d223b;
    transform: scale(1.1);
}

.color-item::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: rgba(30, 58, 138, 0.9);
    color: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    border: 2px solid white;
}

.color-item.active::after {
    opacity: 1;
}

.color-dropdown {
    margin-top: 20px;
}

.color-dropdown select {
    width: 100%;
    padding: 5px 10px 5px 40px;
    border: 1.5px solid #0d223b;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

/* Custom dropdown with color circles */
.color-dropdown {
    position: relative;
}

.color-dropdown::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-image: var(--color-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.color-dropdown.has-selection::after {
    opacity: 1;
}

.color-dropdown select:focus {
    outline: none;
    border-color: #0d223b;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    justify-content: center;
}

.btn-primary {
    background: #0d223b;
    color: white;
}

.btn-primary:hover {
    background: #1e40af;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

/* Icon Fonts */
@font-face {
    font-family: 'roof-icons';
    src: url('../fonts/roof-icons.woff2') format('woff2'),
         url('../fonts/roof-icons.woff') format('woff');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* SVG Icons */
.icon-roof::before {
    content: '';
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    background-image: url('../images/icon-roof.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.icon-document::before {
    content: '';
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    background-image: url('../images/icon-document.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    margin-right: 0.5rem;
    vertical-align: middle;
}

.disclaimer p {
    font-size: 1rem;
    color: #6b7280;
    margin: 5px 0;
}

/* Error Message */
.roof-preview-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

/* Responsive Design */

/* Large Desktops */
@media (min-width: 1400px) {
    .roof-preview-wrapper {
        gap: 20px;
    }
    
    .product-title {
        font-size: 3rem;
    }
    
    .product-subtitle {
        font-size: 2.2rem;
    }
    
    .color-category-container {
        gap: 60px;
    }
    
    .main-image-container-color {
        min-height: 500px;
        padding: 0 30px 30px 30px;
    }
    
    .main-image-container-project {
        min-height: 500px;
    }
    
    .color-item {
        width: 40px;
        height: 40px;
    }
    
    .color-item::after {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    
    .btn {
        padding: 16px 32px;
        font-size: 1.1rem;
    }
}

/* Medium Desktops */
@media (max-width: 1200px) {
    .roof-preview-wrapper {
        gap: 20px;
    }
    
    .product-title {
        font-size: 2.4rem;
    }
    
    .product-subtitle {
        font-size: 1.9rem;
    }
    
    .color-category-container {
        gap: 40px;
    }
    
    .main-image-container-color {
        min-height: 400px;
        padding: 0 18px 18px 18px;
    }
    
    .main-image-container-project {
        min-height: 450px;
    }
    
    .color-item {
        width: 40px;
        height: 40px;
    }
    
    .btn {
        padding: 14px 28px;
        font-size: 1.05rem;
    }
}

/* Large Tablets and Small Desktops */
@media (max-width: 1024px) {
    .roof-preview-wrapper {
        gap: 20px;
    }
    
    .product-title {
        font-size: 2.2rem;
    }
    
    .product-subtitle {
        font-size: 1.8rem;
    }
    
    .color-category-container {
        gap: 30px;
    }
    
    .main-image-container-color {
        min-height: 350px;
        padding: 15px;
    }
    
    .main-image-container-project {
        min-height: 400px;
    }
    
    .color-item {
        width: 40px;
        height: 40px;
    }
    
    .btn {
        padding: 13px 26px;
        font-size: 1rem;
    }
}

/* Tablets */
@media (max-width: 768px) {
    .roof-preview-wrapper {
        flex-direction: column;
        gap: 25px;
    }
    
    .roof-preview-main,
    .roof-preview-info {
        width: 100%;
        max-width: 100%;
        padding: 0 10px;
    }
    
    .product-title {
        font-size: 2rem;
    }
    
    .product-subtitle {
        font-size: 1.6rem;
    }
    
    .color-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
    }
    
    .color-item {
        width: 40px;
        height: 40px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 12px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 1.1rem;
    }
    
    .gallery-color-container {
        flex-direction: column;
        gap: 15px;
    }
    
    /* Hide desktop gallery, show mobile gallery */
    .project-gallery-desktop {
        display: none;
    }
    
    .project-gallery-mobile {
        display: block;
        width: 100%;
    }
    
    .gallery-horizontal {
        max-height: 140px;
        gap: 12px;
        padding: 15px 0;
    }
    
    .gallery-horizontal .gallery-item {
        min-width: 130px;
        flex-shrink: 0;
        aspect-ratio: 1;
    }
    
    .main-image-container-color {
        min-height: 300px;
        padding: 12px;
    }
    
    .main-image-container-project {
        min-height: 350px;
    }
    
    .color-category-container {
        flex-direction: column;
        gap: 20px;
    }
}

/* Mobile Landscape */
@media (max-width: 640px) {
    .roof-preview-container {
        padding: 10px;
    }
    
    .roof-preview-wrapper {
        gap: 20px;
    }
    
    .product-title {
        font-size: 1.8rem;
    }
    
    .product-subtitle {
        font-size: 1.4rem;
    }
    
    .color-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 8px;
    }
    
    .color-item {
        width: 42px;
        height: 42px;
    }
    
    .main-image-container-color {
        min-height: 280px;
        padding: 10px;
    }
    
    .main-image-container-project {
        min-height: 320px;
    }
    
    .gallery-horizontal {
        max-height: 120px;
        gap: 10px;
        padding: 12px 0;
    }
    
    .gallery-horizontal .gallery-item {
        min-width: 110px;
    }
}

/* Mobile Portrait */
@media (max-width: 480px) {
    .roof-preview-container {
        padding: 8px;
    }
    
    .roof-preview-wrapper {
        gap: 15px;
    }
    
    .product-title {
        font-size: 1.6rem;
        line-height: 1.3;
    }
    
    .product-subtitle {
        font-size: 1.2rem;
    }
    
    .color-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 6px;
    }
    
    .color-item {
        width: 38px;
        height: 38px;
    }
    
    .color-item::after {
        width: 20px;
        height: 20px;
        font-size: 12px;
    }
    
    .action-buttons {
        gap: 10px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 1rem;
    }
    
    .gallery-horizontal {
        max-height: 100px;
        gap: 8px;
        padding: 10px 10px;
    }
    
    .gallery-horizontal .gallery-item {
        width: 50px;
    }
    
    .main-image-container-color {
        min-height: 250px;
        padding: 8px;
    }
    
    .main-image-container-project {
        min-height: 280px;
    }
    
    .color-dropdown select {
        padding: 8px 12px;
        font-size: 0.9rem;
    }
    
    .disclaimer p {
        font-size: 0.9rem;
    }
}

/* Extra Small Mobile */
@media (max-width: 360px) {
    .roof-preview-container {
        padding: 5px;
    }
    
    .product-title {
        font-size: 1.4rem;
    }
    
    .product-subtitle {
        font-size: 1.1rem;
    }
    
    .color-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 5px;
    }
    
    .color-item {
        width: 35px;
        height: 35px;
    }
    
    .color-item::after {
        width: 18px;
        height: 18px;
        font-size: 11px;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    .gallery-horizontal {
        max-height: 90px;
        gap: 6px;
        padding: 8px 0;
    }
    
    .gallery-horizontal .gallery-item {
        min-width: 90px;
    }
    
    .main-image-container-color {
        min-height: 220px;
        padding: 6px;
    }
    
    .main-image-container-project {
        min-height: 250px;
    }
}

/* Color Description Styles */
.color-description {
    margin-top: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border-left: 4px solid #007cba;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #333;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.color-description p {
    margin: 0;
    font-style: italic;
}

.color-description.show {
    display: block !important;
    animation: fadeInUp 0.3s ease;
}

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

/* Project Info Bar Styles */
.project-info-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1e3b72d3;
    padding: 10px 20px;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    overflow: hidden;
    z-index: 10;
}

.project-info-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.project-info-content {
    position: relative;
    z-index: 1;
}

.project-name {
    margin: 0 0 0px 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.project-description {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.project-info-bar.show {
    display: block !important;
    animation: slideInUp 0.4s ease;
}

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

/* Responsive adjustments for project info bar */
@media (min-width: 1400px) {
    .project-info-bar {
        padding: 16px 24px;
    }
    
    .project-name {
        font-size: 1.5rem;
    }
    
    .project-description {
        font-size: 1rem;
    }
}

@media (max-width: 1200px) {
    .project-info-bar {
        padding: 14px 20px;
    }
    
    .project-name {
        font-size: 1.4rem;
    }
    
    .project-description {
        font-size: 0.98rem;
    }
}

@media (max-width: 1024px) {
    .project-info-bar {
        padding: 12px 18px;
    }
    
    .project-name {
        font-size: 1.3rem;
    }
    
    .project-description {
        font-size: 0.95rem;
    }
}

@media (max-width: 768px) {
    .project-info-bar {
        padding: 14px 16px;
    }
    
    .project-name {
        font-size: 1.2rem;
    }
    
    .project-description {
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    .project-info-bar {
        padding: 12px 14px;
    }
    
    .project-name {
        font-size: 1.1rem;
    }
    
    .project-description {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .project-info-bar {
        padding: 10px 12px;
    }
    
    .project-name {
        font-size: 1rem;
    }
    
    .project-description {
        font-size: 0.8rem;
    }
}

@media (max-width: 360px) {
    .project-info-bar {
        padding: 8px 10px;
    }
    
    .project-name {
        font-size: 0.95rem;
    }
    
    .project-description {
        font-size: 0.75rem;
    }
}
