@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&display=swap');

:root {
    --primary-color: #00b4d8;
    --primary-dark: #0096c7;
    --primary-light: #90e0ef;
    --secondary-color: #48cae4;
    --accent-color: #ff5a5f;
    --dark-bg: #121212;
    --dark-surface: #1e1e1e;
    --mid-gray: #292929;
    --light-gray: #333333;
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --text-disabled: #909090;
    --user-msg-bg: #0096c7;
    --ai-msg-bg: #1e1e1e;
    --code-bg: #2a2f38;
    --code-color: #e6e6e6;
    --code-comment: #6a9955;
    --code-keyword: #569cd6;
    --code-string: #ce9178;
    --code-variable: #9cdcfe;
    --code-function: #dcdcaa;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --tooltip-bg: rgba(0, 0, 0, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Vazirmatn', sans-serif;
}

body {
    direction: rtl;
    background-color: var(--dark-bg);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(0, 180, 216, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(72, 202, 228, 0.1) 0%, transparent 50%);
}

.container {
    width: 100vw;
    max-width: 100%;
    margin: 0 auto;
    padding: 10px;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 5px;
    padding: 2px;
    position: relative;
}

header h1 {
    color: var(--text-primary);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0;
    text-shadow: 0 2px 10px rgba(0, 180, 216, 0.3);
}

.geekscode-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 3px;
}

.geekscode-logo img {
    height: 30px;
    margin-left: 8px;
}

.geekscode-logo span {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

.chat-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: calc(95vh - 25px);
    background-color: var(--dark-surface);
    border-radius: 16px;
    box-shadow: 0 10px 30px var(--shadow-color);
    overflow: hidden;
    border: 1px solid var(--light-gray);
    width: 100%;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 25px;
    scroll-behavior: smooth;
    background-image: 
        linear-gradient(rgba(18, 18, 18, 0.7) 1px, transparent 1px),
        linear-gradient(90deg, rgba(18, 18, 18, 0.7) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center center;
}

.chat-box::-webkit-scrollbar {
    width: 8px;
}

.chat-box::-webkit-scrollbar-track {
    background: var(--dark-bg);
    border-radius: 4px;
}

.chat-box::-webkit-scrollbar-thumb {
    background: var(--primary-dark);
    border-radius: 4px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

.message-wrapper {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message, .ai-message {
    display: flex;
    max-width: 80%;
    border-radius: 16px;
    padding: 12px 16px;
    margin-bottom: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    position: relative;
}

.user-message {
    align-self: flex-end;
    background-color: var(--user-msg-bg);
    margin-left: auto;
    border-bottom-left-radius: 4px;
}

.ai-message {
    align-self: flex-start;
    background-color: var(--ai-msg-bg);
    margin-right: auto;
    border-bottom-right-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-primary);
    margin-top: 4px;
    text-align: left;
    font-weight: 500;
    letter-spacing: 0.5px;
    opacity: 0.8;
    position: relative;
    bottom: 0;
    display: block;
    width: 100%;
}

.user-message .message-time {
    text-align: right;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    background-color: var(--primary-dark);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.user-message .avatar {
    order: 0;
    margin-left: 12px;
    margin-right: 0;
    background-color: var(--accent-color);
}

.ai-message .avatar {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
}

.avatar i {
    font-size: 1.2rem;
}

.message {
    flex: 1;
}

.message p {
    margin: 0 0 10px 0;
    white-space: pre-wrap;
    line-height: 1.5;
}

/* Style for inline code (text between backticks) */
.message p code {
    background-color: rgba(42, 47, 56, 0.7);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    color: var(--text-primary);
    font-weight: bold;
    display: inline;
    direction: ltr;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message p:last-of-type {
    margin-bottom: 0;
}

.thinking {
    display: flex;
    align-items: center;
    padding: 12px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Simple dot typing animation */
.thinking .dot {
    display: inline-block;
    opacity: 0.3;
    transition: opacity 0.15s ease;
    margin-right: 2px;
}

.input-container {
    display: flex;
    padding: 16px 20px;
    background-color: var(--mid-gray);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.input-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.2), transparent);
    pointer-events: none;
}

#userInput {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid var(--light-gray);
    background-color: var(--dark-surface);
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 1rem;
    resize: none;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

#userInput:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2);
}

#userInput::placeholder {
    color: var(--text-disabled);
}

.send-button {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    width: 50px;
    height: 50px;
    margin-right: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 180, 216, 0.3);
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 180, 216, 0.4);
}

.send-button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0, 180, 216, 0.2);
}

.send-button:disabled {
    background: linear-gradient(135deg, #666, #777);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.send-button i {
    font-size: 1.2rem;
}

.hidden {
    display: none;
}

/* For code blocks in AI responses */
pre {
    background-color: var(--code-bg);
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    direction: ltr;
    text-align: left;
    margin: 12px 0;
    position: relative;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

pre::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px 8px 0 0;
    z-index: 1;
}

pre::after {
    content: '• • •';
    position: absolute;
    top: 0;
    left: 15px;
    height: 30px;
    line-height: 30px;
    color: rgba(255, 255, 255, 0.5);
    z-index: 2;
}

.copy-button {
    position: absolute;
    top: 5px;
    right: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 4px;
    color: var(--text-secondary);
    padding: 3px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 3;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mark processed code blocks */
pre.processed {
    position: relative;
}

code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--code-color);
    padding-top: 20px;
    display: block;
}

/* Syntax highlighting for code */
.hljs-keyword {
    color: var(--code-keyword);
}

.hljs-string {
    color: var(--code-string);
}

.hljs-comment {
    color: var(--code-comment);
}

.hljs-function {
    color: var(--code-function);
}

.hljs-variable {
    color: var(--code-variable);
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .user-message, .ai-message {
        max-width: 90%;
        padding: 10px 12px;
    }
    
    .avatar {
        width: 32px;
        height: 32px;
        margin-left: 8px;
    }
    
    .user-message .avatar {
        margin-right: 8px;
    }
    
    .input-container {
        padding: 12px 15px;
    }
    
    #userInput {
        padding: 12px 15px;
    }
    
    .send-button {
        width: 45px;
        height: 45px;
    }
    
    pre {
        padding: 12px;
        margin: 10px 0;
    }
    
    code {
        font-size: 0.8rem;
    }
}

/* Animation for messages */
@keyframes slideInRight {
    from { 
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInLeft {
    from { 
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.user-message {
    animation: slideInRight 0.3s ease forwards;
}

.ai-message {
    animation: slideInLeft 0.3s ease forwards;
}

/* Welcome animation */
.welcome-message {
    opacity: 0;
    animation: fadeInWelcome 1s ease forwards;
    animation-delay: 0.5s;
}

@keyframes fadeInWelcome {
    from { 
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer styles */
.footer {
    text-align: center;
    padding: 8px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    background-color: var(--mid-gray);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer a {
    color: var(--primary-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--primary-color);
    text-decoration: underline;
} 