/* ============================================
   Yasamasa Styles
   Main stylesheet for Yasamasa chat interface
   ============================================ */

/* Base Styles */
body {
    background-color: #232324;
    color: #fff;
    font-family: 'Segoe UI', Arial, sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    transition: all 0.5s ease;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 800px;
    padding: 20px;
    text-align: center;
    margin: 0 auto;
    width: 100%;
    transition: all 0.5s ease;
}

/* Header Styles */
header {
    transition: all 0.5s ease;
    width: 100%;
    display: flex;
    justify-content: center;
}

header .container {
    transition: all 0.5s ease;
}

.logo {
    width: 5.625rem;
    height: 5.625rem;
    border-radius: 50%;
    margin-bottom: 18px;
    border: 2px solid #333;
    transition: all 0.5s ease;
}

h1 {
    font-size: 1.875rem;
    margin-bottom: 8px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.5s ease;
    font-family: 'Inter', sans-serif;
}

p {
    margin: 5px 0;
    color: #bdbdbd;
    font-size: 1rem;
    transition: all 0.5s ease;
}

/* Buttons Container */
.buttons-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 18px;
    margin-top: 38px;
    width: 100%;
    transition: all 0.5s ease;
    opacity: 1;
    max-height: 500px;
}

.button {
    background-color: #232324;
    color: #bdbdbd;
    border: 1.5px solid #333;
    border-radius: 18px;
    padding: 1.125rem 2rem;
    cursor: pointer;
    min-width: 170px;
    text-align: center;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(.4, 0, .2, 1);
    box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.04);
}

.button:hover {
    background-color: #29292b;
    color: #fff;
    border-color: #444;
}

/* Search/Chat Container */
.search-container {
    margin-top: 3.75rem;
    width: 100%;
    max-width: 800px;
    position: relative;
    transition: all 0.5s ease;
}

.search-box {
    width: 100%;
    background-color: #28282a;
    border: none;
    border-radius: 32px;
    padding: 0 6.875rem 0 4.375rem;
    color: #e4e4e4;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    height: 5rem;
    line-height: 80px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    text-align: left;
    font-weight: 500;
}

.search-box:hover {
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.07);
    background-color: #323234;
}

.search-controls {
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 12px;
    z-index: 1;
}

.control-button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #9e9e9e;
    opacity: 0.85;
    transition: all 0.2s ease;
}

.control-button:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.07);
}

.add-button {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #353537;
    border: 2px solid #444;
    color: #ffffff;
    cursor: pointer;
    font-size: 28px;
    font-weight: bold;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: all 0.2s ease;
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.5);
    line-height: 44px;
    padding-bottom: 2px;
}

.add-button:hover {
    background-color: #444;
    border-color: #555;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.13);
}

.add-button::before {
    content: "+";
    display: block;
}

footer {
    margin-top: 3.75rem;
    width: 100%;
    text-align: center;
    color: #777;
    font-size: 15px;
    transition: all 0.5s ease;
}

footer p {
    margin: 10px 0;
}

/* Chat History Styles */
#chat-history {
    width: 100%;
    max-width: 800px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 20px;
    scrollbar-width: thin;
    scrollbar-color: #2e2828 #211d1d;
    transition: all 0.2s ease-out;
    scroll-behavior: smooth;
    scroll-padding-bottom: 20px;
}

@media (prefers-reduced-motion: no-preference) {
    #chat-history {
        scroll-behavior: smooth;
    }
}

#chat-history::-webkit-scrollbar {
    width: 8px;
}

#chat-history::-webkit-scrollbar-track {
    background: #232324;
}

#chat-history::-webkit-scrollbar-thumb {
    background-color: #444;
    border-radius: 4px;
}

/* Message Container with Avatar */
.message-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
}

.message-wrapper.user {
    flex-direction: row-reverse;
    justify-content: flex-start;
}

.message-wrapper.bot {
    justify-content: flex-start;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Avatar Styles */
.message-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
}

.message-avatar.user {
    background: #2c5282;
    color: #fff;
}

.message-avatar.bot {
    background: #4a5568;
    color: #fff;
}

.message-avatar::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: inherit;
    filter: blur(8px);
    opacity: 0.3;
    z-index: -1;
}

/* Message Content Container */
.message-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: calc(100% - 60px);
}

.message-wrapper.user .message-content {
    max-width: 50%;
}

.message-wrapper.bot .message-content {
    max-width: 80%;
}

