/**
 * My247Coach — Intake Chat Styles (Nora & Sam)
 *
 * @since 6.23.0
 * @updated 6.23.3 — Responsive height, text close button
 */

/* === Stand-alone intake page: hide WP theme chrome === */
body.my247coach-intake-page .site-header,
body.my247coach-intake-page .site-footer,
body.my247coach-intake-page .main-navigation,
body.my247coach-intake-page .my247coach-mobile-nav {
    display: none !important;
}

body.my247coach-intake-page .site-content {
    max-width: 100% !important;
    width: 100% !important;
    float: none !important;
    padding-top: 20px;
    padding-left: 0;
    padding-right: 0;
    margin: 0 auto !important;
}

body.my247coach-intake-page .site-inner {
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    float: none !important;
    padding: 0;
}

/* Hide sidebar on intake page */
body.my247coach-intake-page .sidebar,
body.my247coach-intake-page #secondary,
body.my247coach-intake-page .widget-area {
    display: none !important;
}

body.my247coach-intake-page .content-area,
body.my247coach-intake-page #primary,
body.my247coach-intake-page #main {
    float: none !important;
    width: 100% !important;
    max-width: 700px;
    margin: 0 auto !important;
    padding-left: 16px;
    padding-right: 16px;
    box-sizing: border-box;
}

/* Twenty Sixteen specific: override .site-content .entry-content etc. */
body.my247coach-intake-page .entry-content,
body.my247coach-intake-page .entry-header,
body.my247coach-intake-page .post-thumbnail,
body.my247coach-intake-page article.page {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

body.my247coach-intake-page .site {
    overflow-x: hidden;
}

/* Container */
.my247coach-intake {
    max-width: 700px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #333;
}

/* === Language Switcher === */
.my247coach-intake-lang-switcher {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
    padding: 8px 0;
}

.my247coach-intake-lang-btn {
    background: none;
    border: none;
    font-size: 14px;
    font-weight: 400;
    color: #888;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.my247coach-intake-lang-btn:hover {
    color: #5b6abf;
}

.my247coach-intake-lang-btn.active {
    font-weight: 700;
    color: #5b6abf;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.my247coach-intake-lang-sep {
    color: #ccc;
    font-size: 14px;
    user-select: none;
}

/* === Intro Cascade (admin-configurable: headline, subline, body) === */
.my247coach-intake-intro {
    text-align: center;
    padding: 8px 20px 16px;
    max-width: 600px;
    margin: 0 auto;
}

.my247coach-intake-headline {
    font-size: 26px !important;
    font-weight: 700;
    color: #5b6abf !important;
    margin: 0 0 6px;
    line-height: 1.3;
}

.my247coach-intake-subline {
    font-size: 17px;
    font-weight: 500;
    color: #444;
    margin: 0 0 8px;
    line-height: 1.4;
}

.my247coach-intake-body {
    font-size: 15px;
    font-weight: 400;
    color: #666;
    margin: 0;
    line-height: 1.5;
}

/* === Chooser === */
.my247coach-intake-chooser {
    text-align: center;
    padding: 24px 20px;
}

.my247coach-intake-title {
    font-size: 26px !important;
    font-weight: 700;
    margin-bottom: 8px;
    color: #5b6abf !important;
}

.my247coach-intake-subtitle {
    font-size: 15px;
    color: #666;
    margin-bottom: 28px;
}

.my247coach-intake-cards {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.my247coach-intake-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 32px 40px;
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    background: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 180px;
    font-family: inherit;
    font-size: inherit;
}

.my247coach-intake-card:hover {
    border-color: #5b6abf;
    box-shadow: 0 4px 16px rgba(91, 106, 191, 0.15);
    transform: translateY(-2px);
}

.my247coach-intake-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
}

.my247coach-intake-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.my247coach-intake-avatar-nora {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.my247coach-intake-avatar-sam {
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
}

.my247coach-intake-card-name {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
}

.my247coach-intake-card-desc {
    font-size: 14px;
    color: #888;
}

/* === Chat Interface === */
.my247coach-intake-chat {
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    height: 70vh;
    min-height: 500px;
    max-height: 800px;
}

.my247coach-intake-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #5b6abf, #7c8cf0);
    color: #fff;
}

.my247coach-intake-chat-name {
    font-size: 18px;
    font-weight: 600;
}

.my247coach-intake-chat-badge {
    font-size: 11px;
    background: rgba(255,255,255,0.2);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Close button in header */
.my247coach-intake-close-btn {
    margin-left: auto;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.3);
    color: rgba(255,255,255,0.85);
    font-size: 12px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1.4;
}

.my247coach-intake-close-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.5);
}

/* Messages area */
.my247coach-intake-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message bubbles */
.my247coach-intake-msg {
    max-width: 85%;
    animation: my247coach-fadeIn 0.3s ease;
}

.my247coach-intake-msg-assistant {
    align-self: flex-start;
}

.my247coach-intake-msg-user {
    align-self: flex-end;
}

.my247coach-intake-msg-system {
    align-self: center;
    text-align: center;
}

.my247coach-intake-msg-name {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #5b6abf;
    margin-bottom: 4px;
    padding-left: 4px;
}

