﻿/* 
 * Enea AI Chat - Core Styles
 * Incolla qui tutto il contenuto del blocco <style>...</style> 
 * Nota: Non includere i tag <style>, solo il CSS.
 */
/* CSS BASE */
:root {
    --sg-primary: #D32F2F;
    --sg-primary-dark: #B71C1C;
    --sg-bg-app: #F5F7F9;
    --sg-surface: #FFFFFF;
    --sg-text-main: #1F2937;
    --sg-text-muted: #6B7280;
    --sg-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.04);
    --sg-thinking-color: #2563EB;
    --sg-pro-color: #7E22CE;
}

/* 2.0 BADGE ANIMATION */
@keyframes sg-pulse-badge {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.6;
    }
}

html,
body {
    overflow: hidden !important;
    height: 100% !important;
    margin: 0;
    padding: 0;
    background-color: var(--sg-bg-app) !important;
    touch-action: manipulation;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

#sg-container {
    display: flex !important;
    flex-direction: column !important;
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100dvh;
    background: var(--sg-bg-app);
    z-index: 999999;
}

.sg-header {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    padding: max(8px, env(safe-area-inset-top)) 12px 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 30;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    height: 56px;
}

.sg-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.sg-header-avatar {
    position: relative;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.sg-version-badge {
    font-size: 10px;
    color: var(--sg-primary);
    background: rgba(211, 47, 47, 0.1);
    padding: 2px 5px;
    border-radius: 4px;
    font-weight: 800;
    margin-left: 4px;
    opacity: 0.8;
    vertical-align: middle;
    letter-spacing: 0.5px;
}

.sg-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sg-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 9px;
    height: 9px;
    background: #10B981;
    border: 2px solid #fff;
    border-radius: 50%;
}

.sg-brand-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    justify-content: center;
    min-width: 0;
}

.sg-brand-name {
    font-size: 19px;
    color: var(--sg-text-main);
    font-weight: 800;
    white-space: nowrap;
}

.sg-brand-role {
    font-size: 13px;
    color: var(--sg-text-muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sg-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sg-modern-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F3F4F6;
    color: #4B5563;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 0;
    flex-shrink: 0;
}

.sg-modern-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.sg-modern-btn:active {
    transform: scale(0.92);
}

#sg-pro-toggle {
    font-size: 20px;
    background: #F3F4F6;
    color: #4B5563;
    border: 1px solid transparent;
}

#sg-pro-toggle.active {
    background: linear-gradient(135deg, #8B5CF6 0%, #7E22CE 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(126, 34, 206, 0.4);
    border-color: transparent;
}

#sg-header-live-btn {
    display: flex;
    /* ENABLED: Live voice feature */
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid transparent;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0px;
    background: #F3F4F6;
    color: #4B5563;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
}

#sg-header-live-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    margin-top: 2px;
}

.sg-live-micro-text {
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0.5px;
    line-height: 1;
    margin-bottom: 3px;
}

#sg-header-live-btn.active-live {
    background: #FEE2E2;
    color: #DC2626;
    border-color: #FECACA;
    animation: sg-border-pulse 2s infinite;
}

#sg-header-live-btn svg {
    stroke-width: 0;
}

.sg-util-btn {
    background: transparent;
    border: none;
    color: #9CA3AF;
    width: 38px;
    height: 38px;
}

.sg-util-btn:hover {
    color: var(--sg-text-main);
    background: rgba(0, 0, 0, 0.03);
}

/* CHAT BODY */
#sg-chat-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 20px 0;
    /* Remove side padding for full width cards */
    display: flex;
    flex-direction: column;
    gap: 18px;
    overscroll-behavior-y: contain;
    scroll-behavior: smooth;
    width: 100%;
}

/* Styled Scrollbar */
#sg-chat-body::-webkit-scrollbar {
    width: 6px;
}

#sg-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

#sg-chat-body::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

#sg-chat-body::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* MESSAGES ROW */
.sg-msg-row {
    display: flex;
    width: 100%;
    margin-bottom: 12px;
    /* More spacing between messages */
    animation: sg-msg-fade-in 0.3s ease-out;
}

@keyframes sg-msg-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sg-msg-row.bot {
    width: 100%;
    display: block;
    /* Use block to allow full width child */
    padding: 0;
}

.sg-msg-row.user {
    justify-content: flex-end;
    padding-right: 12px;
    /* Restore spacing for user bubbles */
    padding-left: 12px;
    /* Prevent touching left edge on mobile */
}

/* CARD SYSTEM (New Structure) */
/* CARD SYSTEM (New Structure) */
/* CARD SYSTEM (New Structure) */
.sg-card-container {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-top: 8px;
    /* Reduced top margin */
    margin-bottom: 12px;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    display: flex;
    /* Flex column to remove whitespace issues */
    flex-direction: column;
    box-sizing: border-box;
    /* Critical for width */
}

/* Fix "Space Above Image": Ensure text before card doesn't push it too much */
.sg-msg-bot p:last-of-type {
    margin-bottom: 8px;
}

.sg-card-media {
    width: 100%;
    height: 180px;
    background: #f3f4f6;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #F3F4F6;
    border-top-left-radius: 11px;
    border-top-right-radius: 11px;
    margin: 0 !important;
    /* Force no margin */
    padding: 0 !important;
    /* Force no padding */
    display: block;
}

.sg-card-media img,
.sg-card-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Remove inline gap */
    border-top-left-radius: 11px;
    border-top-right-radius: 11px;
    margin: 0 !important;
    padding: 0 !important;
}

.sg-card-content {
    padding: 16px;
    background: #fff;
    flex: 1;
    /* Stretch content */
}

.sg-card-title {
    font-size: 18px;
    font-weight: 800;
    color: #111827;
    line-height: 1.25;
    margin-bottom: 4px;
    margin-top: 0;
    /* Clear top margin */
    letter-spacing: -0.02em;
}

