/* ============================================
   SOPHIA - Estilos Principais
   Dashboard moderno estilo ChatGPT
   ============================================ */

:root {
    --primary-color: #10a37f;
    --primary-hover: #0d8f6e;
    --secondary-color: #6b7280;
    --danger-color: #ef4444;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-sidebar: #202123;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.6;
}

/* ============================================
   AUTENTICAÇÃO
   ============================================ */

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-box {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    font-size: 32px;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.auth-form {
    margin-top: 30px;
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */

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

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    color: #ffffff;
}

.sidebar-content {
    flex: 1;
    padding: 20px;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h3 {
    font-size: 14px;
    color: var(--text-light);
    text-transform: uppercase;
    margin-bottom: 12px;
    font-weight: 600;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.chat-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-item {
    padding: 12px;
    border-radius: 6px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    transition: background-color 0.2s;
    display: block;
}

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

.chat-item-name {
    font-size: 14px;
    margin-bottom: 4px;
}

.chat-item-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.logout-link {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 12px;
}

.logout-link:hover {
    color: #ffffff;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 40px;
    max-width: 1200px;
    width: 100%;
}

/* ============================================
   PÁGINAS
   ============================================ */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
}

.welcome-screen {
    text-align: center;
    padding: 60px 20px;
}

.welcome-screen h1 {
    font-size: 36px;
    margin-bottom: 16px;
}

.welcome-screen p {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.action-card {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.action-card h3 {
    font-size: 20px;
    margin-bottom: 8px;
}

.action-card p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */

.form {
    background: var(--bg-primary);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    max-width: 800px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 12px;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
}

/* ============================================
   BOTÕES
   ============================================ */

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

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

.btn-secondary {
    background-color: #6b7280;
    color: #ffffff;
    border: 1px solid #6b7280;
}

.btn-secondary:hover {
    background-color: #4b5563;
    border-color: #4b5563;
}

.btn-danger {
    background-color: var(--danger-color);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ============================================
   ALERTAS
   ============================================ */

.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

/* ============================================
   CARDS E GRID
   ============================================ */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.card {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    background-color: var(--bg-secondary);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    background-color: var(--primary-color);
    color: #ffffff;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-right: 6px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 16px;
}

.info-box {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.info-box h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #1e40af;
}

.info-box ul {
    list-style-position: inside;
    color: #1e40af;
}

.info-box li {
    margin-bottom: 8px;
    font-size: 14px;
}

.description {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

.content-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.content-item:last-child {
    border-bottom: none;
}

.content-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.content-text {
    margin-bottom: 8px;
    line-height: 1.6;
}

.content-date {
    font-size: 12px;
    color: var(--text-light);
}

.text-muted {
    color: var(--text-secondary);
}

/* ============================================
   CHAT INTERFACE (Estilo ChatGPT)
   ============================================ */

.chat-container {
    display: flex;
    min-height: 100vh;
    background-color: #343541;
}

.chat-sidebar {
    width: 260px;
    background-color: #202123;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-new-chat {
    width: 100%;
    padding: 12px;
    background-color: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-new-chat:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.chat-history {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
}

.chat-history-item {
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    transition: background-color 0.2s;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

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

.chat-title {
    font-size: 14px;
    font-weight: 500;
}

.chat-date {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.empty-history {
    padding: 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
}

.ai-info {
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 14px;
}

.ai-info strong {
    display: block;
    margin-bottom: 8px;
}

.badge-small {
    display: inline-block;
    padding: 2px 6px;
    background-color: rgba(16, 163, 127, 0.2);
    color: #10a37f;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 4px;
    margin-right: 4px;
}

.chat-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #343541;
    color: #ffffff;
}

/* Tela de boas-vindas */
.chat-welcome {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.welcome-content {
    max-width: 700px;
    text-align: center;
}

.welcome-icon {
    margin: 0 auto 24px;
    color: #10a37f;
}

.welcome-content h1 {
    font-size: 32px;
    margin-bottom: 12px;
    color: #ffffff;
}

.welcome-content p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 40px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 40px;
}

.suggestion-card {
    padding: 16px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.suggestion-card:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.suggestion-card span:first-child {
    font-size: 20px;
}

/* Área de mensagens */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message-wrapper {
    display: flex;
    gap: 10px;
    max-width: 85%;
    opacity: 0;
    animation: fadeInMessage 0.3s forwards;
    align-items: flex-start;
}

.message-wrapper.message-visible {
    opacity: 1;
}

/* Mensagens do usuário à direita */
.message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
    padding-left: 10%;
}

/* Mensagens da IA à esquerda */
.message-assistant {
    align-self: flex-start;
    flex-direction: row;
    margin-right: auto;
    padding-right: 10%;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
    margin-top: 4px;
}

.message-user .message-avatar {
    background-color: #10a37f;
}

.message-assistant .message-avatar {
    background-color: #5436da;
}

.message-content-wrapper {
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
    flex: 1;
}

.message-content {
    font-size: 15px;
    line-height: 1.5;
    color: #ffffff;
    word-wrap: break-word;
    white-space: pre-wrap;
    padding: 10px 14px;
    border-radius: 16px;
    word-break: break-word;
    text-align: left;
}

/* Estilo diferente para mensagens do usuário */
.message-user .message-content {
    background-color: #10a37f;
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Estilo diferente para mensagens da IA */
.message-assistant .message-content {
    background-color: #444654;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.message-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 0 4px;
}

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

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

.message-content-wrapper:hover .message-actions {
    opacity: 1;
}

.action-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    padding: 0 4px;
}

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

.message-assistant .message-time {
    text-align: left;
}

.typing-indicator {
    opacity: 1;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    animation: typingDot 1.4s infinite;
}

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

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

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

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

/* Input Area */
.chat-input-container {
    padding: 24px;
    background-color: #343541;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.input-wrapper {
    max-width: 768px;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background-color: #40414f;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 12px 16px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
}

.input-wrapper:focus-within {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(16, 163, 127, 0.2);
}

.input-wrapper textarea {
    flex: 1;
    border: none;
    background: transparent;
    resize: none;
    font-size: 16px;
    font-family: inherit;
    color: #ffffff;
    max-height: 200px;
    padding: 0;
    line-height: 1.5;
}

.input-wrapper textarea::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.input-wrapper textarea:focus {
    outline: none;
}

.input-footer {
    max-width: 768px;
    margin: 8px auto 0;
    text-align: center;
}

.input-footer small {
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

.btn-send {
    background-color: var(--primary-color);
    color: #ffffff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-send:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

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

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

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

@media (max-width: 768px) {
    .sidebar,
    .chat-sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }
    
    .main-content,
    .chat-main {
        margin-left: 0;
        padding: 20px;
    }
    
    .message-wrapper {
        max-width: 85%;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
    }
    
    .chat-messages {
        padding: 12px 16px;
    }
    
    .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .message-wrapper {
        max-width: 90%;
        gap: 8px;
    }
    
    .message-content {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .chat-messages {
        padding: 8px 12px;
    }
}

