/* ===================================
   PRODUCT MODAL STYLES
   =================================== */

/* CSS Variables for colors */
:root {
    --primary-green: #2e7d32;
    --secondary-green: #4caf50;
    --light-green: #e8f5e9;
    --orange: #ff9800;
}

/* Modal Base Styles */
.product-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Ensure modal appears above all other content */
.product-modal.show {
    opacity: 1;
    visibility: visible;
    display: flex !important;
}

.modal-content {
    background-color: #ffffff;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    position: relative;
    animation: slideInUp 0.3s ease;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 8px 25px rgba(0, 0, 0, 0.1);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 3px solid var(--primary-green);
    transform-origin: center center;
}

.product-modal.show .modal-content {
    animation: modalZoomIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Scrollable modal body */
.modal-content .modal-body {
    overflow-y: auto;
    overflow-x: hidden;
}

/* Custom scrollbar for modal */
.modal-content .modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-content .modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.modal-content .modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-green);
    border-radius: 10px;
}

.modal-content .modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-green);
}

.close-modal {
    color: white;
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.close-modal:hover,
.close-modal:focus {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    transform: scale(1.1) rotate(90deg);
    border-color: rgba(255, 255, 255, 0.4);
}

.close-modal:focus-visible {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 50%, var(--orange) 100%);
    background-size: 200% 200%;
    animation: gradientShift 4s ease infinite;
    color: white;
    padding: 0;
    text-align: center;
    position: relative;
    border-radius: 21px 21px 0 0;
    overflow: hidden;
}

.modal-product-image {
    width: 100%;
    max-height: 280px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    overflow: hidden;
}

.modal-product-image img {
    max-width: 100%;
    max-height: 270px;
    height: auto;
    width: auto;
    object-fit: contain;
}

.modal-product-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(46, 125, 50, 0.95));
    padding: 40px 20px 20px;
    text-align: center;
}

.modal-product-name {
    margin: 0 0 8px 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    padding-right: 40px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-product-title {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 400;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.modal-category {
    background: rgba(255, 152, 0, 0.9);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.3);
}

.modal-body {
    padding: 25px 25px 20px;
    background: #ffffff;
}

.modal-description {
    color: #555;
    margin-bottom: 20px;
    line-height: 1.6;
    font-size: 0.95rem;
    text-align: left;
}

.modal-features h4 {
    color: var(--primary-green);
    margin-bottom: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    text-align: left;
}

.features-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 12px;
}

.feature-tag {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--light-green), #f1f8e9);
    color: var(--primary-green);
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    gap: 8px;
    border: 1px solid rgba(46, 125, 50, 0.1);
    transition: all 0.2s ease;
}

.feature-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.15);
}

.feature-tag i {
    font-size: 0.8rem;
    color: var(--secondary-green);
    background: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-price {
    text-align: center;
    margin: 20px 0;
    position: relative;
}

.modal-price .price {
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(135deg, var(--orange), #f57c00);
    padding: 15px 25px;
    border-radius: 50px;
    display: inline-block;
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.3);
    position: relative;
    overflow: hidden;
}

.modal-price .price::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: priceShimmer 2s infinite;
}

.modal-footer {
    padding: 20px 25px 25px;
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    border-radius: 0 0 21px 21px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    border-top: 2px solid #e8f5e9;
}

.modal-btn {
    padding: 16px 20px;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    min-height: 60px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.3px;
}

.modal-btn i {
    font-size: 1.4rem;
    transition: transform 0.3s ease;
}

.modal-btn:hover i {
    transform: scale(1.2);
}

.modal-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.modal-btn:hover::before {
    left: 100%;
}

.modal-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 2px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-btn:hover::after {
    opacity: 1;
}

.modal-btn.whatsapp-btn {
    background: linear-gradient(135deg, #25D366 0%, #1ea952 50%, #128C7E 100%);
    color: white;
    padding: 20px 20px;
    border-radius: 50px;
    margin: 20px 20px;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.35);
}

.modal-btn.whatsapp-btn:hover {
    background: linear-gradient(135deg, #1ea952 0%, #128C7E 50%, #0d6d5f 100%);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 30px rgba(37, 211, 102, 0.45);
    color: white;
    text-decoration: none;
}

.modal-btn.whatsapp-btn:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
}

.modal-btn.call-btn {
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 50%, #2e7d32 100%);
    color: white;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.35);
}