.sg-card-subtitle {
    font-size: 14px;
    color: #6B7280;
    font-weight: 500;
    margin-bottom: 12px;
}

.sg-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    background: #F9FAFB;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #F3F4F6;
}

.sg-meta-item {
    display: flex;
    flex-direction: column;
}

.sg-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #9CA3AF;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sg-meta-val {
    font-size: 13px;
    color: #374151;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* -- Actions / Buttons Adjustments inside Card -- */
.sg-card-content .sg-btn-grid {
    margin-top: 10px;
}

.sg-card-content .sg-ai-player-container {
    margin-top: 8px;
    margin-bottom: 12px;
}

.sg-card-disclaimer {
    font-size: 11px;
    color: #9CA3AF;
    text-align: center;
    margin-top: 4px;
}

/* Legacy Image Support (User Uploads) */
.sg-msg img.legacy-img {
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* BOT MESSAGE - FULL WIDTH CARD */
/* BOT MESSAGE - TRANSPARENT CONTAINER (No Bubble) */
.sg-msg-bot {
    width: 100%;
    max-width: 100%;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0;
    color: var(--sg-text-main);
    border-radius: 0;
}

/* USER MESSAGE - MODERN BUBBLE */
/* USER MESSAGE - MODERN BUBBLE */
.sg-msg-user {
    max-width: 94%;
    background: var(--sg-primary);
    background: linear-gradient(135deg, #D32F2F 0%, #B71C1C 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 10px 16px 10px 14px;
    /* Reduced left padding */
    box-shadow: 0 4px 10px rgba(183, 28, 28, 0.2);
    font-weight: 500;
    font-size: 15px;
    text-align: left !important;
    /* Force left alignment */
}

.sg-msg img {
    width: 100%;
    height: auto;
    /* Allow auto height */
    max-height: 220px;
    /* Cap height */
    object-fit: cover;
    border-radius: 8px;
    margin: 12px 0;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.sg-msg-user a {
    color: #fff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* PLAYER AUDIO */
.sg-ai-player-container {
    display: flex;
    gap: 10px;
    margin: 14px 0;
    width: 100%;
    align-items: center;
}

.sg-btn-ai-play {
    flex: 1;
    background-color: #FFFFFF !important;
    border: 1px solid #E5E7EB !important;
    color: #374151 !important;
    border-radius: 12px !important;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
    text-decoration: none !important;
    background-image: none !important;
}

.sg-btn-ai-play::before {
    content: none !important;
}

.sg-btn-ai-play:hover {
    border-color: #D1D5DB !important;
    background-color: #F9FAFB !important;
}

.sg-btn-ai-play:active {
    transform: scale(0.98);
}

.sg-btn-ai-stop {
    width: auto !important;
    padding: 0 20px !important;
    flex: 1;
    /* Takes full width when visible */
    height: 46px;
    background-color: #B71C1C !important;
    border: 1px solid #E5E7EB !important;
    border-radius: 12px !important;
    display: none !important;
    /* Hidden by default */
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #fff !important;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    background-image: none !important;
    font-weight: 700;
}

.sg-btn-ai-stop::after {
    content: none !important;
}

.sg-ai-player-container.playing .sg-btn-ai-play {
    display: none !important;
    /* Hide play button when playing */
}

.sg-ai-player-container.playing .sg-btn-ai-stop {
    display: flex !important;
    /* Show stop button when playing */
    background-color: #FEF2F2 !important;
    border-color: #FECACA !important;
    color: #DC2626 !important;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.15);
}

.sg-btn-ai-play.loading {
    opacity: 0.7;
    pointer-events: none;
    color: #6B7280 !important;
}

.sg-btn-audio {
    background: #F3F4F6;
    color: #374151;
    border: 1px solid #E5E7EB;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.sg-btn-audio.active {
    background: #FEE2E2;
    color: #B91C1C;
    border-color: #FECACA;
}

.sg-input-dock {
    flex: 0 0 auto;
    background: var(--sg-surface);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 8px 12px max(15px, env(safe-area-inset-bottom)) 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 40;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.03);
}

#sg-chips-bar {
    display: flex;
    gap: 3px;
    overflow-x: auto;
    padding: 2px 4px 4px 4px;
    scrollbar-width: none;
}

#sg-chips-bar::-webkit-scrollbar {
    display: none;
}

.sg-chip {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #FFFFFF !important;
    /* Cleaner White BG */
    border: 1px solid #E5E7EB !important;
    /* Subtle Border */
    color: #4B5563 !important;
    height: 38px !important;
    padding: 0 14px !important;
    /* Sleek: Low height, wide width */
    font-size: 14px !important;
    /* Elegant size */
    line-height: 1.4 !important;
    border-radius: 100px;
    font-weight: 500;
    /* Lighter weight */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    margin-right: 6px;
    box-sizing: border-box !important;
    /* Force consistent sizing */
    min-width: 0;
    /* Flex fix */
}

.sg-chip:hover {
    background: #F9FAFB !important;
    border-color: #D1D5DB !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
}

.sg-chip:active,
.sg-chip.active {
    background: #FEF2F2 !important;
    /* Very Faint Red Tint */
    border-color: #EF4444 !important;
    /* Red Border */
    color: #DC2626 !important;
    /* Red Text */
    transform: scale(0.98);
    box-shadow: none !important;
}

.sg-chip.pro-chip {
    background: #FFFBEB !important;
    /* Soft Amber/Yellow */
    border-color: #F59E0B !important;
    /* Amber 500 */
    color: #B45309 !important;
    /* Amber 700 */
    /* Redundant safety to ensure EXACT match */
    height: 40px !important;
    padding: 0 16px !important;
    font-size: 15px !important;
}

.sg-chip.pro-chip:active {
    background: #FEF3C7 !important;
    /* Slightly darker yellow */
    color: #92400E !important;
    /* Darker amber */
}

.sg-controls-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sg-red-btn {
    background: var(--sg-primary);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(211, 47, 47, 0.25);
    transition: transform 0.2s;
}

.sg-red-btn:active {
    transform: scale(0.92);
    opacity: 0.9;
}

.sg-red-btn svg {
    stroke-width: 2px;
}

#sg-photo-trigger,
#sg-mic-btn {
    width: 48px;
    height: 48px;
}

