/* Reset i podstawy */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.dark-theme {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f1f5f9;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

#app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
#chat-header {
    padding: 20px 0;
    margin-bottom: 20px;
}

.model-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.model-pill {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 12px 24px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 16px;
}

.clear-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.clear-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
}

.text-cyan {
    color: #06b6d4;
}

.text-purple {
    color: #a78bfa;
}

.text-emerald {
    color: #34d399;
}

/* Chat Box */
#chat-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.gradient-text {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #06b6d4 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 40px;
}

/* Suggestion Tiles */
.suggestion-tiles {
    display: flex;
    justify-content: center;
    gap: 16px;
    width: 100%;
    max-width: 400px;
    margin-top: 20px;
}

.suggestion-tile {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    font-size: 14px;
}

.suggestion-tile:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
}

.suggestion-tile i {
    font-size: 24px;
}

/* Messages Container */
#messages-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 0;
    overflow-y: auto;
}

.message {
    display: flex;
    flex-direction: column;
}

.user-message .message-content {
    margin-left: auto;
    max-width: 80%;
}

.bot-message .message-content {
    margin-right: auto;
    max-width: 90%;
}

.message-content {
    margin: 12px 0;
    padding: 16px;
    border-radius: 12px;
    color: #ffffff;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.6;
}

.message-content i {
    margin-top: 2px;
    flex-shrink: 0;
}

.message-content .text {
    flex: 1;
    overflow-wrap: break-word;
}

/* Styling dla Markdown w wiadomościach */
.message-content .text h1,
.message-content .text h2,
.message-content .text h3,
.message-content .text h4 {
    margin-top: 1em;
    margin-bottom: 0.5em;
    font-weight: 600;
    color: #06b6d4;
}

.message-content .text h1 { font-size: 1.5em; }
.message-content .text h2 { font-size: 1.3em; }
.message-content .text h3 { font-size: 1.1em; }
.message-content .text h4 { font-size: 1em; }

.message-content .text p {
    margin-bottom: 0.8em;
}

.message-content .text ul,
.message-content .text ol {
    margin-left: 1.5em;
    margin-bottom: 0.8em;
}

.message-content .text li {
    margin-bottom: 0.4em;
}

.message-content .text strong {
    font-weight: 600;
    color: #06b6d4;
}

.message-content .text a {
    color: #06b6d4;
    text-decoration: none;
    border-bottom: 1px solid #06b6d4;
}

.message-content .text a:hover {
    color: #0891b2;
    border-bottom-color: #0891b2;
}

.message-content .text code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.message-content .text pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 0.8em;
}

.message-content .text pre code {
    background: none;
    padding: 0;
}

.message-content .text hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin: 1em 0;
}

.message-content .text blockquote {
    border-left: 3px solid #06b6d4;
    padding-left: 1em;
    margin-left: 0;
    margin-bottom: 0.8em;
    opacity: 0.9;
}

/* Input Area */
#input-wrapper {
    position: sticky;
    bottom: 0;
    background: transparent;
    padding: 20px 0;
}

#input-container {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 12px;
    border-radius: 24px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.icon-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #06b6d4;
}

.textarea-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

textarea {
    flex: 1;
    background: transparent;
    color: white;
    border: none;
    outline: none;
    resize: none;
    font-size: 16px;
    line-height: 1.5;
    max-height: 150px;
    overflow-y: auto;
    font-family: inherit;
}

textarea::placeholder {
    color: #64748b;
}

.send-btn {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    border: none;
    color: white;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.send-btn:hover:not(.disabled) {
    background: linear-gradient(135deg, #0891b2 0%, #06b6d4 100%);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

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

.glass-panel {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(6, 182, 212, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(6, 182, 212, 0.7);
}

/* Responsive */
@media (max-width: 768px) {
    .gradient-text {
        font-size: 1.8rem;
    }

    .suggestion-tiles {
        flex-direction: column;
    }

    .user-message .message-content,
    .bot-message .message-content {
        max-width: 90%;
    }
    
    .model-selector {
        flex-direction: column;
        gap: 12px;
    }
}

/* Real-time Processing Steps */
.progress-container {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
    font-family: inherit;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.progress-title {
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   THREE DOTS ANIMATION
   ============================================ */

.animated-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 6px;
    vertical-align: middle;
}

.animated-dots span {
    width: 5px;
    height: 5px;
    background: #06b6d4;
    border-radius: 50%;
    display: inline-block;
    animation: dot-bounce 1.4s infinite ease-in-out both;
}

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

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

.animated-dots span:nth-child(3) {
    animation-delay: 0s;
}

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