/* ======================================
   IFRAME VERSION - RESPONSIVE SIDE-BY-SIDE LAYOUT
   Optimized for half-page deployment across ALL major resolutions
   VERSION: 2025-07-12-3 - COMPREHENSIVE MULTI-RESOLUTION SCALING
   Tested Resolutions:
   - 320x568 (iPhone SE)
   - 375x667 (iPhone 8)  
   - 414x896 (iPhone 11/12)
   - 768x1024 (iPad Portrait)
   - 1024x768 (iPad Landscape)
   - 1280x720 (720p Desktop Half)
   - 1366x768 (Laptop Half)
   - 1920x1080 (1080p Desktop Half)
   - 2560x1440 (1440p Desktop Half)
   ====================================== */
:root {
    --primary-bg: #412985;
    --primary-light: #b19cd9;
    --primary-medium: #9966cc;
    --primary-hover: #523a9f;
    --text-white: #ffffff;
    --border-color: #dee2e6;
    --transcript-bg: #f8f9fa;
    --success-green: #0ee668;
    --danger-red: #dc3545;
    --user-msg-bg: #fef9e7;
    --user-msg-color: #8b6914;
    --assistant-msg-bg: #f3f0ff;
    --assistant-msg-color: #412985;
    --input-bg: #ffffff;
}

/* PAGE header control - only show when explicitly enabled */
.transcript-header.page-header-visible {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
}

/* PAGE header hiding utility class */
.page-header-hidden {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}
/* ======================================
   BASE IFRAME STYLING
   ====================================== */
body.iframe-mode {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    overflow: hidden; /* Prevent body scroll */
    height: 100vh;
    width: 100vw;
    font-size: clamp(1rem, 2vw, 1.25rem); /* Base font size for readability */
}
.voice-interface-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    min-height: 300px;
    container-type: size; /* Enable container queries */
    background-color: var(--primary-bg);
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
/* ======================================
   HEADER - COMPACT FOR IFRAME
   ====================================== */
.iframe-header {
    flex-shrink: 0;
    background-color: var(--primary-bg);
    color: var(--text-white);
    padding: 0.05rem 0.5rem;
    min-height: 0.25rem;
}
.header-icon {
    width: clamp(14px, 2.5vw, 20px);
    height: clamp(14px, 2.5vw, 20px);
    margin-left: 0.25rem;
}
.header-title {
    font-size: clamp(56px, 5vw, 72px);
    font-weight: 600;
    color: var(--text-white);
}
/* ======================================
   MAIN CONTENT AREA - FLEX LAYOUT
   ====================================== */
.iframe-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1px;
    gap: 0;
    min-height: 0; /* Important for flex children */
    background-color: var(--primary-bg);
}
/* ======================================
   VISUALIZER - COMPACT
   ====================================== */
.visualizer-container-iframe {
    flex-shrink: 0;
    height: 0.5vh;
    min-height: 5px;
    max-height: 8px;
    margin-bottom: 0;
}
.iframe-visualizer {
    height: 100%;
    border-radius: 0.5rem;
    background-color: transparent;
    border: none;
    margin-bottom: 0;
    box-shadow: none;
    overflow: hidden;
    padding: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
}
.visualizer-bars {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    height: 100%;
    gap: 1px;
}
.visualizer-bar {
    background-color: #6c757d;
    width: 100%;
    height: 0%;
    border-radius: 1px 1px 0 0;
    transition: height 0.05s ease-out;
}
.iframe-visualizer.speaking .visualizer-bar {
    background-color: var(--primary-light);
}

/* ======================================
   ENHANCED MUTE BUTTON STYLING
   ====================================== */
.voice-control-button.btn-success {
    background-color: var(--success-green) !important;
    border-color: var(--success-green) !important;
    color: white !important;
}

.voice-control-button.btn-success:hover {
    background-color: #218838 !important;
    border-color: #1e7e34 !important;
}

.voice-control-button.btn-danger {
    background-color: var(--danger-red) !important;
    border-color: var(--danger-red) !important;
    color: white !important;
}