#sg-photo-trigger svg,
#sg-mic-btn svg {
    width: 36px;
    height: 36px;
}

#sg-mic-btn.recording {
    background: #fff;
    color: var(--sg-primary);
    border: 2px solid var(--sg-primary);
    animation: sg-pulse-ring 1.5s infinite;
}

.sg-field-wrap {
    flex: 1;
    height: 44px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 22px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    transition: border-color 0.2s, background 0.2s;
}

.sg-field-wrap:focus-within {
    border-color: var(--sg-primary);
    background: #fff;
}

#sg-text-input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-size: 16px;
    color: var(--sg-text-main);
    padding: 0;
    margin: 0;
}

#sg-send-btn {
    width: 48px;
    height: 48px;
    background: var(--sg-primary-dark) !important;
    opacity: 1 !important;
}

#sg-send-btn:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed;
}

#sg-send-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
    stroke: none;
    margin-left: 2px;
}

#sg-live-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    z-index: 9999990;
    /* Must be above container (999999) but below booking modal (9999999) */
    display: none;
    visibility: hidden;
    opacity: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.sg-live-avatar-wrap {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    padding: 6px;
    background: #fff;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.sg-live-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    position: relative;
    z-index: 2;
}

.sg-live-avatar-wrap.sg-is-thinking {
    border-color: var(--sg-thinking-color);
    animation: sg-pulse-blue 2s infinite ease-in-out;
}

.sg-live-avatar-wrap.sg-is-speaking {
    border-color: var(--sg-primary);
    animation: sg-pulse-speaking 1.5s infinite ease-in-out;
}

#sg-live-loader {
    width: 120px;
    height: 4px;
    background: #E5E7EB;
    border-radius: 2px;
    margin-bottom: 20px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s;
}

#sg-live-loader.active {
    opacity: 1;
}

#sg-live-loader .sg-bar-inner {
    width: 0%;
    height: 100%;
    background: var(--sg-primary);
    border-radius: 2px;
}

#sg-live-loader.active .sg-bar-inner {
    animation: sg-load-anim 1.5s infinite ease-in-out;
}

.sg-live-status-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--sg-text-muted);
    font-weight: 700;
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.05);
    padding: 4px 12px;
    border-radius: 20px;
}

#sg-live-status-text {
    font-size: 26px;
    font-weight: 800;
    color: var(--sg-text-main);
    margin-bottom: 40px;
    text-align: center;
    max-width: 80%;
    line-height: 1.3;
    min-height: 34px;
}

#sg-live-interrupt {
    padding: 18px 30px;
    background: linear-gradient(135deg, #FF5252 0%, #D32F2F 100%);
    color: #fff;
    border: none;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(211, 47, 47, 0.4);
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
}

#sg-live-interrupt.sg-disabled-btn {
    background: #D1D5DB;
    color: #6B7280;
    box-shadow: none;
    transform: scale(0.98);
}

#sg-live-interrupt svg {
    width: 24px;
    height: 24px;
}

.sg-live-close-circle {
    margin-top: 50px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #E5E7EB;
    color: #9CA3AF;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.sg-live-close-circle:hover {
    border-color: var(--sg-primary);
    color: var(--sg-primary);
}

@keyframes sg-pop-in {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* GRID BUTTONS - MODERN & PROFESSIONAL */
/* GRID BUTTONS - MODERN & PROFESSIONAL */
.sg-btn-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* Force 2 columns */
    gap: 10px;
    margin-top: 16px;
    margin-bottom: 8px;
}

.sg-grid-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 10px 12px !important;
    border-radius: 10px !important;
    /* Slightly more rounded */
    font-weight: 600 !important;
    font-size: 13px !important;
    text-decoration: none !important;
    text-align: center !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04) !important;
    color: #374151 !important;
    background: #FFFFFF !important;
    gap: 6px !important;
    line-height: 1.3 !important;
    min-height: 40px !important;
}

.sg-grid-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
}

.sg-grid-btn:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.sg-grid-btn svg,
.sg-grid-btn span {
    margin-right: 0 !important;
    font-size: 16px !important;
    /* Larger icons */
}

/* Modern Button Variants - Subtle & Clean */
.btn-pastel-std {
    border-left: 3px solid #6B7280 !important;
}

.btn-pastel-green {
    border-left: 3px solid #10B981 !important;
    color: #065F46 !important;
    background: #F0FDF4 !important;
}

.btn-pastel-yellow {
    border-left: 3px solid #F59E0B !important;
    color: #92400E !important;
    background: #FFFBEB !important;
}

.btn-pastel-orange {
    border-left: 3px solid #F97316 !important;
    color: #9A3412 !important;
    background: #FFF7ED !important;
}

.btn-pastel-gold {
    border-left: 3px solid #D97706 !important;
    color: #92400E !important;
    background: #FEF3C7 !important;
}

.btn-pastel-red {
    border-left: 3px solid #EF4444 !important;
    color: #991B1B !important;
    background: #FEF2F2 !important;
}

.btn-pastel-map {
    border-left: 3px solid #3B82F6 !important;
    color: #1E40AF !important;
    background: #EFF6FF !important;
}

