/**
 * Frontend Notification Widget & Opt-in Styles
 * Engineered for Mobile Responsiveness down to 360px screen width
 */

/* Root & Positioning */
#mmm-notify-root {
    position: fixed;
    z-index: 9999990;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

#mmm-notify-root.pos-bottom-left {
    bottom: 24px;
    left: 24px;
}

#mmm-notify-root.pos-bottom-right {
    bottom: 24px;
    right: 24px;
}

/* 1. Floating Bell Icon */
.mmm-bell-wrapper {
    position: relative;
    display: inline-block;
    pointer-events: auto;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.mmm-bell-wrapper.mmm-bell-hidden,
#mmm-notify-root.mmm-root-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.6) !important;
    visibility: hidden !important;
}

#mmm-notify-bell {
    pointer-events: auto;
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #0b132b;
    color: #f59e0b;
    border: 2px solid #f59e0b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(11, 19, 43, 0.35);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease;
    padding: 0;
    outline: none;
}

/* Discreet Bell Dismiss Button */
.mmm-bell-dismiss {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
    line-height: 15px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 5;
    outline: none;
    transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.mmm-bell-dismiss:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    transform: scale(1.15);
}

#mmm-notify-bell:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.4);
}

#mmm-notify-bell svg {
    display: block;
    transition: transform 0.2s ease;
}

#mmm-notify-bell:hover svg {
    animation: mmm-bell-wiggle 1s ease infinite;
}

@keyframes mmm-bell-wiggle {
    0%, 100% { transform: rotate(0); }
    20%, 60% { transform: rotate(-15deg); }
    40%, 80% { transform: rotate(15deg); }
}

/* Notification Count Badge */
.mmm-bell-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    line-height: 1;
}

/* Pulse Animation Ring */
.mmm-bell-pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    opacity: 0.5;
    animation: mmm-pulse-ring 2.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    z-index: -1;
}

@keyframes mmm-pulse-ring {
    0% { transform: scale(0.95); opacity: 0.7; }
    50% { transform: scale(1.4); opacity: 0; }
    100% { transform: scale(0.95); opacity: 0; }
}

/* 2. Slide-in Notification Prompt (Opt-in) */
.mmm-slidein-card {
    pointer-events: none;
    position: fixed;
    bottom: 84px;
    left: 24px;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    z-index: 9999995;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s ease;
}

.mmm-slidein-card.mmm-slidein-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

#mmm-notify-root.pos-bottom-right .mmm-slidein-card {
    left: auto;
    right: 24px;
}

.mmm-slidein-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
}

.mmm-slidein-close:hover {
    color: #0f172a;
}

.mmm-slidein-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
    padding-right: 18px;
}

.mmm-slidein-icon {
    font-size: 26px;
    line-height: 1;
    flex-shrink: 0;
}

.mmm-slidein-text h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.35;
}

.mmm-slidein-text p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
    line-height: 1.45;
}

.mmm-slidein-actions {
    display: flex;
    gap: 8px;
}

.mmm-btn-primary {
    flex: 1;
    background: #0b132b;
    color: #ffffff;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: background 0.2s ease;
}

.mmm-btn-primary:hover {
    background: #1c2541;
}

.mmm-btn-ghost {
    background: #f1f5f9;
    color: #64748b;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mmm-btn-ghost:hover {
    background: #e2e8f0;
    color: #334155;
}

/* 3. Interactive Modal / Drawer */
#mmm-notify-root .mmm-notify-modal-overlay {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 19, 43, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

#mmm-notify-root .mmm-notify-modal-overlay.mmm-notify-modal-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#mmm-notify-root .mmm-notify-modal-dialog {
    background: #ffffff;
    max-width: 440px;
    width: 100%;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

#mmm-notify-root .mmm-notify-modal-overlay.mmm-notify-modal-active .mmm-notify-modal-dialog {
    transform: scale(1);
}

#mmm-notify-root .mmm-notify-modal-header {
    background: #f8fafc;
    padding: 14px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
}

#mmm-notify-root .mmm-notify-modal-badge {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
    font-size: 11px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#mmm-notify-root .mmm-notify-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #94a3b8;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

#mmm-notify-root .mmm-notify-modal-close:hover {
    color: #0f172a;
}

#mmm-notify-root .mmm-notify-modal-body {
    padding: 24px 22px;
}

#mmm-notify-root .mmm-notify-modal-heading {
    margin: 0 0 6px 0;
    font-size: 19px;
    font-weight: 800;
    color: #0b132b;
    line-height: 1.35;
}

#mmm-notify-root .mmm-notify-modal-subheading {
    margin: 0 0 20px 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

/* Web Push Box */
.mmm-channel-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.mmm-channel-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.mmm-channel-info {
    flex: 1;
}

.mmm-channel-info strong {
    display: block;
    font-size: 14px;
    color: #0f172a;
    font-weight: 700;
}

.mmm-channel-info span {
    display: block;
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
    line-height: 1.35;
}