.voice-control-button.btn-danger:hover {
    background-color: #c82333 !important;
    border-color: #bd2130 !important;
}
.iframe-visualizer.high-volume .visualizer-bar {
    background-color: #dc3545;
}
.iframe-visualizer.medium-volume .visualizer-bar {
    background-color: var(--primary-medium);
}
.iframe-visualizer.low-volume .visualizer-bar {
    background-color: #0dcaf0;
}
/* ======================================
   TRANSCRIPT - MAIN CONTENT AREA
   ====================================== */
.transcript-section {
    flex: 1 1 auto !important;
    min-height: 200px !important;
    padding: 0 !important;
    margin-top: 0 !important;
    margin-left: 2px !important;
    margin-right: 2px !important;
    overflow: hidden !important;
    background-color: var(--transcript-bg) !important;
    border-radius: 8px 8px 0 0 !important;
    display: flex !important;
    flex-direction: column !important;
}
.transcript-header {
    color: white !important;
    font-size: clamp(1.2rem, 3vw, 1.4rem) !important;
    margin-bottom: 0.2rem !important;
    font-weight: 600 !important;
    flex-shrink: 0 !important;
    line-height: 0.9 !important;
    padding: 0.4rem 0.6rem !important;
    height: auto !important;
    margin-top: 0 !important;
    overflow: hidden !important;
    background: var(--primary-bg) !important;
    border-radius: 8px 8px 0 0 !important;
    margin-bottom: 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    letter-spacing: -0.02em !important;
    white-space: nowrap !important;
}

.smiley-icon {
    font-size: clamp(1.2rem, 3vw, 1.4rem) !important;
    margin-right: 0.2rem !important;
    flex-shrink: 0 !important;
}

.ai-text {
    font-weight: 400 !important;
    opacity: 0.9 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    min-width: 0 !important;
}
.transcript-container {
    height: 100% !important;
    overflow-y: auto !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    background: var(--transcript-bg) !important;
    border-radius: 0 0 8px 8px !important;
    padding: 12px !important;
    border: 1px solid var(--border-color) !important;
    border-top: 1px solid var(--border-color) !important;
    scroll-behavior: smooth !important;
    word-wrap: break-word !important;
    scrollbar-width: thin !important;
    scrollbar-color: #ccc transparent !important;
    display: flex !important;
    flex-direction: column !important;
    gap: clamp(0.25rem, 0.8vw, 0.25rem) !important;
    color: #212529 !important;
    margin-top: 0 !important;
}
/* ======================================
   RESPONSIVE BREAKPOINTS FOR ALL MAJOR RESOLUTIONS
   Optimized for half-page iframe deployment
   ====================================== */
@media screen and (max-width: 480px) {
    .iframe-content {
        padding: 0.05rem;
        gap: 0.05rem;
    }
    .iframe-header {
        padding: 0.04rem 0.4rem;
        min-height: 0.2rem;
    }
    .header-icon {
        width: 12px;
        height: 12px;
        margin-left: 0.2rem;
    }
    .transcript-iframe {
        font-size: 0.65rem;
        padding: 0.3rem;
        min-height: clamp(8rem, 45vh, 16rem);
    }
    .btn-sm {
        min-height: 1.8rem !important;
        height: 1.8rem !important;
        font-size: 0.75rem !important;
        padding: 0.3rem 0.5rem !important;
    }
    
    /* Very narrow iframe button text fixes */
    .start-conversation-btn-iframe {
        font-size: 0.75rem !important;
        letter-spacing: 1px !important;
        padding: 0.35rem 0.4rem !important;
        max-width: 95% !important;
    }
    .end-conversation-btn-iframe {
        font-size: 0.75rem !important;
        letter-spacing: 1px !important;
        padding: 0.35rem 12px !important;
    }
    .voice-control-button.textbot-btn-iframe {
        font-size: 1.1rem !important;
        letter-spacing: 1px !important;
        padding: 0.35rem 0.4rem !important;
    }
}

