/* ====================================================================
   KAYOS INTELLIGENCE - Interface Simbiótica Dark Neon Tech
   Sistema de cores baseado na identidade visual Kayos
   ==================================================================== */

:root {
    /* Cores da Logo Oficial Kayos */
    --kayos-blue-dark: #1a3a52;      /* Azul escuro principal da logo */
    --kayos-blue-medium: #2c5f7f;    /* Azul médio */
    --kayos-cyan: #5eb9d4;           /* Ciano claro da logo */
    --kayos-cyan-bright: #7dd4ed;    /* Ciano brilhante */
    --kayos-teal: #4a9fb5;           /* Verde-azulado */
    
    /* Backgrounds baseados na logo */
    --dark-bg: #0d1821;              /* Azul escuro profundo */
    --surface-bg: #152838;           /* Azul escuro médio */
    --card-bg: #1e3447;              /* Azul escuro card */
    
    /* Textos */
    --text-primary: #e8f4f8;         /* Azul muito claro */
    --text-secondary: #8bb4c9;       /* Azul acinzentado */
    
    /* Bordas e Sombras com cores da logo */
    --border-color: rgba(94, 185, 212, 0.3);
    --shadow-glow: 0 0 20px rgba(94, 185, 212, 0.25);
    
    /* Status */
    --success: #5eb9d4;
    --warning: #7dd4ed;
    --error: #d45e5e;
}

/* ====================================================================
   RESET E CONFIGURAÇÕES GLOBAIS
   ==================================================================== */

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

html, body { 
    height: 100%; 
    overflow: hidden; 
    font-family: 'Courier New', monospace;
}

body { 
    background: var(--dark-bg); 
    color: var(--text-primary); 
    display: flex; 
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(94, 185, 212, 0.08) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(42, 95, 127, 0.08) 0%, transparent 20%);
}

/* ====================================================================
   SCROLLBAR CUSTOMIZADA
   ==================================================================== */

::-webkit-scrollbar { 
    width: 6px; 
}

::-webkit-scrollbar-track { 
    background: var(--surface-bg); 
}

::-webkit-scrollbar-thumb { 
    background: #444; 
    border-radius: 3px; 
}

::-webkit-scrollbar-thumb:hover { 
    background: #555; 
}

/* ====================================================================
   LAYOUT PRINCIPAL
   ==================================================================== */

.app-container {
    display: flex;
    width: 100%;
    height: 100vh;
}

/* ====================================================================
   SIDEBAR DE FERRAMENTAS
   ==================================================================== */

.sidebar {
    width: 280px;
    background: var(--surface-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 15px rgba(94, 185, 212, 0.1);
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(94, 185, 212, 0.4);
    filter: drop-shadow(0 0 8px rgba(94, 185, 212, 0.3));
    animation: neon-pulse 2s ease-in-out infinite;
}

@keyframes neon-pulse {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(94, 185, 212, 0.4),
            0 0 30px rgba(94, 185, 212, 0.2),
            inset 0 0 10px rgba(94, 185, 212, 0.1);
        filter: drop-shadow(0 0 8px rgba(94, 185, 212, 0.3));
    }
    50% {
        box-shadow: 
            0 0 25px rgba(94, 185, 212, 0.8),
            0 0 50px rgba(94, 185, 212, 0.4),
            inset 0 0 15px rgba(94, 185, 212, 0.2);
        filter: drop-shadow(0 0 15px rgba(94, 185, 212, 0.6));
    }
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--kayos-cyan);
    text-shadow: 0 0 10px rgba(94, 185, 212, 0.5);
    letter-spacing: 0.5px;
    animation: text-glow 2s ease-in-out infinite;
}

@keyframes text-glow {
    0%, 100% {
        text-shadow: 
            0 0 10px rgba(94, 185, 212, 0.5),
            0 0 20px rgba(94, 185, 212, 0.2);
    }
    50% {
        text-shadow: 
            0 0 20px rgba(94, 185, 212, 0.8),
            0 0 30px rgba(94, 185, 212, 0.4),
            0 0 40px rgba(94, 185, 212, 0.2);
    }
}

.new-chat-button {
    width: calc(100% - 2rem);
    margin: 1rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--kayos-blue-medium), var(--kayos-cyan));
    border: none;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 0 15px rgba(94, 185, 212, 0.4);
}