.btn-pastel-parking {
    border-left: 3px solid #6366F1 !important;
    color: #3730A3 !important;
    background: #EEF2FF !important;
}

.btn-pastel-360 {
    border-left: 3px solid #8B5CF6 !important;
    color: #5B21B6 !important;
    background: #F5F3FF !important;
    width: 100%;
    /* Removed grid-column: span 2 to allow side-by-side */
}

.btn-pastel-read-full {
    border-left: 3px solid #EC4899 !important;
    color: #9D174D !important;
    background: #FDF2F8 !important;
    width: 100%;
    grid-column: span 2;
}

/* THINKING UI (PREMIUM) - Minimal & Full Width */
.sg-thinking-bubble {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0;
    /* Removed padding */
    background: transparent !important;
    /* Removed background */
    border: none !important;
    /* Removed border */
    box-shadow: none !important;
    /* Removed shadow */
    margin: 8px 0 16px 0;
    max-width: 100%;
    width: 100%;
    border-radius: 0;
}

.sg-thinking-bubble.is-pro {
    background: transparent;
    border: none;
    box-shadow: none;
}

.sg-thinking-bubble::before {
    display: none;
    /* Remove gradient accent */
}

.sg-think-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    animation: sg-pulse-scale 1.5s infinite ease-in-out;
}

/* Increased to 15px (User Req) */
.sg-think-text {
    background: linear-gradient(90deg, #374151 0%, #6B7280 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    display: inline-block;
    vertical-align: middle;
    font-size: 15px;
    /* Increased to 15px */
    font-weight: 500;
}

/* === USER IMAGE MESSAGE (Photo Upload) === */
.sg-msg-row.user-img {
    justify-content: flex-end;
}

.sg-msg-user-img {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    max-width: 75%;
    border-radius: 16px;
    overflow: hidden;
}

.sg-msg-user-img img {
    width: 100%;
    max-width: 280px;
    height: auto;
    max-height: 320px;
    object-fit: cover;
    border-radius: 16px;
    margin: 0;
    display: block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
    border: 2px solid rgba(211, 47, 47, 0.15);
}

/* Legacy chat image preview (deprecated) */
.sg-chat-img-preview {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    margin-right: 12px;
    border: 2px solid #e5e7eb;
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.sg-think-dots span {
    display: inline-block;
    width: 4px;
    height: 4px;
    background: #9CA3AF;
    border-radius: 50%;
    margin-left: 2px;
    animation: sg-bounce 1.4s infinite ease-in-out both;
}

.sg-think-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.sg-think-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes sg-pulse-scale {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

@keyframes sg-bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* PRO MODE ACCENTS */
.sg-thinking-bubble.is-pro::before {
    background: linear-gradient(to bottom, #7E22CE, #EC4899);
}

.sg-thinking-bubble.is-pro .sg-think-icon {
    font-size: 18px;
}

.btn-pastel-std {
    background: #F3F4F6 !important;
    color: #1F2937 !important;
}

.btn-pastel-map {
    background: #E0F2FE !important;
    color: #0369A1 !important;
}

.btn-pastel-360 {
    background: #F3E8FF !important;
    color: #7E22CE !important;
}

.btn-pastel-green {
    background: #ECFDF5 !important;
    color: #047857 !important;
}

.btn-pastel-orange {
    background: #FFF7ED !important;
    color: #C2410C !important;
}

.btn-pastel-red {
    background: #FEF2F2 !important;
    color: #991B1B !important;
}

.btn-pastel-parking {
    background: #e3f2fd !important;
    color: #1565c0 !important;
    border-color: #bbdefb !important;
}

.btn-pastel-yellow {
    background: #FEF9C3 !important;
    color: #854D0E !important;
}

.btn-pastel-gold {
    background: #FFFBEB !important;
    color: #B45309 !important;
}

.btn-pastel-read-full {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    justify-content: center !important;
    background: #FEF2F2 !important;
    color: #991B1B !important;
    border: 1px solid #FCA5A5 !important;
    padding: 12px !important;
    border-radius: 12px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    margin-top: 5px !important;
}

.btn-pastel-read-full:active {
    transform: scale(0.98);
}

.sg-btn-parking-full {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 12px !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    margin-bottom: 12px !important;
    text-decoration: none !important;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
}

.sg-inline-player {
    width: 100%;
    margin: 10px 0;
    height: 40px;
    border-radius: 20px;
}

/* PREMIUM GOLD BUTTON */
.btn-gold-full {
    width: 100% !important;
    display: block !important;
    padding: 12px !important;
    background: #FFFBEB !important;
    color: #92400E !important;
    border: 1px solid #F59E0B !important;
    border-radius: 12px !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    text-align: center !important;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.15) !important;
    transition: all 0.2s ease;
    margin-top: 10px !important;
}

.btn-gold-full:hover {
    background: #FEF3C7 !important;
    transform: translateY(-1px);
}

.btn-gold-full:active {
    transform: scale(0.98);
    background: #FDE68A !important;
}

@media (max-width: 360px) {
    .btn-gold-full {
        font-size: 14px;
        padding: 10px;
    }

    .sg-grid-btn {
        font-size: 13px;
        padding: 8px 5px;
    }
}

/* === CARD CONTENT & TYPOGRAPHY === */
.sg-card-content {
    padding: 8px 12px 12px;
    /* Tight top padding to minimize gap */
    background: #fff;
    flex: 1;
    /* Fill remaining space */
    display: flex;
    flex-direction: column;
}

.sg-card-title {
    font-size: 17px;
    /* Matches generation size */
    font-weight: 800;
    line-height: 1.25;
    margin: 0 0 4px 0;
    /* NO top margin to fix gap */
    color: #111827;
}

.sg-card-subtitle {
    font-size: 13px;
    color: #6B7280;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.sg-card-disclaimer {
    font-size: 11px;
    color: #6B7280;
    text-align: center;
    margin-top: 6px;
    margin-bottom: 12px;
    line-height: 1.3;
}

.sg-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 10px 0;
    background: #F9FAFB;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #F3F4F6;
    align-items: start;
}

.sg-meta-item {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sg-meta-label {
    font-size: 10px;
    text-transform: uppercase;
    color: #9CA3AF;
    font-weight: 700;
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}

.sg-meta-val {
    font-size: 13px;
    /* Increased from 12px */
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* --- MODALE PRENOTAZIONE --- */
#sg-booking-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9999999;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sg-booking-card {
    background: #fff;
    width: 100%;
    max-width: 380px;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    box-sizing: border-box;
}

@media (max-width: 480px) {
    .sg-booking-card {
        width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        padding: 20px;
        display: flex;
        flex-direction: column;
    }

    .sg-btn-submit {
        margin-top: auto !important;
    }
}

.sg-booking-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #FFFFFF;
    border: 1px solid #DC2626;
    /* Red-600 */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #DC2626;
    /* Red-600 */
    font-size: 20px;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(220, 38, 38, 0.1);
}

.sg-booking-close:hover {
    background: #FEF2F2;
    transform: rotate(90deg) scale(1.05);
}

.sg-booking-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--sg-text-main);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sg-booking-sub {
    font-size: 14px;
    color: var(--sg-text-muted);
    margin-bottom: 20px;
    font-weight: 500;
}

.sg-form-group {
    margin-bottom: 16px;
    position: relative;
}

.sg-form-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: #6B7280;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sg-form-input {
    width: 100%;
    padding: 14px;
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    font-size: 16px !important;
    color: #374151;
    box-sizing: border-box;
    min-height: 50px;
}

