/* ============================================================================
   MAIZ Chat - Estilos Globais
   ============================================================================ */

/* Variáveis de Cores */
:root {
    --primary: #ec6609;
    --primary-dark: #d45500;
    --secondary: #cecdcb;
    --tertiary: #2d2d2d;
    --background-dark: #1a1a1a;
    --background-card: #252525;
    --text-light: #ffffff;
    --text-muted: #888888;
    --success: #4ade80;
    --error: #ef4444;
}

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

body {
    font-family: 'Space Grotesk', sans-serif;
    background: linear-gradient(135deg, var(--background-dark) 0%, #252525 100%);
    min-height: 100vh;
    color: var(--text-light);
}

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

::-webkit-scrollbar-track {
    background: var(--tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

/* ============================================================================
   Toast Notifications
   ============================================================================ */

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.error {
    background: var(--error);
}

.toast.success {
    background: var(--success);
    color: var(--background-dark);
}


/* ============================================================================
   HOME PAGE
   ============================================================================ */

.home-container {
    display: flex;
    min-height: 100vh;
}

/* Lado Esquerdo - Imagem de Fundo */
.home-left {
    flex: 0 0 20%;
    background-image: url('/static/Fundo.png');
    background-size: contain;
    background-position: left center;
    background-repeat: no-repeat;
    background-color: #1a1a1a;
    min-height: 100vh;
}

.home-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    background-color: #1a1a1a;
}

/* Header da Home */
.home-header {
    text-align: center;
    margin-bottom: 3rem;
}

.home-logo {
    width: 200px;
    height: auto;
    margin-bottom: 1.5rem;
}

.home-title {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8c42 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.home-subtitle {
    font-size: 1.25rem;
    color: var(--secondary);
    font-weight: 300;
}

/* Cards Container */
.cards-container {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.5rem;
    width: 100%;
    max-width: 900px;
    justify-content: center;
}

/* IA Card */
.ia-card {
    background: linear-gradient(145deg, var(--tertiary) 0%, #1f1f1f 100%);
    border-radius: 24px;
    padding: 2rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    flex: 1 1 350px;
    max-width: 420px;
    min-width: 300px;
}

.ia-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(236, 102, 9, 0.1), transparent);
    transition: left 0.5s;
}

.ia-card:hover {
    border-color: var(--primary);
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(236, 102, 9, 0.2);
}

.ia-card:hover::before {
    left: 100%;
}

.ia-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.ia-card-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    box-shadow: 0 4px 15px rgba(236, 102, 9, 0.3);
}

.ia-card-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.ia-card-description {
    font-size: 1rem;
    color: var(--secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.ia-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tag {
    background: #3d2a1a;
    color: var(--primary);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.ia-card-button {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
    border: none;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(236, 102, 9, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ia-card-button:hover {
    box-shadow: 0 8px 25px rgba(236, 102, 9, 0.4);
}

/* Footer */
.home-footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 2rem;
}


/* ============================================================================
   CHAT PAGE
   ============================================================================ */

.chat-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: linear-gradient(145deg, var(--tertiary) 0%, #1f1f1f 100%);
    border-bottom: 1px solid rgba(236, 102, 9, 0.2);
    flex-shrink: 0;
}

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

.back-btn {
    background: transparent;
    border: 2px solid var(--secondary);
    color: var(--secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.back-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-icon {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-subtitle {
    font-size: 0.8rem;
    color: var(--secondary);
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success);
    font-size: 0.9rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); 
    }
    50% { 
        opacity: 0.8; 
        box-shadow: 0 0 0 10px rgba(74, 222, 128, 0); 
    }
}

/* Chat Container */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem;
    overflow: hidden;
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: linear-gradient(145deg, var(--tertiary) 0%, #1f1f1f 100%);
    border-radius: 20px;
    margin-bottom: 1rem;
}

/* Messages */
.message {
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 85%;
    animation: fadeInUp 0.3s ease-out;
    word-wrap: break-word;
}

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

.message-user {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
    border-radius: 18px 18px 4px 18px;
    margin-left: auto;
    box-shadow: 0 4px 15px rgba(236, 102, 9, 0.3);
}

.message-assistant {
    background: linear-gradient(145deg, #3a3a3a 0%, #2a2a2a 100%);
    color: var(--text-light);
    border-radius: 18px 18px 18px 4px;
    border-left: 4px solid var(--primary);
}

.message-error {
    background: linear-gradient(145deg, #4a2020 0%, #3a1a1a 100%);
    color: #fca5a5;
    border-left-color: var(--error);
}

.message-time {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.5);
    margin-top: 0.5rem;
}

.message-user .message-time {
    text-align: right;
}

/* Message Content */
.message-content p {
    margin: 0.5rem 0;
}

.message-content ul, 
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin: 0.3rem 0;
}

.message-content a {
    color: var(--primary);
    text-decoration: none;
}

.message-content a:hover {
    text-decoration: underline;
}

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

.message-content pre {
    background: rgba(0,0,0,0.4);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

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

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 1rem 1.25rem;
    background: linear-gradient(145deg, #3a3a3a 0%, #2a2a2a 100%);
    border-radius: 18px;
    border-left: 4px solid var(--primary);
    max-width: 80px;
    margin: 1rem 0;
}

.typing-indicator.show {
    display: block;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    margin: 0 2px;
    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%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-10px); }
}

/* Input Area */
.input-area {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(145deg, var(--tertiary) 0%, #1f1f1f 100%);
    border-radius: 16px;
    flex-shrink: 0;
    align-items: flex-end;
}

/* Botão de anexo */
.attach-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background: var(--background-dark);
    border: 2px solid var(--tertiary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--secondary);
    flex-shrink: 0;
}

.attach-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(236, 102, 9, 0.1);
}

.file-input-hidden {
    display: none;
}

/* Preview do arquivo */
.file-preview {
    display: none;
    padding: 0.75rem 1rem;
    background: rgba(236, 102, 9, 0.1);
    border: 1px solid var(--primary);
    border-radius: 12px;
    margin-bottom: 0.5rem;
}

.file-preview.show {
    display: block;
}

.file-preview-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-preview-icon {
    font-size: 1.25rem;
}

.file-preview-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-preview-remove {
    background: transparent;
    border: none;
    color: var(--secondary);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.file-preview-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

/* Indicador de arquivo na mensagem */
.message-file {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

.message-input {
    flex: 1;
    background: var(--background-dark);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-light);
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    min-height: 50px;
    max-height: 150px;
    transition: all 0.3s ease;
}

.message-input:focus {
    outline: none;
    border-color: var(--primary);
}

.message-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
    border: none;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(236, 102, 9, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.send-btn:hover:not(:disabled) {
    box-shadow: 0 8px 25px rgba(236, 102, 9, 0.4);
    transform: translateY(-2px);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 2rem;
}

.welcome-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.welcome-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.welcome-text {
    color: var(--secondary);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}


/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 992px) {
    .home-left {
        display: none;
    }
    
    .home-right {
        flex: 1;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .home-title {
        font-size: 2rem;
    }

    .home-right {
        padding: 1.5rem;
    }

    .cards-container {
        flex-direction: column;
        align-items: center;
    }

    .ia-card {
        max-width: 100%;
        min-width: unset;
        width: 100%;
    }

    .chat-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .chat-container {
        padding: 1rem;
    }

    .message {
        max-width: 95%;
    }

    .send-btn span {
        display: none;
    }

    .send-btn {
        padding: 1rem;
    }
}