.new-chat-button:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 0 20px rgba(94, 185, 212, 0.6); 
    background: linear-gradient(135deg, var(--kayos-cyan), var(--kayos-cyan-bright));
}

/* ====================================================================
   LISTA DE SESSÕES
   ==================================================================== */

.session-list { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 0 1rem;
}

.session-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-item:hover { 
    background: var(--card-bg); 
    border-color: var(--border-color);
}

.session-item.active { 
    background: rgba(94, 185, 212, 0.15); 
    color: var(--kayos-cyan); 
    font-weight: 700; 
    border-color: var(--kayos-cyan);
    box-shadow: 0 0 10px rgba(94, 185, 212, 0.25);
}

.session-title-text {
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.session-controls { 
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.session-item:hover .session-controls {
    opacity: 1;
}

.session-controls button { 
    background: none; 
    border: none; 
    color: var(--text-secondary); 
    cursor: pointer; 
    padding: 4px; 
    border-radius: 3px; 
    font-size: 0.8rem;
}

.session-controls button:hover { 
    background: var(--card-bg); 
    color: var(--kayos-cyan); 
}

/* ====================================================================
   FOOTER DA SIDEBAR
   ==================================================================== */

.sidebar-footer { 
    margin-top: auto; 
    padding: 1rem;
    border-top: 1px solid var(--border-color); 
}

.user-profile { 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}

.user-avatar { 
    width: 32px; 
    height: 32px; 
    background: var(--kayos-blue-medium); 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 700;
    color: var(--text-primary);
    box-shadow: 0 0 10px rgba(44, 95, 127, 0.5);
    font-size: 0.75rem;
}

.user-name { 
    font-weight: 700; 
    font-size: 0.85rem;
    flex: 1;
}

.logout-button {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-button:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--kayos-cyan);
    box-shadow: 0 0 5px var(--kayos-cyan);
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% {
        box-shadow: 0 0 5px var(--kayos-cyan);
    }
    50% {
        box-shadow: 
            0 0 10px var(--kayos-cyan),
            0 0 20px rgba(94, 185, 212, 0.5);
    }
}

.status-dot.offline {
    background: var(--text-secondary);
    box-shadow: 0 0 5px var(--text-secondary);
    animation: none;
}

.status-dot.processing {
    background: var(--kayos-cyan-bright);
    box-shadow: 0 0 5px var(--kayos-cyan-bright);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* ====================================================================
   ÁREA DE CHAT PRINCIPAL
   ==================================================================== */

.chat-wrapper { 
    flex-grow: 1; 
    display: flex; 
    flex-direction: column; 
    height: 100vh; 
}

.chat-header {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-bg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.chat-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--kayos-cyan);
}

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

.header-button {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    transition: all 0.2s;
}

.header-button:hover {
    background: var(--card-bg);
    color: var(--kayos-cyan);
    border-color: var(--kayos-cyan);
    box-shadow: 0 0 10px rgba(94, 185, 212, 0.25);
}

/* Botão de Toggle para Busca Web */
.toggle-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.toggle-button svg {
    transition: transform 0.3s ease;
}

.toggle-button.active {
    background: var(--kayos-blue-medium);
    color: var(--kayos-cyan-bright);
    border-color: var(--kayos-cyan);
    box-shadow: 0 0 15px rgba(94, 185, 212, 0.4);
}

.toggle-button.active svg {
    transform: rotate(180deg);
    filter: drop-shadow(0 0 5px var(--kayos-cyan));
}

.toggle-button.active #web-search-status {
    color: var(--kayos-cyan-bright);
    font-weight: bold;
    text-shadow: 0 0 8px rgba(125, 212, 237, 0.6);
}

.toggle-button:hover svg {
    transform: scale(1.1);
}

/* ====================================================================
   HISTÓRICO DE MENSAGENS
   ==================================================================== */

.chat-history { 
    flex-grow: 1; 
    overflow-y: auto; 
    padding: 2rem; 
    background: var(--dark-bg);
}

.message { 
    margin-bottom: 1.5rem; 
    max-width: 85%; 
    line-height: 1.6; 
    display: flex;
    gap: 12px;
}