/* Additional narrow width rules for 400px iframe */
@media screen and (max-width: 450px) {
    .start-conversation-btn-iframe {
        font-size: 0.75rem !important;
        letter-spacing: 0.5px !important;
        padding: 0.35rem 0.05rem !important;
    }
    .end-conversation-btn-iframe {
        font-size: 0.75rem !important;
        letter-spacing: 0.5px !important;
        padding: 0.35rem 12px !important;
    }
    .voice-control-button.textbot-btn-iframe {
        font-size: 1rem !important;
        letter-spacing: 0.5px !important;
        padding: 0.35rem 0.05rem !important;
    }
    
    /* Fix button row padding for narrow screens */
    .controls-row-iframe {
        padding: 0 0.25rem !important;
        gap: 0.25rem !important;
    }
}

/* Ultra-narrow container rules */
@media screen and (max-width: 420px) {
    .start-conversation-btn-iframe {
        font-size: 0.75rem !important;
        letter-spacing: 0px !important;
        padding: 0.3rem 0.02rem !important;
        font-weight: 800 !important;
    }
    .end-conversation-btn-iframe {
        font-size: 0.75rem !important;
        letter-spacing: 0px !important;
        padding: 0.3rem 12px !important;
        font-weight: 800 !important;
    }
    .voice-control-button.textbot-btn-iframe {
        font-size: 0.9rem !important;
        letter-spacing: 0px !important;
        padding: 0.3rem 0.02rem !important;
        font-weight: 800 !important;
    }
    
    /* Ensure buttons fit in ultra-narrow screens */
    .controls-row-iframe {
        padding: 0 0.1rem !important;
        gap: 0.1rem !important;
    }
    
    .voice-controls-container {
        padding: 0.25rem !important;
        min-height: 2.5rem !important;
    }
    
    /* Make mic and speaker buttons smaller on ultra-narrow screens */
    .active-controls-iframe .mic-toggle-btn,
    .active-controls-iframe .speaker-toggle-btn {
        min-width: 1.5rem !important;
        min-height: 1.5rem !important;
        padding: 0.25rem !important;
        font-size: 0.75rem !important;
    }
}
@media screen and (min-width: 481px) and (max-width: 768px) {
    .iframe-content {
        padding: 0.3rem;
        gap: 0.3rem;
    }
    .header-icon {
        width: 16px;
        height: 16px;
    }
    .transcript-iframe {
        min-height: clamp(9rem, 42vh, 18rem);
    }
}
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .iframe-content {
        padding: 0.4rem;
        gap: 0.4rem;
    }
    .transcript-iframe {
        min-height: clamp(10rem, 40vh, 20rem);
    }
}
@media screen and (min-width: 1025px) and (max-width: 1440px) {
    .iframe-content {
        padding: 0.5rem;
        gap: 0.375rem;
    }
    .transcript-iframe {
        min-height: clamp(11rem, 41vh, 22rem);
    }
}
@media screen and (min-width: 1441px) {
    .iframe-content {
        padding: 0.6rem;
        gap: 0.5rem;
    }
    .transcript-iframe {
        min-height: clamp(12rem, 42vh, 24rem);
        font-size: 0.85rem;
    }
    .header-icon {
        width: 20px;
        height: 20px;
    }
}
@media screen and (max-height: 400px) {
    .visualizer-container-iframe {
        height: 1vh;
        min-height: 15px;
        max-height: 20px;
    }
    .transcript-iframe {
        min-height: clamp(6rem, 35vh, 12rem);
    }
    .iframe-header {
        padding: 0.025rem 0.4rem;
        min-height: 0.175rem;
    }
}
/* ======================================
   MESSAGES STYLING
   ====================================== */