.modal-btn.call-btn:hover {
    background: linear-gradient(135deg, #388e3c 0%, #2e7d32 50%, #1b5e20 100%);
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 30px rgba(76, 175, 80, 0.45);
    color: white;
    text-decoration: none;
}

.modal-btn.call-btn:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

/* Ripple effect on click */
.modal-btn {
    overflow: hidden;
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* Modal Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modalZoomIn {
    0% {
        opacity: 0;
        transform: scale(0.7) translateY(50px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes priceShimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Mobile Responsive Modal */
@media (max-width: 768px) {
    .product-modal {
        padding: 10px;
        align-items: flex-start;
        padding-top: 10px;
        padding-bottom: 10px;
    }
   
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        overflow-y: auto;
        margin-top: 0;
        margin-bottom: 0;
    }
   
    .modal-body {
        padding: 18px;
    }
   
    .modal-footer {
        padding: 18px 18px 20px;
        grid-template-columns: 1fr;
        gap: 12px;
    }
   
    .modal-btn {
        flex-direction: row;
        justify-content: center;
        min-height: 52px;
        padding: 14px 20px;
        gap: 10px;
        font-size: 0.95rem;
    }
   
    .modal-btn i {
        font-size: 1.3rem;
        margin-right: 0;
        margin-bottom: 0;
    }
   
    .modal-product-image {
        max-height: 220px;
    }
   
    .modal-product-image img {
        max-height: 210px;
    }
   
    .modal-product-name {
        font-size: 1.3rem;
        padding-right: 35px;
    }
   
    .modal-product-title {
        font-size: 0.85rem;
    }
   
    .modal-product-info {
        padding: 30px 15px 15px;
    }
   
    .features-list {
        grid-template-columns: 1fr;
        gap: 8px;
    }
   
    .close-modal {
        right: 12px;
        top: 12px;
        width: 30px;
        height: 30px;
        font-size: 20px;
    }
}

@media (max-width: 576px) {
    .product-modal {
        padding: 5px;
    }
   
    .modal-content {
        width: 100%;
        height: auto;
        max-height: 98vh;
        margin: 0;
        border-radius: 15px;
    }
   
    .modal-body {
        padding: 15px;
        max-height: calc(98vh - 100px);
        overflow-y: auto;
    }
   
    .modal-header {
        padding: 18px 15px 12px;
        border-radius: 15px 15px 0 0;
    }
   
    .modal-product-name {
        font-size: 1.2rem;
        padding-right: 30px;
    }
   
    .modal-product-title {
        font-size: 0.8rem;
    }
   
    .modal-product-info {
        padding: 25px 12px 12px;
    }
   
    .close-modal {
        right: 10px;
        top: 10px;
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
   
    .modal-price .price {
        font-size: 1.5rem;
        padding: 12px 20px;
    }
   
    .features-list {
        grid-template-columns: 1fr;
    }
   
    .feature-tag {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
   
    .modal-btn {
        padding: 12px 16px;
        font-size: 0.9rem;
        min-height: 48px;
        border-radius: 12px;
    }
   
    .modal-btn i {
        font-size: 1.2rem;
    }
   
    .modal-product-image {
        max-height: 200px;
    }
   
    .modal-product-image img {
        max-height: 190px;
    }
}

/* Prevent modal from being too tall on short screens */
@media (max-height: 600px) {
    .modal-content {
        max-height: 95vh;
    }
   
    .modal-body {
        max-height: calc(95vh - 80px);
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .product-modal {
        padding: 5px;
    }
   
    .modal-content {
        max-height: 98vh;
    }
   
    .modal-body {
        max-height: calc(98vh - 70px);
        padding: 12px;
    }
   
    .modal-header {
        padding: 15px 15px 10px;
    }
   
    .modal-product-image {
        max-height: 120px;
    }
   
    .modal-product-image img {
        max-height: 110px;
    }
}

/* Enhanced touch targets for mobile */
@media (hover: none) and (pointer: coarse) {
    .modal-btn {
        min-height: 48px;
        min-width: 48px;
    }
   
    .close-modal {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Enhanced product overlay animation */
.clickable-product .product-img {
    position: relative;
    overflow: hidden;
}

.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(46, 125, 50, 0.9);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    cursor: pointer;
    z-index: 2;
}

.clickable-product {
    cursor: pointer;
    transition: all 0.3s ease;
}

.clickable-product:hover {
    transform: translateY(-5px);
}

.clickable-product:hover .product-overlay {
    opacity: 1;
    animation: overlayFadeIn 0.3s ease;
}

.product-overlay i {
    font-size: 2rem;
    margin-bottom: 8px;
}

.product-overlay span {
    font-size: 0.9rem;
    font-weight: 600;
}

@keyframes overlayFadeIn {
    from {
        opacity: 0;
        transform: scale(1.1);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.quick-contact-btn:active {
    transform: translateY(-1px) scale(0.98);
}