.message.user { 
    margin-left: auto; 
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid transparent;
    position: relative;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.message .user-avatar { 
    background: var(--kayos-blue-medium); 
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(44, 95, 127, 0.6);
    border-color: rgba(44, 95, 127, 0.5);
}

.message .ai-avatar { 
    background: linear-gradient(135deg, var(--kayos-cyan), var(--kayos-cyan-bright)); 
    color: #fff;
    box-shadow: 0 0 15px rgba(94, 185, 212, 0.6);
    border-color: var(--kayos-cyan);
    animation: avatar-pulse 2s ease-in-out infinite;
}

@keyframes avatar-pulse {
    0%, 100% {
        box-shadow: 
            0 0 15px rgba(94, 185, 212, 0.6),
            0 0 25px rgba(94, 185, 212, 0.3);
        transform: scale(1);
    }
    50% {
        box-shadow: 
            0 0 25px rgba(94, 185, 212, 0.9),
            0 0 40px rgba(94, 185, 212, 0.5),
            0 0 60px rgba(94, 185, 212, 0.2);
        transform: scale(1.05);
    }
}

.message-content { 
    background: var(--card-bg); 
    padding: 1rem; 
    border-radius: 12px; 
    border: 1px solid var(--border-color); 
    flex-grow: 1;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.message.user .message-content {
    background: rgba(44, 95, 127, 0.2);
    border-color: rgba(94, 185, 212, 0.3);
}

.message-content p {
    margin: 0;
    line-height: 1.6;
}

/* === MELHORIAS MARKDOWN v3.0 - RENDERIZAÇÃO COMPLETA === */

/* Parágrafos e quebras */
.message-content p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.message-content p:first-child {
    margin-top: 0;
}

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

/* Texto em negrito - Destaque cyan */
.message-content strong {
    color: var(--kayos-cyan-bright);
    font-weight: 700;
}

/* Separadores horizontais */
.message-content hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1rem 0;
    opacity: 0.5;
}

/* Links clicáveis */
.message-content a {
    color: var(--kayos-cyan);
    text-decoration: none;
    border-bottom: 1px dotted var(--kayos-cyan);
    transition: all 0.2s;
}

.message-content a:hover {
    color: var(--kayos-cyan-bright);
    border-bottom-style: solid;
}

/* Itálico */
.message-content em {
    color: var(--text-secondary);
    font-style: italic;
}

/* Listas ordenadas e não ordenadas */
.message-content ul,
.message-content ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin: 0.4rem 0;
    line-height: 1.6;
}

.message-content ul li::marker {
    color: var(--kayos-cyan);
}

.message-content ol li::marker {
    color: var(--kayos-cyan);
    font-weight: 600;
}