.message {
    padding: clamp(0.25rem, 1vw, 0.375rem) clamp(0.5rem, 1.5vw, 0.625rem);
    margin-bottom: clamp(0.25rem, 0.8vw, 0.25rem);
    border-radius: clamp(0.25rem, 1vw, 0.375rem);
    max-width: 90%;
    word-wrap: break-word;
    position: relative;
    display: block;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    opacity: 1;
    transition: opacity 0.2s;
    font-size: 16px !important;
    line-height: 1.4;
}
.user-message {
    background-color: var(--user-msg-bg);
    color: var(--user-msg-color);
    margin-left: auto;
    margin-right: 8px;
    border: 1px solid #bbdefb;
    align-self: flex-end;
    font-weight: 500;
}
.assistant-message {
    background-color: var(--assistant-msg-bg);
    color: var(--assistant-msg-color);
    margin-right: auto;
    margin-left: 8px;
    border: 1px solid #e1bee7;
    align-self: flex-start;
    font-weight: 400;
}
/* ======================================
   INPUT CONTROLS - COMPACT
   ====================================== */
.input-container-iframe {
    flex-shrink: 0;
    margin-bottom: 4px;
}
.input-group-sm .form-control-sm, #text-input {
    padding: clamp(0.25rem, 1vw, 0.5rem) clamp(0.375rem, 1.2vw, 0.5rem);
    font-size: 16px;
    border-radius: clamp(0.25rem, 1vw, 0.25rem);
    background-color: #ffffff !important;
    color: #000000 !important;
    border: 1px solid #dee2e6 !important;
}

/* Hide text input by default until conversation starts */
.input-group {
    display: none;
}

.input-group.conversation-active {
    display: flex;
}

/* For iframe - target the input container div */
.input-container-iframe {
    display: none;
}

.input-container-iframe.conversation-active {
    display: block;
}

/* Button icons styling for iframe */
#toggle-textbot-btn i,
#toggle-connection-btn i {
    color: #ffffff !important;
    font-weight: 600;
}

/* Ensure icons are visible in voice control buttons */
.voice-control-button i {
    color: #ffffff !important;
}

.input-group.conversation-active {
    display: flex;
}

/* Placeholder text styling for iframe - better visibility */
#text-input::placeholder {
    color: #6c757d !important;
    opacity: 0.7 !important;
    font-style: italic;
}

#text-input:focus::placeholder {
    color: #adb5bd !important;
    opacity: 0.6 !important;
}
.input-group-sm .btn-sm {
    padding: clamp(0.25rem, 1vw, 0.5rem) clamp(0.375rem, 1.2vw, 0.5rem);
    font-size: clamp(0.7rem, 1.8vw, 0.75rem);
    border-radius: clamp(0.25rem, 1vw, 0.25rem);
}
/* ======================================
   BUTTON CONTROLS - COMPACT LAYOUT
   ====================================== */
.voice-controls-container {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: min(12px, 2vw) !important;
    padding: min(12px, 2vh) min(16px, 3vw) !important;
    flex: 0 0 auto !important;
    min-height: 50px !important;
}
.voice-control-button {
    flex: 1 1 0 !important;
    max-width: 150px !important;
    min-width: 80px !important;
    padding: min(8px, 1vh) min(12px, 2vw) !important;
    font-size: clamp(12px, 2.5vw, 16px) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    background-color: var(--primary-bg) !important;
    border-color: var(--primary-bg) !important;
    color: var(--text-white) !important;
    border: 2px solid !important;
    border-radius: clamp(0.25rem, 1vw, 0.375rem) !important;
    font-weight: 500 !important;
}
.btn-sm {
    padding: clamp(0.4rem, 1.5vw, 0.8rem) clamp(0.6rem, 2vw, 1rem) !important;
    font-size: clamp(0.75rem, 2vw, 0.875rem) !important;
    border-radius: clamp(0.25rem, 1vw, 0.375rem) !important;
    min-height: clamp(2rem, 5vw, 2.75rem) !important;
    font-weight: 500 !important;
    border: 2px solid !important;
    height: clamp(2rem, 5vw, 2.75rem) !important;
}
.btn-primary {
    background-color: var(--primary-bg) !important;
    border-color: var(--primary-bg) !important;
    color: var(--text-white) !important;
    border-width: 2px !important;
    border-style: solid !important;
}
.btn-primary:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}
.btn-primary:focus {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    box-shadow: 0 0 0 0.2rem rgba(65, 41, 133, 0.25) !important;
}
.btn-outline-light {
    border-color: rgba(255, 255, 255, 0.5);
    color: var(--text-white);
}
.btn-outline-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-white);
    color: var(--text-white);
}
.btn-sm i {
    font-size: clamp(0.875rem, 2vw, 1rem) !important;
}
.btn-sm .fas {
    font-size: clamp(0.875rem, 2vw, 1rem) !important;
}
#toggle-connection-btn, #mute-btn, #speaker-mute-btn {
    padding: clamp(0.5rem, 2vw, 0.8rem) clamp(0.75rem, 2.5vw, 1.2rem) !important;
    font-size: clamp(0.875rem, 2.2vw, 1rem) !important;
    min-height: clamp(2.5rem, 6vw, 3rem) !important;
    height: clamp(2.5rem, 6vw, 3rem) !important;
    border: 2px solid !important;
    border-radius: clamp(0.375rem, 1.2vw, 0.5rem) !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
}
#toggle-connection-btn i, #mute-btn i, #speaker-mute-btn i {
    font-size: clamp(1rem, 2.5vw, 1.2rem) !important;
    color: #ffffff !important;
}
.btn:disabled {
    background-color: var(--primary-bg) !important;
    border-color: var(--primary-bg) !important;
    color: var(--text-white) !important;
    opacity: 0.7 !important;
}
.btn-danger {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: var(--text-white) !important;
}
/* ======================================
   MODAL ADJUSTMENTS FOR IFRAME
   ====================================== */