.sg-form-input:focus {
    outline: none;
    border-color: var(--sg-primary);
    background: #fff;
}

.sg-form-input[readonly] {
    background-color: #fff;
    cursor: pointer;
}

.sg-btn-submit {
    width: 100%;
    padding: 16px;
    background: #1F2937;
    color: white;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    font-size: 16px;
    margin-top: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sg-btn-submit:active {
    transform: scale(0.98);
    background: #000;
}

.sg-disclaimer {
    font-size: 12px;
    color: #9CA3AF;
    margin-top: 15px;
    text-align: center;
    line-height: 1.4;
    padding-bottom: 20px;
}

.sg-booking-info-box {
    background: #EFF6FF;
    color: #1E40AF;
    font-size: 13px;
    line-height: 1.5;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #DBEAFE;
}

.sg-booking-info-box strong {
    color: #1E3A8A;
}

/* FLATPICKR CUSTOM */
.flatpickr-calendar {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    border-radius: 16px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
    border: none !important;
    z-index: 10000000 !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: var(--sg-primary) !important;
    border-color: var(--sg-primary) !important;
}

/* --- CUSTOM TIME PICKER OVERLAY (iOS STYLE) --- */
#sg-time-overlay {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000001;
    align-items: flex-end;
    justify-content: center;
}

.sg-time-card {
    background: #fff;
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 20px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

.sg-time-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sg-time-title {
    font-weight: 700;
    font-size: 18px;
    color: #333;
}

.sg-time-close {
    color: var(--sg-primary);
    font-weight: 600;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
}

.sg-time-columns {
    display: flex;
    justify-content: center;
    height: 200px;
    position: relative;
    overflow: hidden;
}

/* Linea di selezione centrale */
.sg-time-highlight {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 50px;
    margin-top: -25px;
    background: rgba(0, 0, 0, 0.04);
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    pointer-events: none;
    z-index: 1;
}

.sg-time-col {
    flex: 1;
    max-width: 100px;
    height: 100%;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    text-align: center;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-top: 75px;
    padding-bottom: 75px;
    /* Spacer per centrare */
}

.sg-time-col::-webkit-scrollbar {
    display: none;
}

.sg-time-item {
    height: 50px;
    line-height: 50px;
    font-size: 22px;
    font-weight: 500;
    color: #999;
    scroll-snap-align: center;
    transition: all 0.2s;
}

.sg-time-item.active {
    color: #000;
    font-weight: 800;
    font-size: 26px;
    transform: scale(1.1);
}

.sg-time-confirm {
    width: 100%;
    padding: 15px;
    background: var(--sg-primary);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 16px;
    margin-top: 20px;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

@keyframes sg-pop-in {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* === MISSING KEYFRAMES FOR ANIMATIONS === */
@keyframes sg-pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(211, 47, 47, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0);
    }
}

@keyframes sg-pulse-blue {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(37, 99, 235, 0);
    }
}

@keyframes sg-pulse-speaking {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.4);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(211, 47, 47, 0);
    }
}

@keyframes sg-border-pulse {

    0%,
    100% {
        border-color: #FECACA;
    }

    50% {
        border-color: #DC2626;
    }
}

@keyframes sg-load-anim {
    0% {
        width: 0%;
    }

    50% {
        width: 100%;
    }

    100% {
        width: 0%;
    }
}

#sg-install-btn:hover {
    background-color: #059669 !important;
    /* Darker green on hover */
    transform: scale(1.05);
}

#sg-install-btn:active {
    transform: scale(0.95);
}

/* Video / Reel Support */
.sg-card-media-wrap {
    width: 100%;
    margin-bottom: 0px !important;
    /* Removed gap per user request */
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #000;
}

.sg-card-video {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 9 / 16;
    object-fit: cover;
}

/* FLASH OFFER WIDGET */
.sg-flash-card {
    background: #FFF;
    border: 2px solid #FCD34D;
    /* Yellow-400 */
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    animation: sg-flash-slide-up 0.4s ease-out;
}

.sg-flash-header {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: white;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    letter-spacing: 1px;
    font-size: 14px;
    text-transform: uppercase;
}