/* Message Bubble */
.message {
    padding: 1rem 1.25rem;
    border-radius: 20px;
    line-height: 1.6;
    font-size: 0.9375rem;
    position: relative;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.message:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.user-message {
    background: rgba(45, 55, 72, 0.2);
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
}

.bot-message {
    background: rgba(42, 42, 44, 0.2);
    color: #e4e4e4;
    border-bottom-left-radius: 6px;
    border: 1px solid #3a3a3c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    text-align: left;
}

/* Timestamp */
.message-timestamp {
    font-size: 11px;
    color: #888;
    padding: 0 4px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.message-wrapper.user .message-timestamp {
    text-align: right;
}

/* Markdown Content Styling */
.bot-message h1,
.bot-message h2,
.bot-message h3,
.bot-message h4 {
    margin-top: 16px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #60a5fa;
}

.bot-message h1 {
    font-size: 1.5em;
}

.bot-message h2 {
    font-size: 1.3em;
}

.bot-message h3 {
    font-size: 1.15em;
}

.bot-message p {
    margin-bottom: 12px;
    color: #e4e4e4;
}

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

.bot-message ul,
.bot-message ol {
    margin-left: 20px;
    margin-bottom: 12px;
}

.bot-message li {
    margin-bottom: 6px;
    color: #d4d4d4;
}

.bot-message strong {
    color: #e4e4e4;
    font-weight: var(--font-weight-semibold);
    background: rgba(96, 165, 250, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
}

.bot-message code {
    background: #1a1a1c;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    color: #93c5fd;
    border: 1px solid #3a3a3c;
}

.bot-message pre {
    background: #1a1a1c;
    padding: 18px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid #3a3a3c;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}

.bot-message pre code {
    background: transparent;
    padding: 0;
    color: #f8f8f2;
    border: none;
}

.bot-message blockquote {
    border-left: 4px solid #60a5fa;
    margin: 12px 0;
    padding-left: 16px;
    color: #aaa;
    font-style: italic;
    background: rgba(96, 165, 250, 0.05);
    padding: 12px 16px;
    border-radius: 8px;
}

/* Loading Animation */
.loading-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    color: #aaa;
}

.loading-dots::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #60a5fa;
    animation: pulse 1.4s ease-in-out infinite;
}

.loading-dots::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #93c5fd;
    animation: pulse 1.4s ease-in-out 0.2s infinite;
}

@keyframes pulse {
    0%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

@keyframes dots {
    0%,
    20% {
        content: '.';
    }

    40% {
        content: '..';
    }

    60%,
    100% {
        content: '...';
    }
}

/* Input Styling */
#chat-input {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.9rem;
    width: 100%;
    outline: none;
    font-family: inherit;
    padding: 0;
    margin: 0;
}

#chat-input::placeholder {
    color: #999;
}

/* File Upload Preview */
#file-preview {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}

.file-item {
    background-color: #353537;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #444;
}

.file-item .remove-file {
    cursor: pointer;
    color: #ff6b6b;
    font-weight: bold;
    margin-left: 5px;
}

/* ============================================
   CHAT MODE STYLES
   ============================================ */

body.chat-mode {
    justify-content: flex-start;
    padding-top: 0;
}

body.chat-mode header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background-color: #232324;
}

body.chat-mode header .container {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    max-width: 900px;
    text-align: left;
    background-color: #2a2a2c;
    margin: 0 auto;
    border-bottom: 1px solid #3a3a3c;
    cursor: default;
}

body.chat-mode .logo {
    width: 50px;
    height: 50px;
    margin-bottom: 0;
    margin-right: 15px;
}

body.chat-mode h1 {
    font-size: 22px;
    margin-bottom: 0;
    text-align: center;
    flex-grow: 1;
}

body.chat-mode header p {
    display: none;
}

body.chat-mode .buttons-container {
    opacity: 0;
    max-height: 0;
    margin-top: 0;
    overflow: hidden;
    pointer-events: none;
}

body.chat-mode .search-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0 auto;
    padding: 25px 20px;
    max-width: 900px;
    background-color: #232324;
    background: linear-gradient(to top, #232324 85%, transparent);
    z-index: 99;
}

body.chat-mode .search-box {
    height: 160px;
    align-items: flex-start;
    padding: 25px 110px 25px 70px;
    line-height: 1.5;
    background-color: #2a2a2c;
    border: 1px solid #3a3a3c;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    cursor: text;
}

body.chat-mode #chat-input {
    padding-top: 5px;
}

body.chat-mode #chat-history {
    position: fixed;
    top: 70px;
    bottom: 220px;
    left: 0;
    right: 0;
    max-width: 900px;
    margin: 0 auto;
    overflow-y: auto;
    padding: 20px;
}

body.chat-mode footer {
    display: none;
}