.modal-sm {
    max-width: 350px;
}
.modal-content {
    font-size: 13px;
}
.modal-header h6 {
    font-size: 14px;
}
.form-select-sm, .form-control-sm {
    font-size: 12px;
    padding: 4px 8px;
}

/* ======================================
   NEW PROGRESSIVE BUTTON LAYOUT - IFRAME VERSION
   ====================================== */
.voice-controls-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(0.5rem, 2vh, 0.75rem) clamp(0.25rem, 1vw, 0.5rem) !important;
    flex: 0 0 auto !important;
    min-height: clamp(3rem, 8vh, 4rem) !important;
    gap: 0.5rem;
}

.initial-controls-iframe {
    width: 100%;
    text-align: center;
    margin: 0 !important;
    padding: 0 !important;
}

.initial-buttons-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(0.5rem, 2vw, 0.75rem);
    flex-wrap: wrap;
}

.start-conversation-btn-iframe {
    background-color: rgba(253, 185, 19, 1) !important;
    border-color: rgba(253, 185, 19, 1) !important;
    color: #000000 !important;
    font-weight: 700 !important;
    font-family: 'Arial Narrow', 'Impact', 'Helvetica Neue Condensed', 'Arial', sans-serif !important;
    font-size: 0.45rem !important;
    padding: 0.4rem 0.1rem !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 2px 6px rgba(253, 185, 19, 0.3) !important;
    transition: all 0.3s ease !important;
    width: auto !important;
    min-width: 4rem !important; /* Reduced minimum width */
    max-width: 5rem !important;
    margin: 0 auto !important;
    min-height: 2.5rem !important;
    height: 2.5rem !important;
    white-space: nowrap !important;
    font-stretch: ultra-condensed !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid rgba(253, 185, 19, 1) !important;
    box-sizing: border-box !important;
}

.start-conversation-btn-iframe:hover {
    background-color: rgba(223, 163, 17, 1) !important;
    border-color: rgba(223, 163, 17, 1) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(253, 185, 19, 0.4);
}