.sg-flash-icon {
    font-size: 18px;
    animation: sg-pulse-scale 0.8s infinite;
}

.sg-flash-body {
    padding: 16px;
    text-align: center;
}

.sg-flash-body h3 {
    margin: 0 0 4px 0;
    color: #1F2937;
    font-size: 18px;
    font-weight: 700;
}

.sg-flash-deal {
    color: #4B5563;
    font-size: 15px;
    margin: 0 0 16px 0;
}

.sg-flash-timer-wrap {
    background: #FEF3C7;
    color: #92400E;
    display: inline-flex;
    flex-direction: column;
    padding: 8px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px dashed #D97706;
}

.sg-flash-timer-wrap span {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    opacity: 0.8;
}

.sg-flash-countdown {
    font-size: 24px;
    font-weight: 900;
    font-family: monospace;
    line-height: 1;
}

.sg-flash-btn {
    width: 100%;
    background: #DC2626;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(220, 38, 38, 0.2);
    transition: all 0.2s;
}

.sg-flash-btn:hover {
    background: #B91C1C;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(220, 38, 38, 0.3);
}

.sg-flash-btn:active {
    transform: scale(0.98);
}

.sg-flash-card.expired {
    filter: grayscale(1);
    opacity: 0.8;
    border-color: #9CA3AF;
}

@keyframes sg-flash-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* CAROUSEL LAYOUT (Horizontal Scroll) */
.sg-card-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 12px;
    padding: 4px 0 16px 0;
    /* Vertical padding for shadows */
    width: 100%;
    -webkit-overflow-scrolling: touch;
    /* Smooth scroll on iOS */
    /* Hide scrollbar */
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
}

.sg-card-carousel::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

/* CARDS INSIDE CAROUSEL */
/* =========================================
   CAROUSEL V2 REFACTOR (FINAL CONSOLIDATED)
   ========================================= */

/* 1. CAROUSEL CONTAINER */
.sg-card-carousel {
    display: flex !important;
    width: 100% !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;

    /* Spacing */
    gap: 10px !important;
    padding: 0 0 16px 0 !important;
    /* Bottom padding for shadows */
    margin-top: 24px !important;
    margin-bottom: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;

    /* Left Alignment Logic */
    justify-content: flex-start !important;
    padding-left: 0 !important;
    scroll-padding-left: 0 !important;

    /* Scrollbar Hiding */
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

.sg-card-carousel::-webkit-scrollbar {
    display: none !important;
}

/* 2. CAROUSEL ITEMS (Cards) */
.sg-card-carousel .sg-card-container {
    /* WIDER SIZING: 95% (Balanced Peek) */
    flex: 0 0 95% !important;
    width: 95% !important;
    max-width: 95% !important;

    /* Alignment */
    scroll-snap-align: start !important;
    margin: 0 !important;

    /* Height */
    height: auto !important;
    align-self: stretch !important;
}

/* Desktop Override */
@media (min-width: 768px) {
    .sg-card-carousel .sg-card-container {
        flex: 0 0 320px !important;
        width: 320px !important;
        max-width: 320px !important;
    }
}

/* 3. SINGLE CARD (Non-Carousel) Override */
.sg-card-container:not(.sg-card-carousel .sg-card-container) {
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 24px !important;
    margin-bottom: 12px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    flex: none !important;
    display: flex !important;
    flex-direction: column !important;
}

/* 4. IMAGE FIXES (Shared) */
.sg-card-media img,
.sg-card-media video {
    display: block !important;
    width: 100% !important;
    border-radius: 12px 12px 0 0 !important;
    max-height: 220px !important;
    /* Increased from 160px per user request */
    object-fit: cover !important;
    margin: 0 !important;
}


/* =========================================
   CPT BADGES (Overlay Top-Right)
   ========================================= */

.sg-card-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;

    /* Glassmorphism Base */
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    .sg-trending-badge {
        position: absolute;
        top: 6px;
        right: 6px;
        font-size: 8px;
        font-weight: 800;
        text-transform: uppercase;
        color: #DC2626;
        background: #FEF2F2;
        border: 1px solid #FECACA;
        padding: 2px 5px;
        border-radius: 4px;
        letter-spacing: 0.5px;
        pointer-events: none;
        z-index: 5;
    }

    /* Typography */
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #333;
    /* Default text */

    /* Shape */
    padding: 3px 8px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);

    /* Border for crispness */
    border: 1px solid rgba(255, 255, 255, 0.5);
    pointer-events: none;
    /* Let clicks pass through to image/card */
}

/* --- CPT COLORS (Text & Subtle Border Hint) --- */

/* 1. ATTIVITA (Partners: Restaurants, Hotels) -> GOLD/ORANGE */
.sg-badge-attivita {
    color: #92400e !important;
    /* Dark Amber */
    background: rgba(255, 251, 235, 0.95) !important;
    /* Light Yellow */
    border-color: rgba(245, 158, 11, 0.3) !important;
}

/* 2. EVENTI -> PURPLE */
.sg-badge-evento {
    color: #5b21b6 !important;
    /* Dark Purple */
    background: rgba(245, 243, 255, 0.95) !important;
    border-color: rgba(139, 92, 246, 0.3) !important;
}

