/**
 * ShyMind AI - Beautiful Chat Interface CSS
 * Modern, responsive, and stunning design
 */

/* === Root Variables === */
:root {
    --shymind-gold: #EABE72;
    --shymind-blue: #2B6CB0;
    --shymind-teal: #1E5756;
    --shymind-light-gold: rgba(234, 190, 114, 0.15);
    --shymind-light-blue: rgba(43, 108, 176, 0.1);
    --shymind-light-teal: rgba(30, 87, 86, 0.1);
    --shymind-purple: #6B46C1;
    --shymind-light-purple: rgba(107, 70, 193, 0.1);

    --text-dark: #2c3e50;
    --text-light: #5a6c7d;
    --text-lighter: #8892a0;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --bg-lighter: #f1f3f5;
    --border-color: #e1e8ed;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 12px 36px rgba(0, 0, 0, 0.2);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

/* === Base Container === */
.shymind-ai-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-dark);
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

.shymind-ai-container * {
    box-sizing: border-box;
}

/* === No API Key Warning === */
.shymind-ai-no-key {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    box-shadow: var(--shadow-md);
    max-width: 600px;
    margin: 60px auto;
}

.no-key-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.shymind-ai-no-key h2 {
    margin: 0 0 16px 0;
    color: var(--text-dark);
    font-size: 28px;
}

.shymind-ai-no-key p {
    color: var(--text-light);
    margin: 8px 0;
    font-size: 16px;
}

/* === Main Chat Wrapper === */
.shymind-ai-chat-wrapper {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    height: calc(100vh - 140px);
    min-height: 600px;
    max-height: 900px;
}

/* === Left Sidebar === */
.shymind-ai-sidebar {
    background: linear-gradient(135deg, var(--shymind-blue) 0%, var(--shymind-teal) 100%);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
}

.sidebar-header {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.logo-icon {
    font-size: 36px;
    line-height: 1;
}

.logo-text {
    font-size: 24px;
    font-weight: 700;
    color: var(--bg-white);
}

.tagline {
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.sidebar-section {
    flex: 1;
}

.sidebar-section h3 {
    color: var(--bg-white);
    font-size: 16px;
    margin: 0 0 16px 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-question-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--bg-white);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    backdrop-filter: blur(10px);
}

.quick-question-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateX(4px);
}

.quick-question-btn .icon {
    font-size: 20px;
    flex-shrink: 0;
}

.quick-question-btn .text {
    font-size: 14px;
    line-height: 1.4;
}

.sidebar-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-footer p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    margin: 0;
    text-align: center;
}

/* === Chat Area === */
.shymind-ai-chat-area {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, var(--shymind-light-blue) 0%, var(--shymind-light-teal) 100%);
    padding: 20px 24px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-content h2 {
    margin: 0 0 4px 0;
    font-size: 22px;
    color: var(--text-dark);
}

.chat-header-content p {
    margin: 0;
    font-size: 14px;
    color: var(--text-light);
}

.new-chat-btn {
    background: var(--bg-white);
    border: 2px solid var(--shymind-blue);
    color: var(--shymind-blue);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.new-chat-btn:hover {
    background: var(--shymind-blue);
    color: var(--bg-white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* === Chat Messages === */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--bg-lighter);
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: messageSlideIn 0.3s ease;
}

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.ai-message .message-avatar {
    background: linear-gradient(135deg, var(--shymind-gold) 0%, var(--shymind-blue) 100%);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, var(--shymind-purple) 0%, var(--shymind-blue) 100%);
}

.message-content {
    flex: 1;
    max-width: calc(100% - 52px);
}