/* TEXTBOT button - same style as start button with matching golden color */
.voice-control-button.textbot-btn-iframe {
    background-color: rgba(253, 185, 19, 1) !important;
    border-color: rgba(253, 185, 19, 1) !important;
    color: #000000 !important;
    font-weight: 700 !important;
    font-family: 'Arial Narrow', 'Impact', 'Helvetica Neue Condensed', 'Arial', sans-serif !important;
    font-size: 1rem !important;
    padding: 0.4rem 0.1rem !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 2px 6px rgba(65, 41, 133, 0.3) !important;
    transition: all 0.3s ease !important;
    width: auto !important;
    min-width: 4rem !important;
    max-width: 5rem !important;
    margin: 0 auto !important;
    min-height: 2.5rem !important;
    height: 2.5rem !important;
    white-space: nowrap !important;
    font-stretch: ultra-condensed !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid rgba(253, 185, 19, 1) !important;
    box-sizing: border-box !important;
}

.voice-control-button.textbot-btn-iframe:hover {
    background-color: rgba(223, 163, 17, 1) !important;
    border-color: rgba(223, 163, 17, 1) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(253, 185, 19, 0.4);
}

.active-controls-iframe {
    width: 100%;
}

.controls-row-iframe {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: clamp(0.5rem, 2vw, 1rem);
    padding: 0 clamp(0.5rem, 10vw, 20rem);
}

.left-controls-iframe {
    display: flex;
    gap: clamp(0.25rem, 1vw, 0.5rem);
}

.right-controls-iframe {
    display: flex;
}

.end-conversation-btn-iframe {
    background-color: #673BB8 !important;
    border-color: #673BB8 !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-family: 'Arial Narrow', 'Impact', 'Helvetica Neue Condensed', 'Arial', sans-serif !important;
    font-size: clamp(12px, 2.5vw, 16px) !important;
    padding: 0.4rem 12px !important;
    outline: none !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border-radius: 0.375rem !important;
    box-shadow: 0 2px 6px rgba(65, 41, 133, 0.3) !important;
    transition: all 0.3s ease !important;
    width: auto !important;
    min-width: 5.5rem !important; /* Force same minimum width as start button */
    max-width: none !important;
    margin: 0 auto !important;
    min-height: 2.5rem !important;
    height: 2.5rem !important;
    white-space: nowrap !important;
    font-stretch: ultra-condensed !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid #673BB8 !important;
    box-sizing: border-box !important;
}

.end-conversation-btn-iframe:hover {
    background-color: #7D4CC8 !important;
    border: 2px solid #ffffff !important;
    outline: none !important;
}

/* Mic and Speaker buttons in active state - iframe version */
.active-controls-iframe .mic-toggle-btn,
.active-controls-iframe .speaker-toggle-btn {
    background-color: #412985 !important;
    border-color: #412985 !important;
    color: #ffffff !important;
    font-size: clamp(0.875rem, 2vw, 1rem) !important;
    padding: clamp(0.4rem, 1.5vw, 0.5rem) clamp(0.6rem, 2vw, 0.8rem) !important;
    border-radius: clamp(0.25rem, 1vw, 0.375rem) !important;
    transition: all 0.3s ease;
    min-height: clamp(2rem, 5vw, 2.5rem) !important;
    height: clamp(2rem, 5vw, 2.5rem) !important;
    min-width: clamp(2rem, 5vw, 2.5rem) !important;
    border-width: 2px !important;
}

.active-controls-iframe .mic-toggle-btn:hover,
.active-controls-iframe .speaker-toggle-btn:hover {
    background-color: #523a9f !important;
    border-color: #523a9f !important;
}

.active-controls-iframe .mic-toggle-btn i,
.active-controls-iframe .speaker-toggle-btn i {
    font-size: clamp(0.875rem, 2vw, 1rem) !important;
    color: #ffffff !important;
}

/* ======================================
   BUTTON ANIMATIONS - IFRAME VERSION
   ====================================== */

/* Pulsating green glow animation for iframe button borders */
@keyframes pulsingGreenGlow {
    0% {
        box-shadow: inset 0 0 5px rgba(40, 167, 69, 0.6),
                    inset 0 0 2px rgba(40, 167, 69, 0.8);
    }
    50% {
        box-shadow: inset 0 0 10px rgba(40, 167, 69, 1),
                    inset 0 0 4px rgba(40, 167, 69, 0.8);
    }
    100% {
        box-shadow: inset 0 0 5px rgba(40, 167, 69, 0.6),
                    inset 0 0 2px rgba(40, 167, 69, 0.8);
    }
}