/* 3. ATTRAZIONI -> BLUE/INDIGO */
.sg-badge-attrazione,
.sg-badge-poi {
    color: #1e40af !important;
    /* Dark Blue */
    background: rgba(239, 246, 255, 0.95) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

/* 4. POST (Articoli) -> SLATE/GREY (Though we try to hide them usually) */
.sg-badge-post {
    color: #334155 !important;
    background: rgba(241, 245, 249, 0.95) !important;
}

/* 5. PARCHEGGIO -> EMERALD/GREEN */
.sg-badge-parcheggio {
    color: #065f46 !important;
    background: rgba(236, 253, 245, 0.95) !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

/* 6. SPIAGGE -> CYAN/TEAL */
.sg-badge-spiagge {
    color: #0e7490 !important;
    background: rgba(236, 254, 255, 0.95) !important;
    border-color: rgba(6, 182, 212, 0.3) !important;
}

/* 7. FARMACIA -> RED/PINK */
.sg-badge-farmacia {
    color: #9f1239 !important;
    background: rgba(255, 241, 242, 0.95) !important;
    border-color: rgba(244, 63, 94, 0.3) !important;
}

/* --- DISCOVERY DOCK (Visuals: Chips Style) --- */

#sg-smart-dock {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 2px 4px 6px 4px;
    scrollbar-width: none;
    background: transparent;
    border-top: none;
    box-shadow: none;
    justify-content: flex-start;
    /* Left align like chips */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

#sg-smart-dock::-webkit-scrollbar {
    display: none;
}

.sg-dock-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;

    /* GLASSMORPHISM PILL */
    background: rgba(255, 255, 255, 0.85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    color: #374151 !important;

    /* MATCHING CHIP DIMENSIONS (Standard/Pro) */
    height: 40px !important;
    padding: 0 16px !important;
    font-size: 15px !important;
    line-height: 1.4 !important;

    border-radius: 999px;
    /* Pill Shape */

    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    /* Smoother */

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    text-decoration: none !important;
    margin-right: 0;
    min-width: auto;
    flex-direction: row;
}

.sg-dock-btn:hover {
    background: #FFFFFF !important;
    border-color: rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.sg-dock-btn:active {
    transform: scale(0.97);
    background: #F3F4F6 !important;
}

/* === PRO MODE ACCENT === */
.is-pro-mode .sg-dock-btn {
    border-color: rgba(245, 158, 11, 0.4) !important;
    /* Gold Hint */
    background: rgba(255, 253, 240, 0.9) !important;
    /* Warm Tint */
}

.is-pro-mode .sg-dock-btn:hover {
    border-color: #F59E0B !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15) !important;
    /* Gold Glow */
    background: #FFFBEB !important;
}

.sg-dock-btn .icon {
    font-size: 18px;
    filter: none;
    opacity: 1;
}

.sg-dock-btn .label {
    font-size: 15px;
    /* Increased per user request */
    font-weight: 600;
    letter-spacing: 0.2px;
}

/* --- DISCOVERY SHEET (Bottom Modal) --- */

.sg-glass-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    transform: translateY(110%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 99999;
    max-height: 70vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sg-glass-sheet.active {
    transform: translateY(0);
}

.sg-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sg-sheet-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--sg-text-main);
}

.sg-close-sheet {
    background: #F3F4F6;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}

.sg-sheet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.sg-sheet-item {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    min-height: 90px;
}

.sg-sheet-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.06);
    border-color: var(--sg-primary);
}

.sg-item-icon {
    font-size: 28px;
}

.sg-item-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--sg-text-main);
    line-height: 1.3;
}

/* --- DISCOVERY SHEET (Bottom Modal) --- */

.sg-glass-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    padding: 20px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    transform: translateY(110%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 99999;
    max-height: 70vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sg-glass-sheet.active {
    transform: translateY(0);
}

.sg-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.sg-sheet-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--sg-text-main);
}

.sg-close-sheet {
    background: #F3F4F6;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}

.sg-sheet-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.sg-sheet-item {
    background: #FFFFFF;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    min-height: 100px;
    /* Equal height enforcement */
    height: 100%;
    /* Fill grid cell */
    position: relative;
    /* For badge positioning */
}

.sg-sheet-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.06);
    border-color: var(--sg-primary);
}

.sg-item-icon {
    font-size: 24px;
}

.sg-item-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--sg-text-main);
    line-height: 1.25;

    /* 2 Line Clamp */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 2.5em;
    /* Fallback */
}

/* --- DISCOVERY MODAL OVERRIDES (Bottom Sheet Style) --- */

#sg-discovery-modal {
    align-items: flex-end !important;
    /* Bottom Align */
    padding: 0 !important;
}

#sg-discovery-modal .sg-booking-card {
    border-radius: 20px 20px 0 0 !important;
    /* Rounded top only */
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 85vh !important;

    /* FORCE AUTO HEIGHT (Override Booking Modal Full Screen on Mobile) */
    height: auto !important;
    min-height: 0 !important;

    padding-bottom: 40px !important;
    /* Safe area for thumbs */
    animation: sgSlideUp 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (max-width: 480px) {
    #sg-discovery-modal .sg-booking-card {
        height: auto !important;
        /* Crucial Override */
        flex: 0 0 auto !important;
        border-radius: 20px 20px 0 0 !important;
    }
}

@keyframes sgSlideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   REEL PLAYER - 9:16 Vertical Video (v7.1)
   ═══════════════════════════════════════════════════════════════════════════════ */

.sg-reel-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 8px 0;
}

.sg-reel-container {
    position: relative;
    width: 240px;
    aspect-ratio: 9 / 16;
    max-height: 420px;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.1);
}

.sg-reel-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Hide download button in video controls */
.sg-reel-container video::-webkit-media-controls-download-button,
.sg-reel-container video::-webkit-media-controls-enclosure {
    display: none !important;
}

.sg-reel-container video::-webkit-media-controls-panel {
    background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.6));
}

/* Glassmorphism Title Overlay */
.sg-reel-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 12px 12px 12px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    pointer-events: none;
}

.sg-reel-title {
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    margin: 0;
    line-height: 1.3;
}

.sg-reel-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.sg-reel-badge::before {
    content: "🎬";
}