/* Citações em bloco */
.message-content blockquote {
    border-left: 3px solid var(--kayos-cyan);
    padding-left: 1rem;
    margin: 1rem 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Cabeçalhos */
.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4 {
    color: var(--kayos-cyan-bright);
    margin: 1rem 0 0.5rem 0;
    font-weight: 700;
}

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

.message-content pre { 
    background: var(--surface-bg); 
    padding: 1rem; 
    border-radius: 6px; 
    overflow-x: auto; 
    font-family: 'Courier New', monospace; 
    white-space: pre-wrap; 
    position: relative; 
    margin-top: 10px; 
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.copy-button { 
    position: absolute; 
    top: 10px; 
    right: 10px; 
    background: var(--card-bg); 
    border: 1px solid var(--border-color); 
    color: var(--text-primary); 
    padding: 4px 8px; 
    border-radius: 4px; 
    cursor: pointer; 
    opacity: 0; 
    transition: opacity 0.2s; 
    font-size: 0.75rem;
    font-family: 'Courier New', monospace;
}

.message-content pre:hover .copy-button { 
    opacity: 1; 
}

/* ====================================================================
   ÁREA DE INPUT
   ==================================================================== */

.chat-input-container { 
    padding: 1.5rem 2rem; 
    border-top: 1px solid var(--border-color); 
    background: var(--surface-bg);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.chat-input-form { 
    display: flex; 
    gap: 1rem; 
    background: var(--card-bg); 
    border-radius: 12px; 
    padding: 0.75rem; 
    border: 1px solid var(--border-color); 
    align-items: flex-end;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

.chat-textarea { 
    flex-grow: 1; 
    background: transparent; 
    border: none; 
    color: var(--text-primary); 
    font-family: 'Courier New', monospace; 
    font-size: 1rem; 
    resize: none; 
    min-height: 60px; 
    max-height: 200px;
    line-height: 1.5;
}

.chat-textarea:focus { 
    outline: none; 
}

.chat-textarea::placeholder {
    color: var(--text-secondary);
}

.action-button { 
    background: transparent; 
    border: none; 
    color: var(--text-secondary); 
    cursor: pointer; 
    padding: 8px; 
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-button:hover { 
    color: var(--kayos-cyan); 
    background: var(--surface-bg);
}

.send-button { 
    background: var(--kayos-cyan); 
    border: none; 
    color: #fff; 
    width: 40px; 
    height: 40px; 
    border-radius: 8px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    transition: all 0.2s;
    font-weight: 700;
    box-shadow: 0 0 15px rgba(94, 185, 212, 0.5);
}

.send-button:hover { 
    background: var(--kayos-cyan-bright);
    box-shadow: 0 0 20px rgba(125, 212, 237, 0.7);
    transform: translateY(-1px);
}

.send-button:active {
    transform: translateY(0);
}

/* ====================================================================
   MODALS
   ==================================================================== */

.modal-overlay { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(10, 10, 10, 0.8); 
    backdrop-filter: blur(5px); 
    z-index: 2000; 
    justify-content: center; 
    align-items: center; 
}

.modal-content { 
    background: var(--surface-bg); 
    padding: 2rem; 
    border-radius: 12px; 
    border: 1px solid var(--border-color); 
    box-shadow: var(--shadow-glow); 
    width: 90%; 
    max-width: 450px; 
}

.modal-title { 
    margin: 0 0 20px 0; 
    color: var(--kayos-cyan);
    font-size: 24px;
    text-align: center;
}

.modal-input { 
    width: 100%; 
    padding: 0.75rem; 
    margin-bottom: 1.5rem; 
    background: var(--card-bg); 
    border: 1px solid var(--border-color); 
    border-radius: 6px; 
    color: var(--text-primary); 
    font-family: 'Courier New', monospace;
}

.modal-input:focus {
    outline: none;
    border-color: var(--kayos-cyan);
    box-shadow: 0 0 10px rgba(94, 185, 212, 0.2);
}

.modal-buttons { 
    display: flex; 
    justify-content: flex-end; 
    gap: 1rem; 
}

.modal-button { 
    padding: 0.6rem 1.2rem; 
    border: none; 
    border-radius: 6px; 
    cursor: pointer; 
    font-family: 'Courier New', monospace;
    font-weight: 700;
    transition: all 0.2s;
}

.modal-button.primary { 
    background: var(--kayos-cyan); 
    color: #fff; 
}

.modal-button.primary:hover {
    background: var(--kayos-cyan-bright);
    box-shadow: 0 0 10px rgba(125, 212, 237, 0.5);
}

.modal-button.secondary { 
    background: var(--card-bg); 
    color: var(--text-primary); 
    border: 1px solid var(--border-color);
}

.modal-button.secondary:hover {
    background: var(--surface-bg);
    border-color: var(--kayos-cyan);
}

/* ====================================================================
   RESPONSIVIDADE
   ==================================================================== */

@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }
    
    .chat-header, .chat-input-container {
        padding: 1rem;
    }
    
    .chat-history {
        padding: 1rem;
    }
    
    .message {
        max-width: 95%;
    }
    
    .logo-text {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .sidebar {
        position: absolute;
        left: -280px;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .chat-header {
        padding: 0.75rem 1rem;
    }
    
    .chat-title {
        font-size: 1rem;
    }
    
    .header-button {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
}

/* ====================================================================
   IMAGE GENERATOR STYLES
   ==================================================================== */

/* Botão Gerar Imagem na Sidebar */
.generate-image-button {
    width: 100%;
    padding: 0.9rem 1rem;
    margin: 0.5rem 0 1rem 0;
    background: linear-gradient(135deg, #2c5f7f 0%, #4a9fb5 100%);
    border: 1px solid var(--kayos-cyan);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(94, 185, 212, 0.3);
}

.generate-image-button:hover {
    background: linear-gradient(135deg, #4a9fb5 0%, #5eb9d4 100%);
    box-shadow: 0 4px 16px rgba(94, 185, 212, 0.5);
    transform: translateY(-2px);
}

.generate-image-button svg {
    flex-shrink: 0;
}

/* Modal de Imagem */
.image-modal {
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--surface-bg);
    z-index: 10;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-modal-btn:hover {
    background: var(--card-bg);
    color: var(--kayos-cyan);
}

/* Formulário de Imagem */
.image-form-container {
    padding: 1.5rem;
}

.image-form-section {
    margin-bottom: 1.5rem;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--kayos-cyan);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.image-prompt-textarea {
    width: 100%;
    padding: 1rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 100px;
    transition: all 0.3s ease;
}

.image-prompt-textarea:focus {
    outline: none;
    border-color: var(--kayos-cyan);
    box-shadow: 0 0 0 3px rgba(94, 185, 212, 0.2);
}

.image-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.image-select,
.image-input {
    width: 100%;
    padding: 0.9rem;
    background: var(--dark-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-select:focus,
.image-input:focus {
    outline: none;
    border-color: var(--kayos-cyan);
    box-shadow: 0 0 0 3px rgba(94, 185, 212, 0.2);
}

.image-select option {
    background: var(--dark-bg);
    color: var(--text-primary);
}

/* Ações de Geração */
.image-generate-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.generate-btn {
    width: 100%;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--kayos-cyan) 0%, var(--kayos-teal) 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(94, 185, 212, 0.4);
}

.generate-btn:hover:not(:disabled) {
    box-shadow: 0 6px 20px rgba(94, 185, 212, 0.6);
    transform: translateY(-2px);
}

.generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.generation-status {
    min-height: 24px;
    text-align: center;
}

/* Preview de Imagem */
.image-preview-container {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(13, 24, 33, 0.5);
}

.preview-title {
    font-size: 1rem;
    color: var(--kayos-cyan);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.image-preview-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.generated-image {
    width: 100%;
    border-radius: 8px;
    border: 2px solid var(--kayos-cyan);
    box-shadow: 0 8px 24px rgba(94, 185, 212, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.generated-image:hover {
    transform: scale(1.02);
    box-shadow: 0 12px 32px rgba(94, 185, 212, 0.5);
}

.image-info {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.image-info p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.image-info strong {
    color: var(--kayos-cyan);
}

.image-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.image-actions button {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Galeria de Imagens */
.image-gallery-container {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.gallery-title {
    font-size: 0.9rem;
    color: var(--kayos-cyan);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.image-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.gallery-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(94, 185, 212, 0.4);
    border-color: var(--kayos-cyan);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(13, 24, 33, 0.95), transparent);
    padding: 0.5rem 0.4rem 0.3rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-info {
    opacity: 1;
}

.gallery-style,
.gallery-quality {
    background: var(--kayos-cyan);
    color: var(--dark-bg);
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-weight: 600;
}

/* Responsividade do Image Generator */
@media (max-width: 768px) {
    .image-modal {
        max-width: 100%;
        width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }
    
    .image-options-grid {
        grid-template-columns: 1fr;
    }
    
    .image-preview-wrapper {
        grid-template-columns: 1fr;
    }
    
    .image-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}

/* ========================================
   PROMPT TEMPLATES - Minimalista
   ======================================== */
.prompt-templates {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.template-btn {
    background: rgba(94, 185, 212, 0.08);
    border: 1px solid rgba(94, 185, 212, 0.2);
    color: var(--kayos-cyan);
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
}

.template-btn:hover {
    background: rgba(94, 185, 212, 0.15);
    border-color: var(--kayos-cyan);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(94, 185, 212, 0.2);
}

.template-btn:active {
    transform: translateY(0);
}

/* ========================================
   PROGRESS BAR - Estilo GitHub/Linear
   ======================================== */
.progress-container {
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(94, 185, 212, 0.15);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, 
        var(--kayos-cyan), 
        rgba(94, 185, 212, 0.7),
        var(--kayos-cyan)
    );
    background-size: 200% 100%;
    animation: progressIndeterminate 1.5s ease-in-out infinite;
    border-radius: 2px;
}

@keyframes progressIndeterminate {
    0% {
        transform: translateX(-100%);
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        transform: translateX(100%);
        background-position: 0% 50%;
    }
}

.progress-text {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    letter-spacing: 0.5px;
}
