/* NBN Sticky Address Checker Widget
   Uses troppo-unified-theme.css variables */

/* =========================================
   Container & Positioning
   ========================================= */

.nbn-sticky-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 380px;
    max-width: calc(100vw - 32px);
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--troppo-radius-md, 20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 40px rgba(32, 214, 180, 0.08);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}

.nbn-sticky-widget--hidden {
    transform: translateY(120%);
    opacity: 0;
    pointer-events: none;
}

.nbn-sticky-widget--visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* =========================================
   Inner container
   ========================================= */

.nbn-sticky-widget__inner {
    position: relative;
    padding: 20px 20px 16px;
}

/* =========================================
   State visibility
   ========================================= */

.nbn-sticky-widget__state--hidden {
    display: none !important;
}

/* =========================================
   Address input state
   ========================================= */

.nbn-sticky-widget__prompt {
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--troppo-text-primary, #fff);
    padding-right: 24px;
}

.nbn-sticky-widget__input-row {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

#nbn-sticky-widget .nbn-sticky-widget__input,
#nbn-sticky-widget input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 12px 16px;
    font-size: 14px;
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

#nbn-sticky-widget .nbn-sticky-widget__input::placeholder,
#nbn-sticky-widget input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#nbn-sticky-widget .nbn-sticky-widget__input:focus,
#nbn-sticky-widget input[type="text"]:focus {
    border-color: #20d6b4;
    box-shadow: 0 0 0 3px rgba(32, 214, 180, 0.15), 0 0 20px rgba(32, 214, 180, 0.1);
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* =========================================
   Buttons
   ========================================= */

#nbn-sticky-widget .nbn-sticky-widget__btn,
#nbn-sticky-widget button[type="button"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 22px;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 50%, #ffd93d 100%);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    text-decoration: none;
    line-height: 1.4;
}

#nbn-sticky-widget .nbn-sticky-widget__btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 107, 107, 0.4);
}

#nbn-sticky-widget .nbn-sticky-widget__btn:active {
    transform: translateY(0);
}

#nbn-sticky-widget .nbn-sticky-widget__btn--primary {
    background: linear-gradient(135deg, #20d6b4 0%, #4ecdc4 100%);
    color: #1a1a2e;
}

#nbn-sticky-widget .nbn-sticky-widget__btn--primary:hover {
    box-shadow: 0 5px 20px rgba(32, 214, 180, 0.4);
}

/* =========================================
   Error message
   ========================================= */

.nbn-sticky-widget__error {
    display: none;
    margin-top: 8px;
    padding: 6px 10px;
    font-size: 12px;
    color: var(--troppo-coral, #ff6b6b);
    background: rgba(255, 107, 107, 0.1);
    border-radius: 8px;
}

/* =========================================
   Returning visitor state
   ========================================= */

.nbn-sticky-widget__returning-label {
    margin: 0 0 4px;
    font-size: 13px;
    color: var(--troppo-text-secondary, rgba(255, 255, 255, 0.8));
    padding-right: 24px;
}

.nbn-sticky-widget__returning-address {
    display: block;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--troppo-text-primary, #fff);
    line-height: 1.3;
}

.nbn-sticky-widget__returning-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nbn-sticky-widget__link {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    color: var(--troppo-lagoon, #20d6b4);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.nbn-sticky-widget__link:hover {
    color: var(--troppo-wave, #4ecdc4);
}

/* =========================================
   Loading state
   ========================================= */

#nbn-sw-loading-state {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.nbn-sticky-widget__spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--troppo-glass-border, rgba(255, 255, 255, 0.15));
    border-top-color: var(--troppo-lagoon, #20d6b4);
    border-radius: 50%;
    animation: nbn-sw-spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

.nbn-sticky-widget__loading-text {
    font-size: 14px;
    color: var(--troppo-text-secondary, rgba(255, 255, 255, 0.8));
}

/* =========================================
   Result flash state
   ========================================= */

#nbn-sw-result-state {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.nbn-sticky-widget__result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--troppo-lagoon, #20d6b4);
    color: var(--troppo-text-dark, #1a1a2e);
    border-radius: 50%;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.nbn-sticky-widget__result-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--troppo-lagoon, #20d6b4);
}

/* =========================================
   Upgrade badge (FTTN/FTTC -> FTTP)
   ========================================= */

.nbn-sticky-widget__upgrade-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #1a1a2e;
    background: linear-gradient(135deg, #20d6b4 0%, #4ecdc4 100%);
    border-radius: 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* =========================================
   Dismiss button
   ========================================= */

#nbn-sticky-widget .nbn-sticky-widget__dismiss {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.6);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

#nbn-sticky-widget .nbn-sticky-widget__dismiss:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

/* =========================================
   Floating Action Button (separate from widget)
   ========================================= */

.nbn-sticky-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 26, 46, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 40px rgba(32, 214, 180, 0.08);
    color: #20d6b4;
    cursor: pointer;
    padding: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s ease;
}

.nbn-sticky-fab--hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

.nbn-sticky-fab--visible {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

.nbn-sticky-fab:hover {
    color: #4ecdc4;
    transform: scale(1.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 40px rgba(32, 214, 180, 0.2);
}

.nbn-sticky-fab__search {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.nbn-sticky-fab__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    display: none;
    align-items: center;
    justify-content: center;
    background: #20d6b4;
    color: #1a1a2e;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
}

.nbn-sticky-fab--has-address .nbn-sticky-fab__badge {
    display: flex;
}

/* =========================================
   Google Places dropdown override
   ========================================= */

.pac-container {
    z-index: 10001 !important;
}

/* Force Google Places dropdown above the sticky widget input */
.pac-container.pac-container-sticky {
    bottom: 100% !important;
    top: auto !important;
    margin-bottom: 4px;
    margin-top: 0;
    border-radius: 12px;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.3);
}

/* =========================================
   Mobile: full-width bottom sheet
   ========================================= */

@media (max-width: 480px) {
    .nbn-sticky-widget {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        border-bottom: none;
    }

    .nbn-sticky-fab {
        bottom: 16px;
        right: 16px;
    }

    .nbn-sticky-widget__inner {
        padding: 16px 16px 20px;
    }

    .nbn-sticky-widget__input-row {
        flex-direction: column;
    }

    .nbn-sticky-widget__btn {
        width: 100%;
        padding: 12px 20px;
    }

    .nbn-sticky-widget__returning-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .nbn-sticky-widget__link {
        text-align: center;
        padding: 8px 0;
    }
}

/* Tablet adjustment */
@media (min-width: 481px) and (max-width: 768px) {
    .nbn-sticky-widget {
        width: 340px;
        bottom: 16px;
        right: 16px;
    }
}
