/**
 * Door Direct Order & Catalog Mode - Frontend Styles
 * Compatible with WoodMart & Standard WooCommerce Themes
 */

/* ==========================================================================
   1. PRODUCT BUTTONS (Single & Archive)
   ========================================================================== */
.door-do-buttons-wrap {
    display: flex;
    gap: 10px;
    margin: 15px 0;
    width: 100%;
    box-sizing: border-box;
    align-items: stretch;
}

.door-do-buttons-wrap.door-do-layout-flex-row {
    flex-direction: row;
    flex-wrap: wrap;
}

.door-do-buttons-wrap.door-do-layout-flex-col {
    flex-direction: column;
}

/* Individual Order Buttons */
.door-do-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 8px;
    text-decoration: none !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    border: none;
    box-sizing: border-box;
    flex: 1 1 auto;
    text-align: center;
}

.door-do-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
    filter: brightness(1.05);
}

.door-do-btn:active {
    transform: translateY(0);
}

.door-do-btn-icon {
    flex-shrink: 0;
    display: inline-block;
}

/* WhatsApp Button */
.door-do-btn-wa {
    background-color: #25D366;
    color: #ffffff !important;
}

.door-do-btn-wa:hover {
    background-color: #20BA5A;
}

/* Mailto Email Button */
.door-do-btn-mail {
    background-color: #0f172a;
    color: #ffffff !important;
}

.door-do-btn-mail:hover {
    background-color: #1e293b;
}

/* Inside Add to Cart Form (Next to Add to Cart) */
.door-do-context-single-inside-form {
    margin: 12px 0 0 0;
}

/* ==========================================================================
   2. ARCHIVE / PRODUCT CARD BUTTONS
   ========================================================================== */
.door-do-context-archive {
    margin: 10px 0 0 0;
    gap: 6px;
}

.door-do-context-archive .door-do-btn {
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
}

.door-do-context-archive .door-do-btn-icon {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
   3. WOODMART THEME DEEP INTEGRATION
   ========================================================================== */
/* Ensure buttons are properly aligned inside WoodMart product cards */
.wd-product .door-do-context-archive,
.product-grid-item .door-do-context-archive {
    position: relative;
    z-index: 5;
}

/* WoodMart Hover Base / Quick / Standard */
.wd-hover-base .door-do-context-archive,
.wd-hover-quick .door-do-context-archive {
    margin-top: 8px;
}

/* Prevent overflow glitches in WoodMart Quick View Popup */
.woodmart-popup .door-do-buttons-wrap {
    margin-top: 15px;
}

/* ==========================================================================
   4. MULTI-CHANNEL FLOATING SOCIAL WIDGET (Versi 1 Multi)
   ========================================================================== */
.door-do-floating-container {
    position: fixed;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

.door-do-floating-container * {
    box-sizing: border-box;
}

/* Trigger Button */
.door-do-floating-btn {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    outline: none;
    box-shadow: 0 4px 18px rgba(16, 185, 129, 0.4);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-decoration: none !important;
}

.door-do-floating-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(16, 185, 129, 0.55);
}

/* Pulse Animation */
.door-do-floating-container.door-do-pulse .door-do-floating-btn::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    background: inherit;
    opacity: 0.6;
    animation: doorDoPulse 2s infinite cubic-bezier(0.45, 0, 0.2, 1);
    z-index: -1;
}

@keyframes doorDoPulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.35);
        opacity: 0;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

/* Trigger Icons Toggle (Chat <-> Close) */
.door-do-floating-btn .door-do-icon-close {
    display: none;
}

.door-do-floating-container.door-do-open .door-do-floating-btn .door-do-icon-chat {
    display: none;
}

.door-do-floating-container.door-do-open .door-do-floating-btn .door-do-icon-close {
    display: flex;
}

.door-do-floating-container.door-do-open .door-do-floating-btn {
    background: #1e293b;
    box-shadow: 0 4px 18px rgba(30, 41, 59, 0.4);
    transform: rotate(90deg);
}

/* Tooltip */
.door-do-tooltip {
    position: absolute;
    white-space: nowrap;
    background: rgba(15, 23, 42, 0.92);
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    pointer-events: none;
}

.door-do-pos-bottom-right .door-do-tooltip {
    right: 72px;
}

.door-do-pos-bottom-left .door-do-tooltip {
    left: 72px;
}

.door-do-floating-btn:hover .door-do-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Speed-Dial Popover */
.door-do-popover {
    position: absolute;
    bottom: 75px;
    width: 320px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1000;
}

.door-do-pos-bottom-right .door-do-popover {
    right: 0;
    transform-origin: bottom right;
}

.door-do-pos-bottom-left .door-do-popover {
    left: 0;
    transform-origin: bottom left;
}

.door-do-floating-container.door-do-open .door-do-popover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Popover Header */
.door-do-popover-header {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    padding: 16px;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.door-do-popover-avatar-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.door-do-popover-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.door-do-status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border: 2px solid #0f172a;
    border-radius: 50%;
}

.door-do-admin-name {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.door-do-admin-status {
    font-size: 11px;
    color: #22c55e;
    font-weight: 500;
    display: inline-block;
    margin-top: 3px;
}

.door-do-popover-close {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.door-do-popover-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

/* Popover Body */
.door-do-popover-body {
    padding: 16px;
    background: #f8fafc;
}

.door-do-greeting-bubble {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: #334155;
    line-height: 1.45;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.door-do-greeting-bubble p {
    margin: 0;
}

/* Channel Links in Popover */
.door-do-channel-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.door-do-channel-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    text-decoration: none !important;
    color: #1e293b !important;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.door-do-channel-link:hover {
    transform: translateX(4px);
    border-color: var(--ch-color, #10b981);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.door-do-ch-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    color: var(--ch-color, #10b981);
    flex-shrink: 0;
}

.door-do-ch-label {
    flex: 1;
}

.door-do-ch-arrow {
    color: #94a3b8;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease;
}

.door-do-channel-link:hover .door-do-ch-arrow {
    transform: translateX(3px);
    color: var(--ch-color, #10b981);
}

/* ==========================================================================
   5. MOBILE & WOODMART STICKY BOTTOM TOOLBAR OFFSET
   ========================================================================== */
@media (max-width: 768px) {
    /* If WoodMart mobile toolbar exists, push widget above it */
    body.has-wd-toolbar .door-do-floating-container,
    .woodmart-show-toolbar ~ .door-do-floating-container,
    body:has(.wd-toolbar) .door-do-floating-container {
        bottom: 80px !important;
    }

    .door-do-popover {
        width: calc(100vw - 40px);
        max-width: 320px;
    }

    .door-do-pos-bottom-right .door-do-popover {
        right: 0;
    }

    .door-do-pos-bottom-left .door-do-popover {
        left: 0;
    }
}
