/**
 * Public CSS for Mentor in Christ
 * Styles for SoulPractice AI Chat Widget
 */

/* Font import */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

/* Container styling */
.elevenlabs-ai-chat-container {
    border: none;
    border-radius: 0px; /* Changed from 18px */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #FAFAFA; /* SoulPractice background */
    margin: 20px auto;
    font-family: 'Poppins', sans-serif; /* Updated font */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05), 0 2px 10px rgba(0, 0, 0, 0.03); /* Softer shadow */
    position: relative;
    transition: all 0.7s ease-in-out;
}

.elevenlabs-ai-chat-container.theme-dark {
    background: #333333; /* Dark theme background */
    color: #FAFAFA;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2), 0 2px 10px rgba(0, 0, 0, 0.15);
}

/* Simplified header with Orange Gradient */
.elevenlabs-ai-chat-header {
    background: linear-gradient(135deg, #8D5B4C 0%, #8D5B4C 100%); /* SoulPractice Orange Gradient */
    padding: 22px;
    /* border-bottom: 1px solid #DDDDDD; */ /* Removed border */
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: none; /* Remove shadow */
}

.elevenlabs-ai-chat-header h3 {
    color: #ffffff; /* White text for contrast */
    font-family: 'Poppins', sans-serif; /* Updated font */
    font-weight: 600;
    letter-spacing: normal; /* Changed from 1.5px to match payment notice */
    /* text-transform: uppercase; */ /* Removed uppercase */
    font-size: 1.4em; /* Changed from 22px to match payment notice */
    margin: 0;
    padding: 0;
    text-shadow: none; /* Remove shadow */
}

/* Remove header glow effect */
/* .elevenlabs-ai-chat-header::after { ... } */

/* Status area */
.elevenlabs-ai-chat-status {
    background: rgba(250, 250, 250, 0.8); /* Slightly transparent background */
    padding: 14px 15px;
    /* border-bottom: 1px solid #EEEEEE; */ /* Removed border */
    font-size: 16px;
    color: #4A4A4A; /* SoulPractice text color */
    text-align: center;
    font-style: normal; /* Remove italic */
    letter-spacing: 0.5px;
    backdrop-filter: blur(3px); /* Reduced blur */
}

.theme-dark .elevenlabs-ai-chat-status {
    background: rgba(60, 60, 60, 0.8);
    border-bottom: 1px solid #555555;
    color: #DDDDDD;
}

.elevenlabs-ai-chat-status p {
    margin: 5px 0;
    transition: all 0.3s ease;
}

/* Button area */
.elevenlabs-ai-chat-buttons {
    padding: 18px 20px;
    background: rgba(250, 250, 250, 0.9); /* Slightly transparent background */
    /* border-bottom: 1px solid #EEEEEE; */ /* Removed border */
    text-align: center;
    backdrop-filter: blur(3px); /* Reduced blur */
}

.theme-dark .elevenlabs-ai-chat-buttons {
    background: rgba(60, 60, 60, 0.9);
    border-bottom: 1px solid #555555;
}

/* SoulPractice styled buttons */
.elevenlabs-ai-chat-start-button,
.elevenlabs-ai-chat-stop-button {
    margin: 0 10px !important;
    padding: 14px 32px !important;
    background: #8D5B4C !important; /* SoulPractice button brown */
    color: #ffffff !important;
    border: none !important;
    border-radius: 0px !important; /* Changed from 30px */
    font-family: 'Poppins', sans-serif !important; /* Updated font */
    font-size: 14px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    transition: all 0.3s ease !important; /* Smoother transition */
    box-shadow: 0 4px 12px rgba(141, 91, 76, 0.2) !important; /* Brownish shadow */
    position: relative !important;
    overflow: hidden !important;
}

/* Remove button shine effect */
/* .elevenlabs-ai-chat-start-button::after, .elevenlabs-ai-chat-stop-button::after { ... } */

.elevenlabs-ai-chat-start-button:hover,
.elevenlabs-ai-chat-stop-button:hover {
    background: #A07163 !important; /* Lighter brown on hover */
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 18px rgba(141, 91, 76, 0.3) !important; /* Darker shadow on hover */
}

.elevenlabs-ai-chat-start-button:active,
.elevenlabs-ai-chat-stop-button:active {
    transform: translateY(1px) !important;
    box-shadow: 0 2px 8px rgba(141, 91, 76, 0.25) !important; /* Slightly smaller shadow */
    transition: all 0.1s ease !important;
}

.elevenlabs-ai-chat-start-button:disabled,
.elevenlabs-ai-chat-stop-button:disabled {
    background: #CCCCCC !important; /* Light gray disabled */
    color: #888888 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

/* Stop button uses same style */
.elevenlabs-ai-chat-stop-button {
    /* Inherits base button style */
}

.elevenlabs-ai-chat-stop-button:hover {
    /* Inherits base button hover style */
}

/* Transcript area */
.elevenlabs-ai-chat-transcript {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #FAFAFA; /* SoulPractice background */
    position: relative;
    backdrop-filter: none; /* Remove blur */
    transition: background 0.5s ease;
    scroll-behavior: smooth;
    min-height: 150px; /* Ensure sufficient height even when empty */
}

.theme-dark .elevenlabs-ai-chat-transcript {
    background: #333333; /* Dark theme background */
}

/* Message organization */
.elevenlabs-ai-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Message bubble base styles */
.elevenlabs-ai-chat-message {
    max-width: 85%;
    margin-bottom: 0;
    padding: 14px 20px;
    border-radius: 0px; /* Changed from 20px */
    position: relative;
    font-size: 16px; /* Slightly smaller font */
    line-height: 1.45;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Softer shadow */
    transition: all 0.4s ease;
}

/* User messages */
.elevenlabs-ai-chat-user-message {
    align-self: flex-end;
    background: #8D5B4C; /* SoulPractice button brown */
    color: white;
    border-bottom-right-radius: 0px; /* Changed from 4px */
    box-shadow: 0 3px 10px rgba(141, 91, 76, 0.15); /* Brownish shadow */
    opacity: 0;
    animation: fadeIn 0.9s cubic-bezier(0.34, 0.0, 0.24, 1) forwards;
}

/* Agent messages */
.elevenlabs-ai-chat-agent-message {
    align-self: flex-start;
    background: #EEEEEE; /* Light gray background */
    color: #4A4A4A; /* SoulPractice text color */
    border-bottom-left-radius: 0px; /* Changed from 4px */
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06); /* Subtle shadow */
    display: block;
    animation: fadeIn 0.9s cubic-bezier(0.34, 0.0, 0.24, 1) forwards;
}

/* Dark theme message styling */
.theme-dark .elevenlabs-ai-chat-agent-message {
    background: #444444; /* Darker gray */
    color: #FAFAFA;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* System messages (notifications, etc.) */
.elevenlabs-ai-chat-system-message {
    align-self: center;
    background: #FFF8E1; /* Light yellow */
    color: #6D4C41; /* Brownish text */
    border-radius: 0px; /* Changed from 14px */
    margin: 5px 15%;
    padding: 10px 15px;
    font-size: 0.9em;
    font-style: italic;
    text-align: center;
    border: 1px solid #FFECB3; /* Lighter yellow border */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.theme-dark .elevenlabs-ai-chat-system-message {
    background: #4E342E; /* Dark brown */
    color: #FFECB3; /* Light yellow text */
    border-color: #6D4C41;
}

/* Timeout messages */
.elevenlabs-ai-chat-timeout-message {
    align-self: flex-start;
    background: #795548; /* Darker brown */
    color: white;
    border-radius: 0px; /* Changed from 18px */
    border-bottom-left-radius: 0px; /* Changed from 4px */
    padding: 14px 20px;
    font-weight: 500;
    box-shadow: 0 3px 12px rgba(121, 85, 72, 0.2); /* Dark brown shadow */
    border-left: 4px solid #FF7043; /* SoulPractice accent orange */
}

.theme-dark .elevenlabs-ai-chat-timeout-message {
    background: #5D4037; /* Even darker brown */
    border-left-color: #FF8A65; /* Lighter orange */
}

/* Error messages */
.elevenlabs-ai-chat-error {
    background: #FFEBEE; /* Light pink */
    color: #C62828; /* Dark red */
    padding: 14px 20px;
    border-radius: 0px; /* Changed from 14px */
    margin-bottom: 16px;
    border-left: 4px solid #C62828; /* Dark red border */
    box-shadow: 0 2px 10px rgba(198, 40, 40, 0.08);
}

.theme-dark .elevenlabs-ai-chat-error {
    background: #4E342E; /* Dark brown */
    color: #EF9A9A; /* Light red */
    border-left-color: #EF5350; /* Lighter red */
}

/* Orb animations using SoulPractice colors */
/* Orb container */
.elevenlabs-ai-chat-orb {
    position: absolute;
    width: 70px; /* Slightly smaller */
    height: 70px;
    bottom: 35px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
    opacity: 0; /* Default hidden */
}

/* Make orb visible in active states */
.elevenlabs-ai-chat-speaking .elevenlabs-ai-chat-orb,
.elevenlabs-ai-chat-listening .elevenlabs-ai-chat-orb {
    opacity: 0.9; /* Slightly less opaque */
}

/* Inner pulsing element with SoulPractice accent color */
.elevenlabs-ai-chat-orb::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background-image: 
        radial-gradient(circle, rgba(255, 112, 67, 0.85) 0%, rgba(255, 87, 34, 0.5) 40%, rgba(255, 87, 34, 0.2) 70%, rgba(255, 87, 34, 0) 100%), /* Orange/Coral gradient */
        radial-gradient(circle at 30% 30%, rgba(255, 224, 192, 0.5) 0%, rgba(255, 224, 192, 0.2) 30%, rgba(255, 224, 192, 0) 70%); /* Lighter orange highlight */
    will-change: opacity, transform;
    transition: all 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 0 30px 15px rgba(255, 183, 153, 0.35), 0 0 20px 20px rgba(255, 112, 67, 0.15); /* Orange glow */
    backdrop-filter: blur(3px); /* Reduced blur */
}

/* Listening mode - inner element */
.elevenlabs-ai-chat-orb.listening::after {
    width: 40px; /* Adjusted size */
    height: 40px;
    box-shadow: 0 0 25px 8px rgba(255, 183, 153, 0.6), 0 0 15px 12px rgba(255, 112, 67, 0.35); /* Orange glow */
    opacity: 0.90;
    animation: pulseOrb 4s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

/* Speaking mode - inner element */
.elevenlabs-ai-chat-orb.speaking::after {
    width: 75px; /* Adjusted size */
    height: 75px;
    box-shadow: 0 0 35px 15px rgba(255, 183, 153, 0.65), 0 0 25px 20px rgba(255, 112, 67, 0.3); /* Orange glow */
    opacity: 0.95;
    animation: pulseOrb 3s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

/* Orb ending mode */
.elevenlabs-ai-chat-orb.ending::after {
    opacity: 0 !important;
    transform: scale(0.5) !important;
    transition: opacity 1.2s ease-out, transform 1s ease-out, height 1s ease, width 1s ease !important;
}

/* Pulsing orb animation */
@keyframes pulseOrb {
    0% { transform: scale(0.90); opacity: 0.80; }
    50% { transform: scale(1.10); opacity: 0.95; }
    100% { transform: scale(0.90); opacity: 0.80; }
}

/* Message fade-in animation */
@keyframes fadeIn {
    0% {
        opacity: 0;
        transform: translateY(15px); /* Reduced distance */
        filter: blur(1px); /* Reduced blur */
    }
    70% {
        opacity: 0.9;
        transform: translateY(1px);
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Status colors using SoulPractice accent */
.elevenlabs-ai-chat-container .elevenlabs-ai-chat-agent-status:contains("speaking") {
    color: #FF7043; /* SoulPractice accent orange */
    font-weight: 600;
    transition: color 0.4s ease;
}

.elevenlabs-ai-chat-container .elevenlabs-ai-chat-agent-status:contains("listening") {
    color: #FF8A65; /* Lighter orange */
    font-weight: 600;
    transition: color 0.4s ease;
}

/* Disconnected status */
.elevenlabs-ai-chat-connection-status {
    font-weight: 500;
    transition: color 0.3s ease;
    color: #757575; /* Gray for disconnected */
}

/* Custom scrollbar using SoulPractice colors */
.elevenlabs-ai-chat-transcript::-webkit-scrollbar {
    width: 8px;
}

.elevenlabs-ai-chat-transcript::-webkit-scrollbar-track {
    background: #F5F5F5; /* Very light gray track */
    border-radius: 0px; /* Changed from 10px */
}

.elevenlabs-ai-chat-transcript::-webkit-scrollbar-thumb {
    background: rgba(141, 91, 76, 0.4); /* Semi-transparent brown thumb */
    border-radius: 0px; /* Changed from 10px */
    transition: background 0.3s ease;
}

.elevenlabs-ai-chat-transcript::-webkit-scrollbar-thumb:hover {
    background: rgba(141, 91, 76, 0.6); /* Darker brown on hover */
}

.theme-dark .elevenlabs-ai-chat-transcript::-webkit-scrollbar-track {
    background: #424242; /* Dark gray track */
}

.theme-dark .elevenlabs-ai-chat-transcript::-webkit-scrollbar-thumb {
    background: rgba(161, 136, 127, 0.4); /* Lighter brown thumb for dark theme */
}

.theme-dark .elevenlabs-ai-chat-transcript::-webkit-scrollbar-thumb:hover {
    background: rgba(161, 136, 127, 0.6); /* Darker on hover */
}

/* Mobile responsive styles (minor adjustments if needed) */
@media screen and (max-width: 768px) {
    .elevenlabs-ai-chat-container {
        border-radius: 0px; /* Changed from 14px */
        margin: 15px auto;
    }
    .elevenlabs-ai-chat-header {
        padding: 18px;
    }
    .elevenlabs-ai-chat-header h3 {
        font-size: 18px;
        letter-spacing: 1.2px;
    }
    .elevenlabs-ai-chat-status {
        padding: 10px 12px;
        font-size: 15px;
    }
    .elevenlabs-ai-chat-message {
        max-width: 90%;
        font-size: 15px; /* Adjusted mobile font size */
        padding: 12px 16px;
    }
    .elevenlabs-ai-chat-buttons {
        padding: 15px;
    }
    .elevenlabs-ai-chat-start-button,
    .elevenlabs-ai-chat-stop-button {
        padding: 12px 20px !important;
        font-size: 13px !important;
        margin: 0 5px !important;
    }
    .elevenlabs-ai-chat-transcript {
        padding: 18px;
    }
    .elevenlabs-ai-chat-orb {
        width: 65px; /* Adjusted mobile orb size */
        height: 65px;
        bottom: 30px;
    }
    .elevenlabs-ai-chat-orb.speaking::after {
        width: 65px; /* Adjusted mobile orb size */
        height: 65px;
    }
}

/* Even smaller screens (most phones) */
@media screen and (max-width: 480px) {
    .elevenlabs-ai-chat-container {
        border-radius: 0px; /* Changed from 12px */
        margin: 10px auto;
    }
    .elevenlabs-ai-chat-header h3 {
        font-size: 16px;
        letter-spacing: 1px;
    }
    .elevenlabs-ai-chat-status {
        padding: 8px 10px;
        font-size: 14px;
    }
    .elevenlabs-ai-chat-message {
        max-width: 95%;
        font-size: 14px; /* Adjusted smallest screen font size */
        line-height: 1.4;
        padding: 10px 14px;
    }
    .elevenlabs-ai-chat-buttons {
        padding: 12px;
        display: flex;
        justify-content: center;
    }
    .elevenlabs-ai-chat-start-button,
    .elevenlabs-ai-chat-stop-button {
        padding: 10px 16px !important;
        font-size: 12px !important;
        flex: 1;
        max-width: 130px;
        margin: 0 4px !important;
    }
    .elevenlabs-ai-chat-transcript {
        padding: 15px;
    }
    .elevenlabs-ai-chat-orb {
        width: 55px; /* Adjusted smallest screen orb size */
        height: 55px;
        bottom: 25px;
    }
    
    .elevenlabs-ai-chat-orb.speaking::after {
        width: 55px; /* Adjusted smallest screen orb size */
        height: 55px;
    }
    
    .elevenlabs-ai-chat-orb.listening::after {
        width: 35px; /* Adjusted smallest screen orb size */
        height: 35px;
    }
}

/* Payment Notice Styles */
.elevenlabs-ai-chat-payment-notice {
    background: #FAFAFA; /* SoulPractice background */
    border-radius: 0px; /* Changed from 18px */
    padding: 30px; 
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05), 0 2px 10px rgba(0, 0, 0, 0.03); /* Softer shadow */
    font-family: 'Poppins', sans-serif; /* Updated font */
    margin: 20px auto; 
    border: 1px solid #EEEEEE; /* Lighter border */
    max-width: 600px; /* Optional: constrain width */
}

.elevenlabs-ai-chat-payment-notice h3 {
    font-family: 'Poppins', sans-serif; /* Updated font */
    margin-bottom: 15px; 
    color: #4A4A4A; /* SoulPractice text color */
    font-size: 1.4em;
    font-weight: 600;
}

.elevenlabs-ai-chat-payment-notice p {
    color: #4A4A4A; /* SoulPractice text color */
    font-size: 1.1em; 
    margin-bottom: 20px;
}

.elevenlabs-ai-chat-payment-notice .button {
    background: #8D5B4C !important; /* SoulPractice button brown */
    color: white !important; 
    padding: 12px 24px !important; 
    border-radius: 0px !important; /* Changed from 30px */
    display: inline-block; 
    margin-top: 15px !important; 
    text-decoration: none !important;
    font-family: 'Poppins', sans-serif !important; /* Updated font */
    font-weight: 600 !important; 
    transition: all 0.3s ease !important;
    border: none !important; 
    box-shadow: 0 4px 12px rgba(141, 91, 76, 0.2) !important; /* Brownish shadow */
    cursor: pointer !important;
}

.elevenlabs-ai-chat-payment-notice .button:hover {
    transform: translateY(-2px) !important; 
    box-shadow: 0 6px 18px rgba(141, 91, 76, 0.3) !important; /* Darker shadow on hover */
    background: #A07163 !important; /* Lighter brown on hover */
}

/* Credits Display */
.elevenlabs-chat-credits {
    text-align: right; 
    margin-bottom: 10px; 
    font-family: 'Poppins', sans-serif; /* Updated font */
    font-weight: 600; 
    color: #8D5B4C; /* SoulPractice button brown */
    padding-right: 15px; /* Adjusted padding */
    font-size: 0.9em;
}

/* Debug Info Box */
.elevenlabs-chat-debug {
    background: #f0f0f0; 
    border: 1px solid #ddd; 
    padding: 10px; 
    margin-bottom: 10px;
    font-family: monospace; 
    font-size: 12px; 
    border-radius: 0px; /* Changed from 4px */
    word-wrap: break-word;
    text-align: left;
}

/* Ensure error message style is consistent (already defined, but good to have here) */
.elevenlabs-ai-chat-error { 
    background: #FFEBEE; /* Light pink */
    color: #C62828; /* Dark red */
    padding: 14px 20px; 
    border-radius: 0px; /* Changed from 14px */
    margin: 20px auto;
    border-left: 4px solid #C62828; /* Dark red border */
    box-shadow: 0 2px 10px rgba(198, 40, 40, 0.08);
    max-width: 600px;
    font-family: 'Poppins', sans-serif; /* Ensure font consistency */
}