.message-text {
    background: var(--bg-white);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.user-message .message-text {
    background: linear-gradient(135deg, var(--shymind-purple) 0%, var(--shymind-blue) 100%);
    color: var(--bg-white);
}

.message-text p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

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

.message-text ul {
    margin: 8px 0;
    padding-left: 20px;
}

.message-text li {
    margin: 4px 0;
    line-height: 1.6;
}

.message-text strong {
    font-weight: 600;
}

/* === Tool Suggestions === */
.tool-suggestions {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tool-suggestion-card {
    background: var(--bg-light);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-suggestion-card:hover {
    border-color: var(--shymind-blue);
    background: var(--shymind-light-blue);
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.tool-suggestion-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.tool-suggestion-info {
    flex: 1;
}

.tool-suggestion-title {
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 4px 0;
    font-size: 14px;
}

.tool-suggestion-desc {
    font-size: 12px;
    color: var(--text-light);
    margin: 0;
}

.tool-suggestion-arrow {
    color: var(--shymind-blue);
    font-size: 18px;
    flex-shrink: 0;
}

/* === Typing Indicator === */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 12px 20px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-lighter);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* === Chat Input === */
.chat-input-wrapper {
    padding: 20px 24px;
    background: var(--bg-white);
    border-top: 2px solid var(--border-color);
}

.chat-input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#shymind-chat-input {
    flex: 1;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 150px;
    min-height: 44px;
    transition: all 0.3s ease;
}

#shymind-chat-input:focus {
    outline: none;
    border-color: var(--shymind-blue);
    box-shadow: 0 0 0 3px var(--shymind-light-blue);
}

.send-btn {
    width: 48px;
    height: 48px;
    background: #EABE72;
    color: #1E5756;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.send-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

.send-btn:hover:not(:disabled) {
    background: white;
    color: #EABE72;
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

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

.input-hint {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-lighter);
    text-align: center;
}

/* === Tool Modal === */
.shymind-tool-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.shymind-tool-modal.active {
    display: flex;
}

.tool-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.tool-modal-content {
    position: relative;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    max-width: 1000px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-xl);
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.tool-modal-header {
    padding: 24px 30px;
    border-bottom: 2px solid var(--border-color);
    background: linear-gradient(135deg, var(--shymind-light-blue) 0%, var(--shymind-light-teal) 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tool-modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-icon {
    font-size: 32px;
}

.tool-name {
    margin: 0;
    font-size: 22px;
    color: var(--text-dark);
}

.tool-modal-close {
    background: var(--bg-white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    transition: all 0.3s ease;
}

.tool-modal-close:hover {
    background: var(--shymind-blue);
    color: var(--bg-white);
    transform: rotate(90deg);
}

.tool-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.tool-modal-footer {
    padding: 20px 30px;
    border-top: 2px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

.tool-modal-close-btn {
    background: var(--shymind-blue);
    color: var(--bg-white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-modal-close-btn:hover {
    background: var(--shymind-teal);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

/* === Loading State === */
.loading-message {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

.loading-spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--shymind-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* === Responsive Design === */
@media (max-width: 968px) {
    .shymind-ai-chat-wrapper {
        grid-template-columns: 1fr;
        height: auto;
        min-height: auto;
    }

    .shymind-ai-sidebar {
        max-height: 400px;
        order: 2;
        margin-top: 20px;
    }

    .shymind-ai-chat-area {
        order: 1;
        min-height: 500px;
    }

    .new-chat-btn .btn-text {
        display: none;
    }
}

@media (max-width: 640px) {
    .shymind-ai-container {
        padding: 12px;
    }

    .chat-messages {
        padding: 16px;
    }

    .message-text {
        padding: 12px 16px;
    }

    .chat-header {
        padding: 16px;
    }

    .chat-header-content h2 {
        font-size: 18px;
    }

    .tool-modal-content {
        max-width: 100%;
        max-height: 95vh;
    }

    .tool-modal-body {
        padding: 20px;
    }
}

/* === Scrollbar Styling === */
.chat-messages::-webkit-scrollbar,
.shymind-ai-sidebar::-webkit-scrollbar,
.tool-modal-body::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track,
.shymind-ai-sidebar::-webkit-scrollbar-track,
.tool-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.tool-modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.shymind-ai-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.shymind-ai-sidebar::-webkit-scrollbar-thumb:hover,
.tool-modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-lighter);
}
