/* Main container */
.mcai-wrapper {
    display: flex;
    gap: 20px;
    margin: 30px auto;
    max-width: 1200px;
    justify-content: space-between;
    align-items: flex-start;
}

/* Video component - 60% width */
.mcai-video {
    flex: 0 0 58%; /* Slightly less than 60% to account for gap */
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Create the 16:9 aspect ratio container */
.mcai-video::before {
    content: "";
    display: block;
    padding-top: 56.25%; /* 16:9 aspect ratio */
}

.mcai-video iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.mcai-chat-container {
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    flex: 1 1 auto;
    max-height: 750px; /* Default max height */
    min-height: 400px; /* Minimum height to ensure usability */
}

.mcai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
    min-height: 200px; /* Minimum height for messages area */
}

/* Message styling */
.mcai-message {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    position: relative;
    clear: both;
    font-size: 14px;
    line-height: 1.4;
}

/* Heading styles in chat messages */
.mcai-message h1 {
    font-size: 1.2em;
    margin: 0.5em 0;
    font-weight: 600;
    color: #333;
}

.mcai-message h2 {
    font-size: 1.1em;
    margin: 0.5em 0;
    font-weight: 600;
    color: #333;
}

.mcai-message h3 {
    font-size: 1.05em;
    margin: 0.5em 0;
    font-weight: 600;
    color: #333;
}

.mcai-message h4 {
    font-size: 1em;
    margin: 0.5em 0;
    font-weight: 600;
    color: #333;
}

.mcai-message p {
    margin: 0 0 8px 0;
}

.mcai-message p:last-child {
    margin-bottom: 0;
}

/* List styling in chat messages */
.mcai-message ul, 
.mcai-message ol {
    margin: 0.5em 0;
    padding-left: 1.5em;
}

.mcai-message li {
    margin-bottom: 0.3em;
}

.mcai-message li:last-child {
    margin-bottom: 0;
}

/* User messages */
.mcai-user-message {
    background-color: #ac53ff;
    color: #fff;
    float: right;
    text-align: left;
    border-bottom-right-radius: 4px;
    margin-left: 20%;
}

/* Bot messages */
.mcai-bot-message {
    background-color: #e9e9eb;
    color: #333;
    float: left;
    border-bottom-left-radius: 4px;
    margin-right: 20%;
}

/* Bot message container with copy button */
.mcai-bot-message-container {
    clear: both;
    position: relative;
    margin-bottom: 15px;
    min-height: 40px;
}

/* Error messages */
.mcai-error-message {
    background-color: #ffecec;
    color: #d32f2f;
    float: left;
    border-bottom-left-radius: 4px;
}

/* Loading indicator */
.mcai-loading {
    font-style: italic;
    color: #666;
    background-color: #f0f0f0;
}

.mcai-send-button:hover {
    background-color: #005c8e;
}

/* Copy button */
.mcai-copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #333 !important;
    color: #fff !important;
    border: none !important;
    padding: 4px 10px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    opacity: 0;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    letter-spacing: 0.3px !important;
}

.mcai-bot-message-container:hover .mcai-copy-button {
    opacity: 1;
}

.mcai-copy-button:hover {
    background-color: #555 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-1px) !important;
}

.mcai-copy-button:active {
    transform: translateY(1px) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .mcai-wrapper {
        flex-direction: column;
    }

    .mcai-video {
        flex: 0 0 auto;
        width: 100%;
    }
    .mcai-chat-container {
        flex: 0 0 auto;
        width: 100%;
        margin-top: 20px;
        max-height: 500px; /* Default mobile max height */
        min-height: 300px; /* Minimum height for mobile */
    }

    .mcai-chat-messages {
        min-height: 150px; /* Minimum height for messages area on mobile */
    }
}

/* Input area - tightened layout */
.mcai-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e0e0e0;
    background-color: #fff;
    align-items: flex-start;
    box-sizing: border-box;
    flex-shrink: 0;
    resize: none;
    min-height: 60px;
}

/* Textarea inside chat input */
.mcai-chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 80px;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 5px;
    font-size: 14px;
    resize: none;
    line-height: 1.4;
    overflow-y: auto;
    box-sizing: border-box;
}

/* Fix extra whitespace issues */
.mcai-chat-container .mcai-chat-input-area {
    flex-shrink: 0;
}

