/* =====================================================
   NOI CONTACT FORM — Matching noitoiden.com blue tone
   ===================================================== */

:root {
    --noi-primary: #0094d4;
    --noi-primary-dark: #007ab8;
    --noi-primary-light: #e8f6fc;
    --noi-primary-glow: rgba(0, 148, 212, 0.35);
    --noi-accent: #f7a824;
    --noi-text: #2c3e50;
    --noi-text-light: #7f8c9b;
    --noi-bg: #ffffff;
    --noi-bg-soft: #f5f8fb;
    --noi-border: #e2e8f0;
    --noi-success: #10b981;
    --noi-error: #ef4444;
    --noi-radius: 14px;
    --noi-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --noi-shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.18);
}

/* ===================== STICKY TOGGLE BUTTON ===================== */

.noi-contact-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999998;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--noi-primary), var(--noi-primary-dark));
    color: #fff;
    cursor: pointer;
    box-shadow: 0 4px 20px var(--noi-primary-glow), 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.noi-contact-toggle::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: var(--noi-primary-glow);
    animation: noi-pulse 2.5s ease-in-out infinite;
    z-index: -1;
}

.noi-contact-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 28px var(--noi-primary-glow), 0 4px 12px rgba(0,0,0,0.15);
}

.noi-contact-toggle svg {
    width: 26px;
    height: 26px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.noi-contact-toggle .noi-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.noi-contact-widget.is-open .noi-contact-toggle .noi-icon-mail {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.noi-contact-widget.is-open .noi-contact-toggle .noi-icon-close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

.noi-contact-widget.is-open .noi-contact-toggle::before {
    animation: none;
    opacity: 0;
}

@keyframes noi-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.5); opacity: 0; }
}

/* ===================== OVERLAY ===================== */

.noi-contact-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999996;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.noi-contact-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* ===================== POPUP ===================== */

.noi-contact-popup {
    position: fixed;
    bottom: 96px;
    right: 24px;
    z-index: 999997;
    width: 380px;
    max-height: calc(100vh - 130px);
    background: var(--noi-bg);
    border-radius: var(--noi-radius);
    box-shadow: var(--noi-shadow-lg);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.noi-contact-widget.is-open .noi-contact-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.noi-popup-inner {
    max-height: calc(100vh - 130px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.noi-popup-inner::-webkit-scrollbar {
    width: 5px;
}
.noi-popup-inner::-webkit-scrollbar-track {
    background: transparent;
}
.noi-popup-inner::-webkit-scrollbar-thumb {
    background: var(--noi-border);
    border-radius: 10px;
}

/* ===================== FORM HEADER ===================== */

.noi-form-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px 18px;
    background: linear-gradient(135deg, var(--noi-primary), var(--noi-primary-dark));
    color: #fff;
    position: relative;
}

.noi-popup-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    padding: 0;
}

.noi-popup-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.noi-popup-close svg {
    width: 18px;
    height: 18px;
}

.noi-form-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.noi-form-header-icon svg {
    width: 24px;
    height: 24px;
    color: #fff;
}

.noi-form-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
}

.noi-form-subtitle {
    margin: 2px 0 0;
    font-size: 12.5px;
    opacity: 0.85;
    line-height: 1.3;
    white-space: nowrap;
}

/* ===================== FORM ===================== */

.noi-contact-form {
    padding: 20px 24px 24px;
    position: relative;
}

.noi-field {
    margin-bottom: 16px;
}

.noi-field label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--noi-text);
    margin-bottom: 6px;
}

.noi-field label svg {
    width: 15px;
    height: 15px;
    color: var(--noi-primary);
    flex-shrink: 0;
}

.noi-required {
    color: var(--noi-error);
    font-weight: 700;
}

.noi-field input,
.noi-field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--noi-border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--noi-text);
    background: var(--noi-bg);
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.noi-field input::placeholder,
.noi-field textarea::placeholder {
    color: #b0bec5;
}

.noi-field input:focus,
.noi-field textarea:focus {
    border-color: var(--noi-primary);
    box-shadow: 0 0 0 3px var(--noi-primary-light);
}

.noi-field input.noi-invalid,
.noi-field textarea.noi-invalid {
    border-color: var(--noi-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.noi-field textarea {
    resize: vertical;
    min-height: 90px;
    max-height: 200px;
    line-height: 1.5;
}

.noi-char-count {
    display: block;
    text-align: right;
    font-size: 11px;
    color: var(--noi-text-light);
    margin-top: 4px;
}

/* ===================== ERROR MESSAGE ===================== */

.noi-form-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: var(--noi-error);
    line-height: 1.5;
}

/* ===================== SUBMIT BUTTON ===================== */

.noi-submit-btn {
    width: 100%;
    padding: 13px 20px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--noi-primary), var(--noi-primary-dark));
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    outline: none;
}

