* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #001f3f url('MrVini.jpeg') left center no-repeat;
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(0, 31, 63, 0.2) 0%, rgba(0, 31, 63, 0.5) 60%, rgba(0, 31, 63, 0.7) 100%);
    z-index: 0;
}

.container {
    position: relative;
    margin-left: auto;
    width: 55%;
    max-width: 650px;
    min-height: 100vh;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 1;
    backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3);
    transition: all 0.4s ease;
}

.container.thinking {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(5px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.header {
    background: rgba(0, 31, 63, 0.4);
    color: white;
    padding: 15px 25px;
    text-align: center;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.4s ease;
}

.container.thinking .header {
    background: rgba(0, 31, 63, 0.15);
    backdrop-filter: blur(3px);
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.header h1 {
    font-size: 24px;
    margin: 0;
    flex: 1;
}

.header-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    flex-shrink: 0;
}

.header-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.header-toggle .toggle-icon {
    font-size: 12px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.header.collapsed .header-toggle .toggle-icon {
    transform: rotate(180deg);
}

.header-collapsible {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin-top 0.3s ease, padding 0.3s ease;
    opacity: 1;
    margin-top: 8px;
}

.header.collapsed .header-collapsible {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
    padding: 0;
}

.subtitle {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 15px;
    font-size: 12px;
    opacity: 0.8;
}

.stats-bar span {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
}

.mode-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    backdrop-filter: blur(5px);
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    color: white;
    box-shadow: 0 2px 10px rgba(255, 255, 255, 0.2);
}

.mode-icon {
    font-size: 16px;
}

.mode-label {
    font-weight: 500;
}

.chat-container {
    flex: 1 0 auto;
    padding: 15px 25px 80px 25px;
    background: transparent;
    min-height: 50vh;
}

.chat-container::-webkit-scrollbar {
    width: 6px;
}

.chat-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.welcome-message {
    max-width: 600px;
    margin: 25px auto;
    text-align: center;
    transition: opacity 0.4s ease;
    background: rgba(0, 31, 63, 0.75);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
}

.welcome-message h2 {
    color: white;
    margin-bottom: 12px;
    font-size: 22px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.welcome-message p {
    color: rgba(255, 255, 255, 0.98);
    margin-bottom: 10px;
    line-height: 1.5;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.welcome-message ul {
    text-align: left;
    display: inline-block;
    margin: 15px 0;
}

.welcome-message li {
    color: rgba(255, 255, 255, 0.98);
    margin: 6px 0;
    padding-left: 8px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.example {
    background: rgba(0, 0, 0, 0.35);
    padding: 10px 16px;
    border-radius: 8px;
    font-style: italic;
    color: rgba(255, 255, 255, 0.95);
    margin-top: 15px !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease-in;
}

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

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-assistant {
    display: flex;
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 10px 16px;
    border-radius: 16px;
    line-height: 1.4;
    word-wrap: break-word;
    transition: opacity 0.4s ease;
}

.message-user .message-content {
    background: rgba(0, 31, 63, 0.8);
    color: white;
    border-bottom-right-radius: 4px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.message-assistant .message-content {
    background: rgba(0, 31, 63, 0.85);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-bottom-left-radius: 4px;
    backdrop-filter: blur(15px);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    position: relative;
    padding-right: 45px;
}

.message-assistant .message-content pre {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.message-assistant .message-content code {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
}

.message-assistant .message-content pre code {
    background: transparent;
    color: white;
    padding: 0;
}

.message-assistant .message-content strong {
    color: #fff;
    font-weight: 700;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
    letter-spacing: 0.3px;
}

.message-assistant .message-content ul,
.message-assistant .message-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.message-assistant .message-content li {
    margin: 5px 0;
}

.copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    padding: 0;
    opacity: 0.8;
}

.copy-button:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.copy-button:active {
    transform: scale(0.95);
}

.copy-button.copied {
    background: rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

.copy-button svg {
    pointer-events: none;
}

.thinking-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: rgba(0, 31, 63, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 18px;
    max-width: fit-content;
    color: white;
    backdrop-filter: blur(15px);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

.thinking-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.thinking-phrase {
    font-size: 14px;
    font-style: italic;
    text-align: center;
    transition: opacity 0.3s ease;
    min-height: 20px;
    color: white;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.history-container {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.history-toggle {
    width: 100%;
    padding: 8px 12px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.history-toggle:hover {
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.05);
}

.toggle-icon {
    font-size: 10px;
    transition: transform 0.3s ease;
}

.history-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    padding: 0 12px;
}

.history-container.open .history-list {
    max-height: 150px;
    padding: 8px 12px;
}

.history-item {
    padding: 6px 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
    padding-left: 8px;
    transform: translateX(2px);
}

.history-item:last-child {
    border-bottom: none;
}

.input-container {
    position: sticky;
    top: 0;
    z-index: 9;
    padding: 15px 25px;
    background: rgba(0, 31, 63, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    transition: all 0.4s ease;
}

.container.thinking .input-container {
    background: rgba(0, 31, 63, 0.1);
    backdrop-filter: blur(5px);
}

.container.thinking .message-content {
    opacity: 0.6;
}

.container.thinking .welcome-message {
    opacity: 0.5;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: white;
    padding: 12px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.chat-form {
    display: flex;
    gap: 12px;
}

#userInput {
    flex: 1;
    padding: 14px 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    font-size: 15px;
    outline: none;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

#userInput::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#userInput:focus {
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.25);
}

#userInput:disabled {
    background: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    opacity: 0.5;
}

#sendButton {
    width: 50px;
    height: 50px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#sendButton:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

#sendButton:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.error-message {
    background: rgba(255, 100, 100, 0.3);
    color: white;
    padding: 12px 18px;
    border-radius: 8px;
    margin: 10px 0;
    border: 1px solid rgba(255, 100, 100, 0.5);
    border-left: 4px solid rgba(255, 100, 100, 0.8);
    backdrop-filter: blur(10px);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }

    .container {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        border-left: none;
        background: rgba(255, 255, 255, 0.08);
    }

    body::before {
        background: rgba(0, 31, 63, 0.5);
    }

    .header {
        background: rgba(0, 31, 63, 0.3);
        padding: 12px 15px;
    }

    .header h1 {
        font-size: 18px;
    }

    .header-toggle {
        width: 28px;
        height: 28px;
    }

    .stats-bar {
        flex-direction: column;
        gap: 6px;
    }

    .mode-selector {
        gap: 8px;
        margin-top: 10px;
    }

    .mode-btn {
        padding: 6px 12px;
        font-size: 13px;
    }

    .mode-icon {
        font-size: 14px;
    }

    .message-content {
        max-width: 85%;
    }

    .message-assistant .message-content {
        background: rgba(0, 31, 63, 0.9);
    }

    .message-user .message-content {
        background: rgba(0, 31, 63, 0.85);
    }

    .welcome-message {
        background: rgba(0, 31, 63, 0.85);
        padding: 20px;
    }

    .copy-button {
        width: 28px;
        height: 28px;
        top: 6px;
        right: 6px;
    }

    .copy-button svg {
        width: 14px;
        height: 14px;
    }

    .chat-container {
        padding: 12px 15px 60px 15px;
        min-height: 40vh;
    }

    .input-container {
        padding: 10px 15px;
        background: rgba(0, 31, 63, 0.35);
    }

    #userInput {
        font-size: 16px;
        padding: 12px 18px;
    }

    #sendButton {
        width: 44px;
        height: 44px;
    }
}
