/**
 * Embedded Mode Styles
 * Applied when ?hideHeader=true parameter is present
 */

/* Hide header/navbar in embedded mode */
.embedded-mode .navbar,
.embedded-mode .app-header,
.embedded-mode nav {
    display: none !important;
}

/* Adjust main content area to use full height */
.embedded-mode body {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.embedded-mode .app-container {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.embedded-mode .app-main,
.embedded-mode main {
    margin-top: 0 !important;
    padding-top: 1rem !important;
}

/* Ensure full height usage in iframe */
html.embedded-mode,
body.embedded-mode {
    height: 100%;
    overflow: auto;
}

/* Adjust container to fill available space */
.embedded-mode .estimator-container,
.embedded-mode .chat-container {
    max-height: none;
    height: 100%;
}

/* ========================================
   SCROLL FIX - Prevent page jumps
   ======================================== */

/* Prevent embed from causing page scrolls when content loads */
[id*="smartfence-chat"],
[id*="smartfence-embed"],
#smartfence-embed-root {
    overflow-anchor: none !important;
}

/* Prevent scrollIntoView from scrolling the page */
#smartfence-embed-root,
#smartfence-embed-root * {
    scroll-margin: 0 !important;
    scroll-margin-top: 0 !important;
    scroll-margin-bottom: 0 !important;
}

/* Create positioning context */
[id*="smartfence-chat"],
[id*="smartfence-embed"] {
    position: relative !important;
}

/* ========================================
   PREVENT BROWSER AUTO-SCROLL
   ======================================== */

/* Critical: Prevent ALL auto-scrolling */
html {
    scroll-behavior: auto !important;
}

/* Prevent focus from causing scroll */
* {
    scroll-margin: 0 !important;
    scroll-padding: 0 !important;
}

/* Prevent inputs/textareas from scrolling page on focus */
input:focus,
textarea:focus,
button:focus,
select:focus {
    scroll-margin-block: 0 !important;
    scroll-margin-inline: 0 !important;
}

/* Lock scroll position during embed interactions */
body:has([id*="smartfence"]) {
    overflow-anchor: none !important;
}

/* ========================================
   FIX CHAT SCROLLING
   ======================================== */

/* Ensure chat container is scrollable */
.chat-messages {
    overflow-y: auto !important;
    max-height: 600px !important;
    position: relative !important;
}

/* For embedded chat, make it fill available space */
.sf-embed-mode .chat-messages {
    max-height: calc(100vh - 200px) !important;
    min-height: 400px !important;
}