/* ============================================================
   NN Floating Contact - Frontend Styles
   ============================================================ */

/* ============ WRAPPER ============ */
#nn-floating-contact {
    position: fixed;
    bottom: 20px;
    width: 260px;
    background: var(--nn-primary, #1a233a);
    border-radius: 12px;
    z-index: 999999;
    overflow: hidden;
    font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: all 0.3s ease;
    padding: 0 !important;
    margin: 0 !important;
    /* Shadow = màu chính opacity 50% + bóng đen nhẹ phía dưới */
    box-shadow:
        0 10px 30px rgba(var(--nn-primary-rgb, 26, 35, 58), 0.5),
        0 4px 12px rgba(0, 0, 0, 0.15);
}

#nn-floating-contact.nn-pos-right { right: 20px; }
#nn-floating-contact.nn-pos-left  { left: 20px; }

/* ============ VỆT SÁNG CHẠY VÒNG QUANH VIỀN ============ */
@property --nn-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

#nn-floating-contact::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 2px;
    background: conic-gradient(
        from var(--nn-angle),
        transparent 0deg,
        transparent 280deg,
        rgba(255, 255, 255, 0.35) 310deg,
        #ffffff 340deg,
        rgba(255, 255, 255, 0.35) 360deg
    );
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
            mask-composite: exclude;
    animation: nn-glow-spin 4s linear infinite;
    pointer-events: none;
    z-index: 999;
}

@keyframes nn-glow-spin {
    to { --nn-angle: 360deg; }
}

/* ============ HEADER ============ */
.nn-contact-header {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    background: var(--nn-primary, #1a233a);
    cursor: pointer;
    margin: 0 !important;
    pointer-events: auto;
    position: relative;
    z-index: 10;
}

.nn-avatar-wrap {
    position: relative;
    margin-right: 8px;
    flex-shrink: 0;
}

.nn-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: block;
}

.nn-avatar-placeholder {
    background: rgba(255, 255, 255, 0.08);
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: #8b9bb4;
    font-size: 16px;
}

.nn-status-dot {
    position: absolute;
    bottom: 1px;
    right: 1px;
    width: 9px;
    height: 9px;
    background: #00d084;
    border: 2px solid var(--nn-primary, #1a233a);
    border-radius: 50%;
}

.nn-info {
    flex: 1;
    overflow: hidden;
    min-width: 0;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: center !important;
    text-align: left !important;
    padding: 0 !important;
    margin: 0 !important;
}

.nn-name {
    color: #fff !important;
    font-family: 'Quicksand', sans-serif !important;
    font-weight: 700 !important;
    font-size: 13px !important;
    line-height: 1.15 !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: left !important;
    display: block !important;
}

/* ============ MARQUEE ============ */
.nn-marquee {
    overflow: hidden;
    white-space: nowrap;
    width: 100%;
    line-height: 1.15 !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    display: block !important;
}

.nn-marquee-inner {
    display: inline-block;
    white-space: nowrap;
    animation: nn-scroll-marquee 15s linear infinite;
    will-change: transform;
}

.nn-marquee-inner span {
    display: inline-block !important;
    padding-right: 8px !important;
    padding-left: 0 !important;
    color: #8b9bb4 !important;
    font-family: 'Quicksand', sans-serif !important;
    font-weight: 500 !important;
    font-size: 10px !important;
    margin: 0 !important;
    line-height: 1.15 !important;
}

@keyframes nn-scroll-marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Badge + chevron: ẩn mặc định, chỉ hiện trên mobile */
.nn-free-badge,
.nn-chevron { display: none; }

/* ============ BODY ============ */
.nn-contact-body {
    max-height: 0;
    opacity: 0;
    transition: all 0.4s ease;
    background: linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15)), var(--nn-primary, #141c2f);
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
}

.nn-list {
    padding: 5px 6px 4px 6px;
    margin: 0 !important;
}

.nn-item {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    text-decoration: none;
    border-radius: 8px;
    margin-bottom: 2px;
    transition: all 0.25s ease;
    border: 1px solid transparent;
    line-height: 1.15;
}
.nn-item:last-child { margin-bottom: 0; }

.nn-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    margin-right: 10px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
}

