/* Legacy — Samana International Academy Chat Styles */
/* Canopy Theme: Dark Royal Green + Tropical Sunset Pops */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@600;700&display=swap');

:root {
  /* Foundations: Dark Royal Greens */
  --bg:              #0A1A14;
  --bg-surface:      #0F2119;
  --bg-elevated:     #142B21;
  --bg-input:        #1A3329;
  --bg-hover:        #1F3D30;
  --bg-active:       #254A39;

  /* Accent: Tropical Sunset (use sparingly) */
  --accent:          #E8734A;
  --accent-warm:     #F2994A;
  --accent-glow:     rgba(232, 115, 74, 0.15);
  --accent-gold:     #D4A853;

  /* Text */
  --text:            #F0EDE5;
  --text-secondary:  #9CA89E;
  --text-muted:      #5C6E60;
  --text-on-accent:  #0A1A14;

  /* Borders */
  --border:          #1E3528;
  --border-accent:   rgba(232, 115, 74, 0.25);

  /* Chat Bubbles */
  --user-bubble:     #1A3329;
  --bot-bubble:      #0F2119;

  /* Status */
  --success:         #4CAF6A;
  --warning:         #F2994A;
  --error:           #E85454;
  --info:            #5BA8C8;

  /* Shadows */
  --shadow-sm:       0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md:       0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg:       0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-accent:   0 4px 12px rgba(232, 115, 74, 0.2);

  /* Radius */
  --radius-sm:       8px;
  --radius-md:       14px;
  --radius-lg:       20px;
  --radius-pill:     999px;

  /* Transitions */
  --ease:            0.2s ease;
  --ease-slow:       0.35s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #7B949C;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-container {
    width: 100%;
    max-width: 500px;
    height: 90vh;
    max-height: 750px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
}

/* Header */
.chat-header {
    background: linear-gradient(135deg, var(--bg) 0%, var(--bg-elevated) 100%);
    color: var(--text);
    padding: 16px 20px;
    border-bottom: 2px solid var(--border-accent);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--accent-glow);
    border: 2px solid var(--border-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-emoji {
    font-size: 22px;
}

.header-text {
    flex: 1;
}

.header-text h1 {
    font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.status-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.lang-toggle {
    background: transparent;
    border: 1px solid var(--border-accent);
    color: var(--accent);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--ease);
}

.lang-toggle:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

.new-chat-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--ease);
}

.new-chat-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-secondary);
    color: var(--text);
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
}

.quick-btn {
    padding: 10px 8px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    transition: all var(--ease);
    color: var(--text);
    text-align: center;
    line-height: 1.3;
}

.quick-btn:hover {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-accent);
}

.quick-btn:active {
    transform: translateY(0);
}

/* Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--bg);
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 14px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    text-align: right;
}

.message.bot {
    text-align: left;
}

.message.agent {
    text-align: left;
}

.message-bubble {
    display: inline-block;
    max-width: 82%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.55;
}

.user .message-bubble {
    background: var(--user-bubble);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-right-radius: 4px;
}

.bot .message-bubble {
    background: var(--bot-bubble);
    color: var(--text);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.agent .message-bubble {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-gold) 100%);
    color: var(--text-on-accent);
    font-weight: 500;
    box-shadow: var(--shadow-accent);
    border-bottom-left-radius: 4px;
}

.message-content {
    font-size: 14px;
}

.message-content ul,
.message-content ol {
    margin: 6px 0 4px 0;
    padding-left: 20px;
}

.message-content li {
    margin-bottom: 3px;
    line-height: 1.5;
}

.message-content strong {
    font-weight: 600;
}

.message-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid var(--border-accent);
    transition: border-color var(--ease);
}

.message-content a:hover {
    border-bottom-color: var(--accent);
}

.user .message-content a {
    color: var(--accent-warm);
    border-bottom-color: rgba(242, 153, 74, 0.3);
}

/* Inline response buttons (from [[button]] markup) */
.inline-btn {
    display: inline-block;
    padding: 6px 14px;
    margin: 4px 4px 4px 0;
    background: transparent;
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-pill);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all var(--ease);
}

.inline-btn:hover {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
    box-shadow: var(--shadow-accent);
}

/* System Messages */
.message.system {
    text-align: center;
}

.system .message-bubble {
    background: var(--bg-elevated);
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    border: 1px solid var(--border);
}

/* Typing Indicator */
.typing-indicator {
    padding: 0 20px 10px 20px;
    background: var(--bg);
    display: none;
}

.typing-indicator.show {
    display: block;
}

.typing-bubble {
    display: inline-block;
    padding: 12px 16px;
    background: var(--bot-bubble);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.typing-bubble span {
    height: 8px;
    width: 8px;
    background: var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    animation: bounce 1.4s infinite;
}

.typing-bubble span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-bubble span:nth-child(3) {
    animation-delay: 0.4s;
    margin-right: 0;
}

@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Input Area */
.chat-input-container {
    padding: 14px 16px;
    background: var(--bg-surface);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: center;
}

#userInput {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color var(--ease);
    background: var(--bg-input);
    color: var(--text);
}

#userInput::placeholder {
    color: var(--text-muted);
}

#userInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: var(--text-on-accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--ease);
    box-shadow: var(--shadow-accent);
    flex-shrink: 0;
}

.send-btn:hover {
    background: var(--accent-warm);
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(232, 115, 74, 0.4);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 5px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg);
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Mobile */
@media (max-width: 600px) {
    body {
        padding: 0;
    }

    .chat-container {
        max-width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    .quick-actions {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 10px;
    }

    .quick-btn {
        padding: 8px 6px;
        font-size: 11px;
    }

    .header-text h1 {
        font-size: 18px;
    }

    .message-bubble {
        max-width: 88%;
    }
}

.loading {
    pointer-events: none;
    opacity: 0.6;
}