.my247coach-intake-msg-content {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.my247coach-intake-msg-assistant .my247coach-intake-msg-content {
    background: #f0f2f8;
    color: #333;
    border-bottom-left-radius: 4px;
}

.my247coach-intake-msg-user .my247coach-intake-msg-content {
    background: #5b6abf;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.my247coach-intake-msg-system .my247coach-intake-msg-content {
    background: #fff3cd;
    color: #856404;
    font-size: 13px;
    border-radius: 8px;
}

/* Close confirmation buttons */
.my247coach-intake-close-confirm p {
    margin: 0 0 10px;
}

.my247coach-intake-close-btns {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.my247coach-intake-close-yes,
.my247coach-intake-close-no {
    padding: 6px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s;
}

.my247coach-intake-close-yes {
    background: #dc3545;
    color: #fff;
}

.my247coach-intake-close-yes:hover {
    background: #c82333;
}

.my247coach-intake-close-no {
    background: #e0e0e0;
    color: #333;
}

.my247coach-intake-close-no:hover {
    background: #ccc;
}

/* === Fase Banners === */
.my247coach-intake-fase-banner {
    padding: 10px 16px;
    border-radius: 8px;
    margin: 0;
    font-size: 14px;
    text-align: center;
    line-height: 1.4;
    flex-shrink: 0;
}

.my247coach-intake-fase-afsluiting {
    background: #e8f0fe;
    color: #1a73e8;
    border-bottom: 1px solid #c5d9f7;
}

.my247coach-intake-fase-laatste {
    background: #fff3e0;
    color: #e65100;
    border-bottom: 1px solid #ffe0b2;
}

.my247coach-intake-fase-fadein {
    animation: my247coach-fadeIn 0.5s ease;
}

/* === Intro Cascade Hide (smooth transition) === */
.my247coach-intake-intro {
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, margin 0.3s ease;
    max-height: 500px;
    overflow: hidden;
}

.my247coach-intake-intro-hidden {
    max-height: 0 !important;
    opacity: 0;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin: 0 !important;
    pointer-events: none;
}

/* === Progress Bar === */
.my247coach-progress-bar {
    height: 6px;
    background-color: #e0e0e0;
    border-radius: 3px;
    margin: 0 12px 8px 12px;
    overflow: hidden;
    position: relative;
    border-left: 1px solid #bdbdbd;
    border-right: 1px solid #bdbdbd;
    flex-shrink: 0;
}
.my247coach-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
    background: linear-gradient(to right,
        #4caf50 0%, #4caf50 50%,
        #ff9800 50%, #ff9800 80%,
        #f44336 80%, #f44336 100%
    );
    background-position: left;
}

/* === Demo Audio Button (in header) === */
.my247coach-intake-demo-btn-header {
    background-color: #f44336;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 12px;
    margin-left: auto;
    transition: background-color 0.3s ease, transform 0.2s ease;
    line-height: 1;
    color: white;
}

.my247coach-intake-demo-btn-header:hover {
    transform: scale(1.1);
}

.my247coach-intake-demo-btn-header.demo-played {
    background-color: #4caf50;
    cursor: default;
}

/* Typing indicator */
.my247coach-intake-typing {
    align-self: flex-start;
    padding: 12px 16px;
    background: #f0f2f8;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.my247coach-intake-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    margin: 0 2px;
    animation: my247coach-bounce 1.4s infinite ease-in-out;
}

.my247coach-intake-dots span:nth-child(1) { animation-delay: 0s; }
.my247coach-intake-dots span:nth-child(2) { animation-delay: 0.2s; }
.my247coach-intake-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes my247coach-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

@keyframes my247coach-fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Microphone button */
.my247coach-intake-mic {
    background: none;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.my247coach-intake-mic:hover {
    background: #f1f5f9;
}
.my247coach-intake-mic.recording {
    background: #fee2e2;
    border-color: #ef4444;
    animation: mic-pulse 1s infinite;
}
@keyframes mic-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Voice toggle */
.my247coach-intake-voice-toggle {
    text-align: center;
    padding: 6px 0;
    font-size: 13px;
    color: #64748b;
}
.my247coach-intake-voice-toggle label {
    cursor: pointer;
    user-select: none;
}
.my247coach-intake-voice-toggle input[type="checkbox"] {
    margin-right: 4px;
    vertical-align: middle;
}

/* TTS speaking indicator on assistant messages */
.my247coach-intake-msg-assistant.speaking {
    border-left: 3px solid #6366f1;
}

/* Input area */
.my247coach-intake-input-area {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
}

.my247coach-intake-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    transition: border-color 0.2s;
    line-height: 1.4;
}

.my247coach-intake-input:focus {
    border-color: #5b6abf;
}

.my247coach-intake-send {
    padding: 10px 20px;
    background: #5b6abf;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.my247coach-intake-send:hover:not(:disabled) {
    background: #4a5a9e;
}

.my247coach-intake-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Disclaimer */
.my247coach-intake-disclaimer {
    padding: 8px 16px 12px;
    font-size: 12px;
    color: #999;
    text-align: center;
    line-height: 1.4;
}

/* === Responsive === */
@media (max-width: 480px) {
    .my247coach-intake-chat {
        height: 85vh;
        min-height: 400px;
        max-height: 600px;
        border-radius: 12px;
    }

    .my247coach-intake-title {
        font-size: 22px !important;
    }

    .my247coach-intake-headline {
        font-size: 22px !important;
    }

    .my247coach-intake-subline {
        font-size: 15px;
    }

    .my247coach-intake-cards {
        flex-direction: column;
        align-items: center;
    }

    .my247coach-intake-card {
        width: 100%;
        max-width: 280px;
        padding: 24px 32px;
    }

    .my247coach-intake-msg {
        max-width: 90%;
    }

    .my247coach-intake-send {
        padding: 10px 14px;
    }
}

/* Counter banner — shows message count with color transitions */
.my247coach-intake-counter-banner {
    text-align: center;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
    margin: 4px auto 8px auto;
    width: fit-content;
    min-width: 36px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.my247coach-counter-grey {
    background-color: #f0f0f0;
    color: #888;
}

.my247coach-counter-blue {
    background-color: #e8f0fe;
    color: #1a73e8;
}

.my247coach-counter-orange {
    background-color: #fff3e0;
    color: #e65100;
}