/* Dramatic pulsating glow and size animation for iframe icons */
@keyframes iconGlow {
    0% { 
        text-shadow: 0 0 3px rgba(255, 255, 255, 0.3),
                     0 0 6px rgba(144, 238, 144, 0.4),
                     0 0 12px rgba(144, 238, 144, 0.2);
        transform: scale(1);
    }
    50% { 
        text-shadow: 0 0 8px rgba(255, 255, 255, 0.9),
                     0 0 16px rgba(0, 100, 0, 0.8),
                     0 0 24px rgba(0, 100, 0, 0.6),
                     0 0 32px rgba(0, 100, 0, 0.4);
        transform: scale(1.15);
    }
    100% { 
        text-shadow: 0 0 3px rgba(255, 255, 255, 0.3),
                     0 0 6px rgba(144, 238, 144, 0.4),
                     0 0 12px rgba(144, 238, 144, 0.2);
        transform: scale(1);
    }
}

/* Apply button glow to active iframe microphone and speaker buttons */
.active-controls-iframe .mic-toggle-btn.btn-success,
.active-controls-iframe .speaker-toggle-btn.btn-success {
    animation: pulsingGreenGlow 1s ease-in-out infinite;
}

/* Apply icon glow to icons inside active iframe buttons */
.active-controls-iframe .mic-toggle-btn.btn-success i,
.active-controls-iframe .speaker-toggle-btn.btn-success i {
    animation: iconGlow 2s ease-in-out infinite;
}

/* Ensure iframe buttons get the same green color override as main app */
.active-controls-iframe .mic-toggle-btn.btn-success:not(.btn-danger),
.active-controls-iframe .speaker-toggle-btn.btn-success:not(.btn-danger) {
    background-color: #0ee668 !important;
    border-color: #0ee668 !important;
    color: white !important;
}
/* ======================================
   RESPONSIVE BREAKPOINTS
   ====================================== */
@container (max-width: 300px) {
    .voice-controls-container {
        gap: 4px !important;
        padding: 8px !important;
    }
    .voice-control-button {
        min-width: 60px !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
    }
    .voice-control-button.textbot-btn-iframe {
        font-size: 18px !important;
    }
}
@container (max-height: 200px) {
    .voice-controls-container {
        min-height: 40px !important;
        padding: 4px 8px !important;
    }
    .voice-control-button {
        padding: 4px 6px !important;
    }
}
@media screen and (max-width: 300px) {
    .voice-controls-container {
        gap: 4px !important;
        padding: 8px !important;
    }
    .voice-control-button {
        min-width: 60px !important;
        padding: 6px 8px !important;
        font-size: 11px !important;
    }
    .voice-control-button.textbot-btn-iframe {
        font-size: 18px !important;
    }
}
        font-size: 12px;
        min-height: 32px;
    }
}
@media screen and (min-height: 600px) and (max-height: 999px) {
    .transcript-iframe {
        height: calc(100vh - 160px);
    }
}
@media screen and (max-height: 599px) {
    .iframe-header {
        padding: 1px 8px;
        min-height: 8px;
    }
    .iframe-content {
        padding: 1px;
        gap: 0.5px;
    }
    .transcript-iframe {
        height: calc(100vh - 120px);
        min-height: 150px;
        font-size: 11px;
    }
    .message {
        padding: 4px 8px;
        font-size: 11px;
        margin-bottom: 2px;
    }
    .btn-sm {
        padding: 3px 8px;
        font-size: 10px;
        min-height: 24px;
    }
    .transcript-header {
        font-size: 11px;
    }
}
/* ======================================
   SPECIFIC FIXES FOR 600x400px IFRAME SIZE
   ====================================== */
@media screen and (max-width: 650px) and (max-height: 450px) {
    .transcript-header {
        font-size: 0.75rem !important;
        padding: 0.3rem 0.5rem !important;
        gap: 0.2rem !important;
        letter-spacing: -0.04em !important;
    }
    
    .smiley-icon {
        font-size: 0.9rem !important;
        margin-right: 0.15rem !important;
    }
    
    .ai-text {
        font-size: 0.75rem !important;
    }
}