.noi-submit-btn:hover {
    background: linear-gradient(135deg, var(--noi-primary-dark), #00658a);
    box-shadow: 0 4px 16px var(--noi-primary-glow);
    transform: translateY(-1px);
}

.noi-submit-btn:active {
    transform: translateY(0);
}

.noi-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.noi-btn-text svg {
    width: 18px;
    height: 18px;
    display: inline-block;
    vertical-align: middle;
    margin-right: 2px;
}

.noi-btn-text,
.noi-btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Spinner */
.noi-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: noi-spin 0.7s linear infinite;
}

@keyframes noi-spin {
    to { transform: rotate(360deg); }
}

/* ===================== SUCCESS SCREEN ===================== */

.noi-success-screen {
    padding: 30px 24px 24px;
    text-align: center;
}

.noi-success-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: noi-pop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.noi-success-icon svg {
    width: 34px;
    height: 34px;
    color: var(--noi-success);
}

@keyframes noi-pop {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

.noi-success-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--noi-text);
    margin: 0 0 8px;
}

.noi-success-message {
    font-size: 14px;
    color: var(--noi-text-light);
    line-height: 1.5;
    margin: 0 0 24px;
}

/* ===================== SUGGESTED POSTS ===================== */

.noi-suggested-posts {
    border-top: 1px solid var(--noi-border);
    padding-top: 18px;
    margin-bottom: 18px;
}

.noi-suggested-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--noi-text-light);
    margin: 0 0 12px;
}

.noi-posts-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.noi-post-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 10px;
    background: var(--noi-bg-soft);
    text-decoration: none;
    color: var(--noi-text);
    transition: all 0.2s ease;
}

.noi-post-card:hover {
    background: var(--noi-primary-light);
    transform: translateX(4px);
}

.noi-post-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}

.noi-post-info {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.noi-post-info h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.noi-post-info p {
    margin: 3px 0 0;
    font-size: 11.5px;
    color: var(--noi-text-light);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ===================== SEND ANOTHER ===================== */

.noi-send-another {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1.5px solid var(--noi-border);
    border-radius: 10px;
    background: transparent;
    color: var(--noi-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.noi-send-another:hover {
    border-color: var(--noi-primary);
    color: var(--noi-primary);
    background: var(--noi-primary-light);
}

.noi-send-another svg {
    width: 16px;
    height: 16px;
}

/* ===================== INLINE (SHORTCODE) ===================== */

.noi-contact-inline {
    max-width: 520px;
    margin: 30px auto;
    border-radius: var(--noi-radius);
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--noi-border);
}

/* ===================== MOBILE RESPONSIVE ===================== */

@media (max-width: 480px) {
    .noi-contact-toggle {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
    }

    .noi-contact-toggle svg {
        width: 22px;
        height: 22px;
    }

    /* Hide floating toggle when popup is open on mobile */
    .noi-contact-widget.is-open .noi-contact-toggle {
        opacity: 0;
        pointer-events: none;
        transform: scale(0);
    }

    /* Show close button in header on mobile */
    .noi-popup-close {
        display: flex;
    }

    .noi-contact-popup {
        bottom: auto;
        top: 50%;
        left: 50%;
        right: auto;
        width: calc(100% - 32px);
        max-width: 400px;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: var(--noi-radius);
        transform: translate(-50%, -50%) scale(0.9);
        opacity: 0;
        transform-origin: center center;
    }

    .noi-contact-widget.is-open .noi-contact-popup {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }

    .noi-popup-inner {
        max-height: 90vh;
        max-height: 90dvh;
    }

    .noi-form-header {
        padding: 14px 20px 12px;
        padding-right: 50px;
    }

    .noi-form-header-icon {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .noi-form-header-icon svg {
        width: 20px;
        height: 20px;
    }

    .noi-form-title {
        font-size: 15px;
    }

    .noi-form-subtitle {
        font-size: 11.5px;
    }

    .noi-contact-form {
        padding: 12px 16px 16px;
    }

    .noi-field {
        margin-bottom: 10px;
    }

    .noi-field label {
        font-size: 12px;
        margin-bottom: 4px;
    }

    .noi-field input,
    .noi-field textarea {
        font-size: 16px;
        padding: 10px 12px;
    }

    .noi-field textarea {
        min-height: 70px;
        rows: 3;
    }

    .noi-submit-btn {
        padding: 12px 16px;
        font-size: 14px;
    }

    .noi-success-screen {
        padding: 24px 20px 20px;
    }

    .noi-post-card {
        padding: 8px;
    }

    .noi-post-thumb {
        width: 48px;
        height: 48px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    .noi-contact-popup {
        width: 360px;
        right: 16px;
        bottom: 88px;
    }
}