/* Play Button Overlay (before play) */
.sg-reel-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.sg-chip {
    white-space: nowrap;
    background: #F3F4F6;
    border: 1px solid #E5E7EB;
    border-radius: 99px;
    padding: 8px 14px;
    /* Reduced horizontal padding */
    font-size: 14px;
    /* Increased font size */
    color: #374151;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    flex-shrink: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.sg-reel-play-btn::after {
    content: "";
    width: 0;
    height: 0;
    border-left: 22px solid #D32F2F;
    border-top: 13px solid transparent;
    border-bottom: 13px solid transparent;
    margin-left: 5px;
}

.sg-reel-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.sg-reel-container.playing .sg-reel-play-btn {
    display: none;
}

/* Responsive - Slightly larger on desktop */
@media (min-width: 480px) {
    .sg-reel-container {
        width: 280px;
        max-height: 500px;
    }
}

/* === TRENDING BADGE REFINEMENT (Round 4) === */
.sg-trending-badge {
    position: absolute !important;
    top: 6px !important;
    right: 6px !important;
    font-size: 8px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    color: #DC2626 !important;
    background: #FEF2F2 !important;
    border: 1px solid #FECACA !important;
    padding: 2px 5px !important;
    border-radius: 4px !important;
    letter-spacing: 0.5px !important;
    pointer-events: none;
    z-index: 20 !important;
    line-height: 1 !important;
    width: auto !important;
    margin: 0 !important;
    /* Ensure no flex shrink/grow issues */
    flex: 0 0 auto !important;
}

/* === ROUND 6: POPUP UI REFINEMENTS (Polished) === */

/* 1. Force Close Button Redesign (White BG + Red Border) */
#sg-discovery-modal .sg-booking-close {
    background: #FFFFFF !important;
    border: 1px solid #DC2626 !important;
    color: #DC2626 !important;
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 22px !important;
    position: absolute !important;
    top: 15px !important;
    right: 15px !important;
    z-index: 50 !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15) !important;
    transition: background 0.2s ease, transform 0.2s ease !important;
}

#sg-discovery-modal .sg-booking-close:hover {
    background: #FEF2F2 !important;
    /* Removed rotation, kept subtle scale */
    transform: scale(1.05) !important;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.20) !important;
}

/* 2. Red Background Decoration (Subtle Blobs - Reduced) */
#sg-discovery-modal .sg-booking-card {
    overflow: hidden !important;
    position: relative !important;
}

/* Decorative Red Blob Top-Right */
#sg-discovery-modal .sg-booking-card::before {
    content: "";
    position: absolute;
    top: -40px;
    right: -40px;
    width: 130px;
    height: 130px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.05) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

/* Decorative Red Blob Bottom-Left */
#sg-discovery-modal .sg-booking-card::after {
    content: "";
    position: absolute;
    bottom: -20px;
    left: -20px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(220, 38, 38, 0.04) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    z-index: 0;
    pointer-events: none;
}

/* Ensure content stays above blobs */
#sg-discovery-modal .sg-booking-title,
#sg-discovery-modal #sg-discovery-grid,
#sg-discovery-modal .sg-booking-close {
    position: relative;
    z-index: 10;
}

/* === DYNAMIC ITINERARY CARD === */
.sg-itinerary-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-top: 3px solid #D32F2F;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.sg-itin-header {
    margin-bottom: 16px;
    border-bottom: 1px solid #F3F4F6;
    padding-bottom: 12px;
}

.sg-itin-title {
    font-size: 18px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 6px;
}

.sg-itin-meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    color: #6B7280;
    font-weight: 500;
}

.sg-itin-timeline {
    position: relative;
    padding-left: 20px;
    margin-bottom: 16px;
}

/* Vertical Line */
.sg-itin-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: 0;
    width: 2px;
    background: #E5E7EB;
}

.sg-timeline-step {
    position: relative;
    padding-bottom: 20px;
}

.sg-timeline-step:last-child {
    padding-bottom: 0;
}

.sg-step-dot {
    position: absolute;
    left: -18px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #D32F2F;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #D32F2F;
}

.sg-step-time {
    font-size: 12px;
    color: #D32F2F;
    font-weight: 700;
    margin-bottom: 2px;
}

.sg-step-title {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 2px;
}

.sg-step-content {
    font-size: 14px;
    color: #374151;
    line-height: 1.4;
}

.sg-itin-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px dashed #E5E7EB;
}

.sg-itin-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none !important;
    transition: all 0.2s;
}

.btn-map {
    background: #EFF6FF;
    color: #2563EB;
    border: 1px solid #DBEAFE;
}

.btn-wa {
    background: #DCFCE7;
    color: #15803D;
    border: 1px solid #BBF7D0;
}

.sg-itin-btn:hover {
    filter: brightness(0.95);
    transform: translateY(-1px);
}

/* PRO MODE HEADER ANIMATIONS */
.sg-header-avatar.pro-mode-active {
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    border-color: #FFD700;
    transition: all 0.3s ease;
}

.sg-header-avatar.pro-thinking {
    animation: sg-pro-pulse 1.5s infinite;
}

.sg-header-avatar.pro-thinking img {
    border-color: #FFD700 !important;
}

.sg-header-avatar.pro-thinking .sg-status-dot {
    background: #FFD700 !important;
    box-shadow: 0 0 5px #FFD700;
}

@keyframes sg-pro-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7);
        transform: scale(1);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 215, 0, 0);
        transform: scale(1.05);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0);
        transform: scale(1);
    }
}

/* PRO THINKING IN LIVE OVERLAY */
.sg-live-avatar-wrap.sg-is-thinking-pro {
    border-color: #FFD700 !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.sg-live-avatar-wrap.sg-is-thinking-pro::after {
    border-top-color: #FFD700 !important;
}

/* Status Text Transition */
#sg-live-status-text {
    transition: opacity 0.2s ease-in-out;
}