.nn-zalo     { background: #0068ff; }
.nn-mess     { background: linear-gradient(45deg, #0099ff, #a033ff); }
.nn-tele     { background: #2ea6da; }
.nn-whatsapp { background: #25d366; }
.nn-phone    { background: #00d084; }

.nn-item-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.15;
    text-align: left;
    gap: 0;
}

.nn-item-text strong {
    font-family: 'Quicksand', sans-serif;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    padding: 0;
    display: block;
}

.nn-item-text span {
    color: #8b9bb4;
    font-family: 'Quicksand', sans-serif;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.2;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* ============ MÀU TEXT TỪNG MỤC ============ */
.nn-item-zalo     .nn-item-text strong { color: #4da3ff !important; }
.nn-item-zalo     .nn-item-text span   { color: #7ab8ff !important; opacity: 0.75; }
.nn-item-mess     .nn-item-text strong { color: #b47aff !important; }
.nn-item-mess     .nn-item-text span   { color: #c99bff !important; opacity: 0.75; }
.nn-item-tele     .nn-item-text strong { color: #4dc3f0 !important; }
.nn-item-tele     .nn-item-text span   { color: #7ad4f5 !important; opacity: 0.75; }
.nn-item-whatsapp .nn-item-text strong { color: #4ade80 !important; }
.nn-item-whatsapp .nn-item-text span   { color: #7ee8a3 !important; opacity: 0.75; }
.nn-item-call     .nn-item-text strong { color: #2ee8a4 !important; }
.nn-item-call     .nn-item-text span   { color: #66f0bd !important; opacity: 0.75; }

/* ============ HOVER ============ */
.nn-item-zalo:hover     { background: rgba(0, 104, 255, 0.12); border-color: rgba(0, 104, 255, 0.4); transform: translateX(3px); }
.nn-item-zalo:hover     .nn-icon { box-shadow: 0 0 12px rgba(0, 104, 255, 0.6); }
.nn-item-mess:hover     { background: rgba(160, 51, 255, 0.12); border-color: rgba(160, 51, 255, 0.4); transform: translateX(3px); }
.nn-item-mess:hover     .nn-icon { box-shadow: 0 0 12px rgba(160, 51, 255, 0.6); }
.nn-item-tele:hover     { background: rgba(46, 166, 218, 0.12); border-color: rgba(46, 166, 218, 0.4); transform: translateX(3px); }
.nn-item-tele:hover     .nn-icon { box-shadow: 0 0 12px rgba(46, 166, 218, 0.6); }
.nn-item-whatsapp:hover { background: rgba(37, 211, 102, 0.12); border-color: rgba(37, 211, 102, 0.4); transform: translateX(3px); }
.nn-item-whatsapp:hover .nn-icon { box-shadow: 0 0 12px rgba(37, 211, 102, 0.6); }
.nn-item-call:hover     { background: rgba(0, 208, 132, 0.12); border-color: rgba(0, 208, 132, 0.4); transform: translateX(3px); }
.nn-item-call:hover     .nn-icon { box-shadow: 0 0 12px rgba(0, 208, 132, 0.6); }

/* ============ FOOTER ============ */
.nn-footer {
    background: var(--nn-secondary, #6b4cfa);
    text-align: center;
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100% !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border-radius: 0 0 12px 12px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    padding: 0 10px;
    transition: all 0.4s ease;
}

.nn-footer strong {
    font-family: 'Quicksand', sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
    margin: 0;
    padding: 0;
}

.nn-footer span {
    font-family: 'Quicksand', sans-serif;
    font-size: 10px;
    font-weight: 500;
    opacity: 0.95;
    line-height: 1.2;
    margin: 0;
    padding: 0;
}

/* ============ OPEN STATE (mobile click) ============ */
#nn-floating-contact.nn-open .nn-contact-body {
    max-height: 500px;
    opacity: 1;
}
#nn-floating-contact.nn-open .nn-footer {
    max-height: 100px;
    opacity: 1;
    padding: 8px 10px;
}

/* ============ DESKTOP: HOVER ============ */
@media (min-width: 769px) {
    #nn-floating-contact:hover .nn-contact-body {
        max-height: 500px;
        opacity: 1;
    }
    #nn-floating-contact:hover .nn-footer {
        max-height: 100px;
        opacity: 1;
        padding: 8px 10px;
    }

    #nn-floating-contact .nn-chevron,
    #nn-floating-contact .nn-free-badge {
        display: none !important;
    }
}

/* ============ MOBILE ============ */
@media (max-width: 768px) {
    #nn-floating-contact {
        width: calc(100% - 20px);
        bottom: 10px;
        left: 10px !important;
        right: 10px !important;
        border-radius: 16px;
    }

    .nn-contact-header { padding: 10px 12px; }

    .nn-avatar { width: 38px; height: 38px; }

    .nn-name { font-size: 14px !important; }

    .nn-free-badge {
        display: inline-block !important;
        background: var(--nn-secondary, #6b4cfa);
        color: #fff;
        font-family: 'Quicksand', sans-serif;
        font-size: 10px;
        font-weight: 700;
        padding: 5px 10px;
        border-radius: 20px;
        margin-left: 8px;
        white-space: nowrap;
        flex-shrink: 0;
    }

     .nn-chevron {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        color: #8b9bb4;
        margin-left: 6px;
        transition: transform 0.3s ease;
        flex-shrink: 0;
    }

    #nn-floating-contact.nn-open .nn-chevron {
        transform: rotate(180deg);
    }

    .nn-contact-body {
        background: linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15)), var(--nn-primary, #141c2f);
        border-radius: 0 0 16px 16px;
    }

    .nn-list {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-around;
        align-items: flex-start;
        padding: 12px 6px 10px 6px !important;
        gap: 4px;
    }

    .nn-item {
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        padding: 4px !important;
        margin-bottom: 0 !important;
        border: none !important;
        background: transparent !important;
        flex: 1;
        min-width: 0;
        transform: none !important;
    }

    .nn-item:hover {
        background: transparent !important;
        border-color: transparent !important;
        transform: none !important;
    }
    .nn-item:hover .nn-icon { box-shadow: none !important; }

    .nn-icon {
        width: 42px !important;
        height: 42px !important;
        font-size: 18px !important;
        margin-right: 0 !important;
        margin-bottom: 5px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    }

    .nn-item-text {
        align-items: center !important;
        text-align: center !important;
    }

    .nn-item-text strong {
        font-size: 10px !important;
        font-weight: 600 !important;
        line-height: 1.2;
    }

    .nn-item-text span { display: none !important; }

    .nn-footer { display: none !important; }
}

/* ============ MOBILE RẤT NHỎ ============ */
@media (max-width: 380px) {
    .nn-icon { width: 38px !important; height: 38px !important; font-size: 16px !important; }
    .nn-item-text strong { font-size: 9px !important; }
    .nn-free-badge { font-size: 9px; padding: 4px 8px; }
}
/* ============ SVG ICON STYLING ============ */
.nn-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: block;
}

.nn-chevron svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    display: block;
}

.nn-avatar-placeholder svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    display: block;
}

.nn-footer span svg {
    display: inline-block;
    vertical-align: middle;
    margin-right: 2px;
}