.mcai-chat-input:hover {
    border-color: #555555;
}
/* Send button - enhanced with !important */
.mcai-send-button {
    background-color: #333333 !important;
    color: #fff !important;
    border: none !important;
    padding: 0 18px !important;
    height: 36px !important;
    cursor: pointer !important;
    border-radius: 10px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    letter-spacing: 0.3px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.mcai-send-button:hover {
    background-color: #555555 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-1px) !important;
}
.mcai-send-button:active {
    transform: translateY(1px) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}
/* Add a subtle placeholder styling */
.mcai-chat-input::placeholder {
    color: #a0a0a0;
    font-style: italic;
}
/* Adjust input height based on content automatically */
.mcai-chat-input {
    overflow-y: hidden;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mcai-chat-input-area {
        padding: 8px;
    }
    
    .mcai-chat-input {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .mcai-send-button {
        padding: 0 14px !important;
        height: 34px !important;
        font-size: 13px !important;
    }
}

/* New two-column layout wrapper */
.mcai-two-column-wrapper {
    display: flex;
    gap: 30px;
    align-items: stretch;
    max-width: 1200px;
    margin: 30px auto;
}

/* Fullwidth video wrapper */
.mcai-fullwidth-video {
    max-width: 1200px;
    margin: 0 auto;
}

/* Chat and form columns */
.mcai-chat-container,
.mcai-form-column {
    flex: 1;
    min-width: 450px;
}

/* Form column spacing */
.mcai-form-column {
    flex: 1 1 auto;
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Start button style */
.mcai-start-button {
    display: block !important;
    margin: 20px auto !important;
    padding: 10px 20px !important;
    font-size: 16px !important;
    background-color: #333 !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
}

.mcai-start-button:hover {
    background-color: #555 !important;
}

/* Placeholder container */
.mcai-chat-input-placeholder {
    padding: 20px;
    text-align: center;
    flex-shrink: 0;
    height: auto;
    min-height: 60px;
}

@media (max-width: 768px) {
    .mcai-two-column-wrapper {
        flex-direction: column;
        padding: 0 10px;
        box-sizing: border-box;
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    .mcai-chat-container,
    .mcai-form-column {
        width: 100%;
        min-width: 0;
        margin: 0 auto;
        box-sizing: border-box;
    }
}

/* MEMBERSHIP COACH FORM STYLES */

/* Form heading styles */
.mcai-user-form h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.mcai-form-subtitle {
    font-size: 12px;
    color: #666;
    margin-bottom: 16px;
    font-style: italic;
}

/* Labels */
.mcai-user-form label {
    display: block;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: -20px;
    color: #333;
}

/* Textareas */
.mcai-user-form textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    background-color: #fefefe;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    border-radius: 6px;
    resize: none;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.mcai-user-form textarea:focus {
    border-color: #999;
    background-color: #fff;
    outline: none;
}

/* Text inputs - matching textarea styling */
.mcai-user-form input[type="text"] {
    width: 95%;
    padding: 10px 12px;
    border: 1px solid #ccc;
    background-color: #fefefe;
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    border-radius: 6px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.mcai-user-form input[type="text"]:focus {
    border-color: #999;
    background-color: #fff;
    outline: none;
}

/* Each field group */
.mcai-user-form p {
    margin-bottom: 16px;
}

/* Submit button matches Start AI Tool */
.mcai-user-form input[type="submit"] {
    display: block;
    margin: 20px auto;
    padding: 10px 20px;
    font-size: 16px;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mcai-user-form input[type="submit"]:hover {
    background-color: #555;
}

.mcai-ai-disclaimer {
    font-size: 12px !important;
    color: #999 !important;
    text-align: center !important;
    margin-top: 8px !important;
    padding: 0 12px !important;
}

/* Streaming response styles */
.mcai-streaming-indicator {
    display: inline-block;
    color: #666;
    font-style: italic;
    animation: mcai-pulse 1.5s ease-in-out infinite;
}

.mcai-cursor {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #333;
    border-radius: 50%;
    animation: mcai-pulse-circle 1.5s ease-in-out infinite;
    margin-left: 2px;
    vertical-align: middle;
    font-size: 0;
    text-indent: -9999px;
    overflow: hidden;
}

@keyframes mcai-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes mcai-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes mcai-pulse-circle {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1); 
    }
    50% { 
        opacity: 0.3; 
        transform: scale(0.8); 
    }
}

.mcai-briefing {
  max-width: 1200px;
  margin: 40px auto 30px;
  padding: 0 24px;
  text-align: left;
  font-family: system-ui, sans-serif;
}

.mcai-briefing h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.mcai-briefing p {
  font-size: 16px;
  line-height: 1.7;
  color: #444;
  margin-bottom: 10px;
}

.mcai-save-chat-button {
    display: block !important;
    margin: 20px auto !important;
    padding: 10px 20px !important;
    font-size: 16px !important;
    background-color: #333 !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: background-color 0.2s ease !important;
    font-weight: 600 !important;
    text-align: center !important;
    width: auto !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.mcai-save-chat-button:hover {
    background-color: #555 !important;
}

/* Saved chat styles - tightened spacing */
.mcai-saved-chat {
    max-width: 100%;
    margin-bottom: 15px;
}

.mcai-saved-chat h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.mcai-saved-chat-subtitle {
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
    font-style: italic;
}

.mcai-saved-chat-content {
    max-height: 500px;
    overflow-y: auto;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.3;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mcai-saved-message {
    margin-bottom: 8px;
    padding: 8px 10px;
    background: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #eee;
}

.mcai-saved-message:last-child {
    margin-bottom: 0;
}

.mcai-saved-message strong {
    font-size: 12px;
    margin-bottom: 2px;
}

.mcai-saved-message div {
    margin-top: 2px;
    line-height: 1.3;
}

.mcai-saved-message div h1 {
    font-size: 1.2em;
    margin: 0.5em 0;
    font-weight: 600;
    color: #333;
}

.mcai-saved-message div h2 {
    font-size: 1.1em;
    margin: 0.5em 0;
    font-weight: 600;
    color: #333;
}

.mcai-saved-message div h3 {
    font-size: 1.05em;
    margin: 0.5em 0;
    font-weight: 600;
    color: #333;
}

.mcai-saved-message div h4 {
    font-size: 1em;
    margin: 0.5em 0;
    font-weight: 600;
    color: #333;
}

.mcai-saved-message p {
    margin: 0 0 4px 0;
}

.mcai-saved-message p:last-child {
    margin-bottom: 0;
}

#mcai-global-success {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #4caf50;
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Optional little fade-in animation */
@keyframes fadeSuccess {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Optional: keep the saved chat from stretching its parent too wide */
.mcai-save-success {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: #4caf50;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    display: none;
}

/* Link styles for markdown links in chat messages */
.mcai-chat-messages .mcai-message a {
    color: #2271b1;
    text-decoration: underline;
    cursor: pointer;
}

.mcai-chat-messages .mcai-message a:hover {
    color: #135e96;
    text-decoration: underline;
}

.mcai-chat-messages .mcai-message a:visited {
    color: #6c2e9c;
}

/* --- Fix for Ordered List Numbering in Chat Messages --- */

.mcai-chat-messages .mcai-message ol {
    list-style-type: decimal !important; /* Force decimal numbering (1, 2, 3...) */
    padding-left: 2em;     /* Adjust space for numbers */
    margin-left: 1em;      /* Indent the list */
    counter-reset: mcai-list-counter; /* Reset counter for each new OL */
}

.mcai-chat-messages .mcai-message ol > li {
    display: list-item !important; /* Ensure it behaves like a list item */
    counter-increment: mcai-list-counter; /* Increment the counter */
    margin-bottom: 0.5em; /* Spacing between list items */
}

/* Use ::before pseudo-element to display the counter, overriding default marker */
.mcai-chat-messages .mcai-message ol > li::before {
    content: counter(mcai-list-counter) ". "; /* Display number, period, space */
    font-weight: bold; /* Optional: Style the number */
    min-width: 1.5em; /* Ensure space for number */
    margin-left: -1.5em; /* Pull number back into padding area */
    display: inline-block; /* Needed for width/margin */
    text-align: right; /* Align numbers if they have different widths */
    margin-right: 0.5em; /* Space between number and item text */
}

/* Hide the default list marker which might interfere */
.mcai-chat-messages .mcai-message ol > li::marker {
    content: "" !important;
    display: none !important;
}

/* --- End Fix for Ordered List Numbering --- */

/* Summary section styling */
.mcai-step-summary {
    max-width: 100%;
    margin-bottom: 15px;
}

.mcai-step-summary h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.mcai-summary-content {
    max-height: 500px;
    overflow-y: auto;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.3;
    border: 1px solid #e0e0e0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.mcai-summary-content p {
    margin: 0 0 8px 0;
    color: #444;
}

.mcai-summary-content p:last-child {
    margin-bottom: 0;
}

.mcai-summary-content i {
    color: #666;
    font-style: italic;
}

/* Loading state styles */
.mcai-loading-state .mcai-chat-input {
    background-color: #f5f5f5;
    border-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.8;
}

.mcai-loading-state .mcai-chat-input::placeholder {
    color: #bbb;
}

.mcai-loading-state .mcai-send-button {
    background-color: #999 !important;
    cursor: not-allowed !important;
    opacity: 0.8;
}

.mcai-loading-state .mcai-save-chat-button {
    background-color: #999 !important;
    cursor: not-allowed !important;
    opacity: 0.8;
}

/* Add a subtle loading indicator */
.mcai-loading-state::after {
    content: "";
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: #666;
    font-style: italic;
    pointer-events: none;
}

/* Form success/error message styling */
.mcai-form-save-success,
.mcai-form-save-error {
    margin: 0 0 15px 0;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    animation: slideDown 0.3s ease-out;
}

.mcai-form-save-success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.mcai-form-save-error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Collapsible form section */
.mcai-form-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.mcai-form-toggle:hover {
    background: #eee;
}

.mcai-form-toggle h3 {
    margin: 0;
    font-size: 14px;
    color: #333;
}

.mcai-form-toggle-icon {
    font-size: 16px;
    color: #666;
    transition: transform 0.2s ease;
}

.mcai-form-toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.mcai-form-fields {
    transition: max-height 0.3s ease-out;
    overflow: hidden;
    max-height: 2000px; /* Large enough to contain all content */
}

.mcai-form-fields.collapsed {
    max-height: 0;
    margin: 0;
    padding: 0;
}

.mcai-form-fields h3 {
    margin-top: 0;
    margin-bottom: 4px;
}

.mcai-form-fields .mcai-form-subtitle {
    margin-bottom: 16px;
}

/* Adjust form column to handle collapsed state */
.mcai-form-column {
    display: flex;
    flex-direction: column;
}

.mcai-saved-chat {
    flex: 1;
    min-height: 0;
}

