/* Shared AI Studio Styles */
.agent-layout {
    display: flex;
    height: calc(100vh - 80px); /* Adjust based on navbar */
    background: #fdfdfd;
    overflow: hidden;
    margin: -1rem; /* Counteract default page padding if any */
}

/* Sidebar */
.agent-sidebar {
    width: 280px;
    background: #1e293b;
    color: white;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    border-right: 1px solid #334155;
}

.sidebar-header {
    margin-bottom: 2rem;
}

.sidebar-history {
    flex: 1;
    overflow-y: auto;
}

.history-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #94a3b8;
    margin: 1.5rem 0 0.5rem 0;
    letter-spacing: 0.05em;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.history-item.active {
    background: rgba(255, 255, 255, 0.15);
}

.history-item.dimmed {
    opacity: 0.6;
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid #334155;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.85rem;
}

.user-status {
    font-size: 0.7rem;
    color: #4ade80;
}

/* Main Area */
.agent-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    position: relative;
}

.agent-header {
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
}

.agent-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Message Bubbles */
.message-row {
    display: flex;
    width: 100%;
}

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

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

.message-bubble {
    max-width: 80%;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    font-size: 0.95rem;
    line-height: 1.6;
}

.message-row.user .message-bubble {
    background: var(--rz-primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-row.assistant .message-bubble {
    background: white;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
    padding-left: 3rem;
}

.bubble-icon {
    position: absolute;
    left: 0.75rem;
    top: 1rem;
    color: var(--rz-primary);
}

/* Code Blocks */
.code-block {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: 12px;
    padding: 0;
    margin: 1rem 0;
    overflow: hidden;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 0.85rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid #334155;
}

.code-header {
    background: #1e293b;
    padding: 0.5rem 1rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #334155;
}

.code-block code {
    display: block;
    padding: 1.25rem;
    overflow-x: auto;
    white-space: pre;
    line-height: 1.5;
}

code:not(.code-block code) {
    background: rgba(var(--rz-primary-rgb), 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: monospace;
    color: var(--rz-primary);
    font-weight: 600;
}

.message-row.user code:not(.code-block code) {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.bubble-meta {
    font-size: 0.7rem;
    margin-top: 0.5rem;
    opacity: 0.7;
    text-align: right;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #cbd5e1;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.2); opacity: 1; }
}

/* Footer */
.agent-footer {
    padding: 1.5rem 2rem;
    background: transparent;
}

.input-container.glass {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.chat-input {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 1rem;
    padding: 0.75rem !important;
    flex: 1;
    min-height: 50px !important;
    max-height: 200px !important;
    color: #1e293b;
}

.chat-input::placeholder {
    color: #94a3b8;
}

.input-actions {
    padding-bottom: 0.25rem;
    padding-right: 0.25rem;
}

.send-btn {
    border-radius: 12px !important;
}

.footer-hint {
    text-align: center;
    font-size: 0.7rem;
    color: #94a3b8;
    margin-top: 0.75rem;
}

.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    opacity: 0.7;
}

.builder-icon-lg, .ui-icon-lg {
    font-size: 5rem;
    margin-bottom: 1rem;
}