@media screen and (max-width: 620px) {
    .transcript-header {
        font-size: 0.8rem !important;
        letter-spacing: -0.03em !important;
    }
}

/* ======================================
   WIDTH-BASED RESPONSIVENESS 
   For when iframe is narrow (side-by-side layout)
   ====================================== */
@media screen and (max-width: 400px) {
    .iframe-content {
        padding: 1px;
    }
    .message {
        max-width: 95%;
        font-size: 11px;
    }
    .header-title {
        font-size: 12px;
    }
}
@media screen and (min-width: 401px) and (max-width: 600px) {
    .message {
        max-width: 90%;
        font-size: 12px;
    }
}
@media screen and (min-width: 601px) {
    .message {
        max-width: 85%;
        font-size: 13px;
    }
    .transcript-header {
        font-size: 13px;
    }
}
/* ======================================
   SCROLLBAR STYLING FOR TRANSCRIPT
   ====================================== */
.transcript-iframe::-webkit-scrollbar {
    width: 6px;
}
.transcript-iframe::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.transcript-iframe::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 3px;
}
.transcript-iframe::-webkit-scrollbar-thumb:hover {
    background: var(--primary-medium);
}
/* ======================================
   UTILITY CLASSES
   ====================================== */
.gap-2 {
    gap: 8px;
}
.text-center {
    text-align: center;
}
.voice-control-button:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
}
.voice-control-button:focus {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    box-shadow: 0 0 0 0.2rem rgba(65, 41, 133, 0.25) !important;
}
.voice-control-button:disabled {
    background-color: var(--primary-bg) !important;
    border-color: var(--primary-bg) !important;
    color: var(--text-white) !important;
    opacity: 0.7 !important;
}
.text-muted {
    color: #6c757d !important;
}
.mb-0 {
    margin-bottom: 0 !important;
}
.mb-2 {
    margin-bottom: 8px !important;
}
.py-3 {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}
.fs-5 {
    font-size: 1.1rem !important;
}
/* ======================================
   LOADING AND CONNECTION STATES
   ====================================== */
.connecting-state {
    opacity: 0.7;
    pointer-events: none;
}
.connection-message {
    background-color: rgba(65, 41, 133, 0.9);
    color: var(--text-white);
    padding: 8px;
    border-radius: 4px;
    text-align: center;
    font-size: 12px;
    margin: 4px 0;
}
/* ======================================
   PROGRESSIVE BUTTON LAYOUT STYLES
   ====================================== */
#initial-controls-iframe, #active-controls-iframe {
    transition: opacity 0.3s ease-in-out;
}

#initial-controls-iframe.d-none, #active-controls-iframe.d-none {
    display: none !important;
}

/* Start Conversation Button Styling */
#toggle-connection-btn.btn-lg {
    font-size: 1.1rem;
    padding: 12px 24px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #ffc107 !important;
    border-color: #ffc107 !important;
    color: #412985 !important;
}

#toggle-connection-btn.btn-lg:hover {
    background-color: #e0a800 !important;
    border-color: #e0a800 !important;
    color: #412985 !important;
}

/* Active Controls Layout */
#active-controls-iframe .d-flex {
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

/* End Conversation Button Styling */
#end-conversation-btn {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: var(--text-white);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

#end-conversation-btn:hover {
    background-color: var(--danger-hover);
    border-color: var(--danger-hover);
    transform: translateY(-1px);
}

/* Mic and Speaker Button Consistent Sizing */
#mute-btn, #speaker-mute-btn {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* ======================================
   HIGH DPI / RETINA DISPLAY OPTIMIZATIONS
   ====================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .header-icon {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
    .visualizer-bar {
        image-rendering: pixelated;
    }
}
/* ======================================
   PRINT STYLES (HIDE FOR IFRAME)
   ====================================== */
@media print {
    .iframe-container {
        display: none;
    }
}