/**
 * Ah Ho Product Add-ons - Frontend Styles
 */

/* Main wrapper */
.ah-ho-addons-wrapper {
    margin-bottom: 20px;
    padding: 0;
}

/* Product Notes Section */
.ah-ho-notes-section {
    margin-bottom: 20px;
    padding: 20px;
    background: #f9fdf9;
    border: 2px solid #c8e6c9;
    border-radius: 8px;
}

.ah-ho-notes-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 15px;
    color: #2E7D32;
}

.ah-ho-notes-section label .required {
    color: #ff6f00;
    font-weight: 700;
}

/* Gift Section */
.ah-ho-gift-section {
    padding: 20px;
    background: #fffbf0;
    border: 2px solid #ffe0a3;
    border-radius: 8px;
}

.ah-ho-gift-checkbox-row {
    margin-bottom: 15px;
}

.ah-ho-gift-checkbox-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
    color: #ff6f00;
    cursor: pointer;
    user-select: none;
}

.ah-ho-gift-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #ff6f00;
}

.ah-ho-gift-message-row {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed #ffe0a3;
}

.ah-ho-gift-message-row label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.ah-ho-gift-message-row label .required {
    color: #ff6f00;
    font-weight: 700;
}

/* Shared textarea styles */
.ah-ho-textarea {
    width: 100% !important;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.ah-ho-textarea:focus {
    border-color: #2E7D32;
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.ah-ho-gift-message-row .ah-ho-textarea:focus {
    border-color: #ff6f00;
    box-shadow: 0 0 0 3px rgba(255, 111, 0, 0.1);
}

/* Character counter */
.ah-ho-char-counter {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
    text-align: right;
    font-style: italic;
}

.ah-ho-char-counter.warning {
    color: #ff6f00;
    font-weight: 600;
}

/* Product Add-on Section */
.ah-ho-product-addon-section {
    margin-bottom: 20px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 2px solid #66bb6a;
    border-radius: 8px;
}

.ah-ho-addon-checkbox-row {
    margin: 0;
}

.ah-ho-addon-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}

.ah-ho-addon-checkbox-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: #2E7D32;
}

.ah-ho-addon-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.ah-ho-addon-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #c8e6c9;
    flex-shrink: 0;
}

.ah-ho-addon-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ah-ho-addon-name {
    font-weight: 600;
    font-size: 15px;
    color: #1b5e20;
}

.ah-ho-addon-price {
    font-size: 14px;
    font-weight: 700;
    color: #2E7D32;
}

.ah-ho-addon-price .woocommerce-Price-amount {
    font-weight: 700;
}

/* Checked state highlight */
.ah-ho-addon-checkbox-label input[type="checkbox"]:checked ~ .ah-ho-addon-content {
    opacity: 1;
}

.ah-ho-addon-checkbox-label input[type="checkbox"]:not(:checked) ~ .ah-ho-addon-content {
    opacity: 0.7;
}

.ah-ho-product-addon-section:has(input:checked) {
    border-color: #2E7D32;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

/* Addon image hover hint */
.ah-ho-addon-image {
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ah-ho-addon-image:hover {
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Addon Lightbox - z-index must exceed Avada sticky header */
.ah-ho-addon-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ah-ho-addon-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.ah-ho-addon-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 85vh;
    animation: ahhoLightboxIn 0.25s ease;
}

.ah-ho-addon-lightbox-img {
    display: block;
    max-width: 100%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.ah-ho-addon-lightbox-close {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #333;
    font-size: 22px;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 0;
}

.ah-ho-addon-lightbox-close:hover {
    background: #f5f5f5;
}

/* Hide Avada sticky header/elements when lightbox is open */
body.ah-ho-lightbox-open .fusion-header-wrapper,
body.ah-ho-lightbox-open .avada-header-wrapper,
body.ah-ho-lightbox-open .fusion-sliding-bar-wrapper,
body.ah-ho-lightbox-open #wrapper > .sticky-header,
body.ah-ho-lightbox-open .fusion-footer-widget-area,
body.ah-ho-lightbox-open .whatsapp-button,
body.ah-ho-lightbox-open [class*="whatsapp"],
body.ah-ho-lightbox-open .fusion-top-header {
    z-index: 0 !important;
}

@keyframes ahhoLightboxIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .ah-ho-addons-wrapper {
        margin-bottom: 15px;
    }

    .ah-ho-notes-section,
    .ah-ho-gift-section,
    .ah-ho-product-addon-section {
        padding: 15px;
    }

    .ah-ho-addon-image {
        width: 50px;
        height: 50px;
    }

    .ah-ho-textarea {
        font-size: 16px; /* Prevent iOS zoom */
    }
}

/* Admin order view styles */
.ah-ho-admin-addon {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Print styles for packing slips */
@media print {
    .ah-ho-admin-addon {
        page-break-inside: avoid;
        border: 1px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
    }
}