.mmm-btn-subscribe-push {
    background: #0b132b;
    color: #f59e0b;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.mmm-btn-subscribe-push:hover {
    background: #f59e0b;
    color: #0b132b;
}

/* Divider */
.mmm-divider {
    text-align: center;
    position: relative;
    margin: 18px 0;
}

.mmm-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.mmm-divider span {
    position: relative;
    background: #ffffff;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
    letter-spacing: 0.8px;
}

/* Email Form */
.mmm-subscribe-form .mmm-form-group {
    margin-bottom: 10px;
}

.mmm-input {
    width: 100%;
    height: 42px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0 14px;
    font-size: 14px;
    color: #1e293b;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s ease;
}

.mmm-input:focus {
    border-color: #0b132b;
    box-shadow: 0 0 0 2px rgba(11, 19, 43, 0.1);
}

.mmm-btn-submit-email {
    width: 100%;
    height: 44px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: opacity 0.2s ease, transform 0.1s ease;
}

.mmm-btn-submit-email:hover {
    opacity: 0.95;
}

.mmm-btn-submit-email:active {
    transform: scale(0.99);
}

.mmm-form-feedback {
    margin-top: 12px;
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
}

.mmm-form-feedback.success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.mmm-form-feedback.error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

#mmm-notify-root .mmm-notify-modal-footer {
    background: #f8fafc;
    padding: 12px 20px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    font-size: 11px;
    color: #64748b;
}

/* 4. Shortcode Form Box */
.mmm-shortcode-newsletter-box {
    background: linear-gradient(135deg, #0b132b 0%, #1c2541 100%);
    color: #ffffff;
    padding: 24px;
    border-radius: 14px;
    margin: 24px 0;
    box-shadow: 0 10px 25px rgba(11, 19, 43, 0.15);
    box-sizing: border-box;
}

.mmm-sc-header {
    text-align: center;
    margin-bottom: 16px;
}

.mmm-sc-icon {
    font-size: 30px;
    display: inline-block;
    margin-bottom: 6px;
}

.mmm-sc-header h4 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.mmm-sc-header p {
    margin: 0;
    font-size: 13px;
    color: #94a3b8;
}

.mmm-sc-row {
    display: flex;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.mmm-sc-row .mmm-input {
    flex: 1;
    background: #ffffff;
}

.mmm-sc-row .mmm-btn-submit-email {
    width: auto;
    padding: 0 20px;
    white-space: nowrap;
}

/* ==========================================================
   5. STRICT 360px MOBILE OPTIMIZATIONS
   ========================================================== */
@media (max-width: 480px) {
    /* Adjust Floating Bell on Mobile so it doesn't collide with bottom navigation or sticky checkout */
    #mmm-notify-root.pos-bottom-left {
        bottom: var(--mmm-bell-mobile-bottom, 80px);
        left: 14px;
    }

    #mmm-notify-root.pos-bottom-right {
        bottom: var(--mmm-bell-mobile-bottom, 80px);
        right: 14px;
    }

    #mmm-notify-bell {
        width: 44px;
        height: 44px;
    }

    #mmm-notify-bell svg {
        width: 20px;
        height: 20px;
    }

    /* Slide-in Card on Mobile (360px Safe) */
    .mmm-slidein-card {
        bottom: 70px !important;
        left: 10px !important;
        right: 10px !important;
        width: calc(100vw - 20px) !important;
        max-width: calc(100vw - 20px) !important;
        padding: 14px 12px;
        border-radius: 12px;
    }

    .mmm-slidein-icon {
        font-size: 22px;
    }

    .mmm-slidein-text h4 {
        font-size: 13px;
    }

    .mmm-slidein-text p {
        font-size: 11px;
    }

    .mmm-slidein-actions {
        flex-direction: column;
        gap: 6px;
    }

    .mmm-btn-primary,
    .mmm-btn-ghost {
        width: 100%;
        padding: 9px;
        font-size: 12px;
    }

    /* Modal dialog on 360px */
    #mmm-notify-root .mmm-notify-modal-overlay {
        padding: 10px;
        align-items: flex-end; /* Drawer style on mobile */
    }

    #mmm-notify-root .mmm-notify-modal-dialog {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        max-height: 85vh;
        overflow-y: auto;
    }

    #mmm-notify-root .mmm-notify-modal-body {
        padding: 18px 16px;
    }

    #mmm-notify-root .mmm-notify-modal-heading {
        font-size: 17px;
    }

    #mmm-notify-root .mmm-notify-modal-subheading {
        font-size: 12px;
    }

    .mmm-channel-box {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        padding: 12px;
    }

    .mmm-channel-info strong {
        font-size: 13px;
    }

    .mmm-btn-subscribe-push {
        width: 100%;
        padding: 10px;
    }

    .mmm-sc-row {
        flex-direction: column;
    }

    .mmm-sc-row .mmm-btn-submit-email {
        width: 100%;
    }
}
