/* public/css/style.css */

/* --- ESTILOS GERAIS --- */
body { 
    background-color: #f4f6f9; 
    font-family: 'Segoe UI', sans-serif; 
    min-height: 100vh; 
}

/* --- PÁGINA DE LOGIN (ESTILOS MELHORADOS) --- */
.login-body { 
    background: url('https://images.unsplash.com/photo-1486406146926-c627a92ad1ab?q=80&w=2070&auto=format&fit=crop') no-repeat center center fixed; 
    background-size: cover; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
}

.login-card {
    background: rgba(255, 255, 255, 0.98) !important; /* Mais opaco */
    border-radius: 20px !important;
    backdrop-filter: blur(10px); /* Efeito de vidro */
    padding: 2.5rem !important;
}

.login-logo {
    width: 120px; 
    margin-bottom: 10px; 
    mix-blend-mode: multiply;
    filter: contrast(1.1);
}

/* Inputs do Login com estilo moderno */
.login-card .input-group-text {
    border-color: #e2e8f0;
    background-color: #f8fafc !important;
    border-radius: 10px 0 0 10px;
}

.login-card .form-control {
    border-color: #e2e8f0;
    background-color: #f8fafc !important;
    border-radius: 0 10px 10px 0;
    font-size: 0.95rem;
}

.login-card .form-control:focus {
    box-shadow: none;
    border-color: #3b82f6;
    background-color: #fff !important;
}
.login-card .form-control:focus + .input-group-text,
.login-card .input-group-text:has(+ .form-control:focus) {
    border-color: #3b82f6;
    background-color: #fff !important;
}

/* Botão Entrar */
.login-card .btn-primary {
    border-radius: 10px;
    padding: 12px;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: none;
}
.login-card .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
}

/* Botão Registar */
.login-card .btn-outline-secondary {
    border-radius: 10px;
    padding: 10px;
    border: 2px solid #e2e8f0;
    color: #64748b;
}
.login-card .btn-outline-secondary:hover {
    background-color: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

/* --- NAVBAR --- */
.navbar-custom { 
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); 
    padding: 0.8rem 1rem; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); 
}
.navbar-custom .navbar-brand { 
    font-weight: 700; 
    color: #f8fafc; 
    font-size: 1.2rem; 
    letter-spacing: 0.5px; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}
.navbar-custom .navbar-brand i { 
    color: #38bdf8; 
    font-size: 1.4rem; 
}

/* Logo Image Navbar */
.app-logo {
    height: 38px;
    margin-right: 8px;
    background-color: #ffffff;
    padding: 2px 4px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Container de Informação do Utilizador */
.user-info-container { 
    background: rgba(255,255,255,0.1); 
    padding: 0.4rem 1rem; 
    border-radius: 50px; 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    border: 1px solid rgba(255,255,255,0.1); 
}

.btn-logout { 
    background: #ef4444; 
    border: none; 
    color: white; 
    padding: 0.4rem 1rem; 
    border-radius: 20px; 
    font-size: 0.85rem; 
    font-weight: 600; 
    transition: all 0.2s; 
}
.btn-logout:hover { 
    background: #dc2626; 
    transform: translateY(-1px); 
    box-shadow: 0 4px 6px rgba(0,0,0,0.2); 
}

/* --- TABS DE NAVEGAÇÃO --- */
.nav-tabs { 
    border-bottom: none; 
    background: white; 
    padding: 0.5rem; 
    border-radius: 12px; 
    display: flex; 
    gap: 5px; 
    margin-bottom: 1.5rem; 
    overflow-x: auto; 
    box-shadow: 0 2px 4px rgba(0,0,0,0.02); 
}
.nav-tabs .nav-link { 
    border: none; 
    color: #64748b; 
    font-weight: 600; 
    border-radius: 8px; 
    padding: 0.7rem 1.2rem; 
    white-space: nowrap; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    transition: all 0.2s; 
}
.nav-tabs .nav-link:hover { 
    background-color: #f1f5f9; 
    color: #334155; 
}
.nav-tabs .nav-link.active { 
    background-color: #0f172a; 
    color: white; 
    box-shadow: 0 4px 6px rgba(15, 23, 42, 0.15); 
}
.nav-tabs .nav-link i { 
    font-size: 1.1rem; 
}

/* --- CARTÕES (CARDS) --- */
.card { 
    border: none; 
    border-radius: 12px; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.05); 
    transition: transform 0.2s; 
}
.card-clickable:hover { 
    transform: translateY(-5px); 
    cursor: pointer; 
    box-shadow: 0 8px 25px rgba(0,0,0,0.1); 
}
.card-header { 
    background: #fff; 
    padding: 1.2rem; 
    border-bottom: 1px solid #f0f0f0; 
    font-weight: 700; 
    color: #334155; 
}
.shadow-sm { box-shadow: 0 2px 4px rgba(0,0,0,0.05)!important; }
.hover-scale:hover { transform: scale(1.1); }

/* --- TABELAS GENÉRICAS --- */
.custom-table { 
    width: 100%; 
    margin-bottom: 0; 
    border-collapse: collapse; 
}
.custom-table th { 
    background: #f8f9fa; 
    color: #64748b; 
    font-size: 0.75rem; 
    text-transform: uppercase; 
    padding: 1rem; 
    border-bottom: 1px solid #e2e8f0; 
    letter-spacing: 0.5px; 
    font-weight: 700; 
}
.custom-table td { 
    padding: 1rem; 
    vertical-align: middle; 
    border-bottom: 1px solid #f1f5f9; 
    color: #475569; 
    font-size: 0.9rem; 
}
.custom-table tr:hover td { 
    background-color: #f8fafc; 
}

/* --- MAPAS FINANCEIROS E QUOTAS --- */
.mapa-table th, .mapa-table td { 
    text-align: center; 
    white-space: nowrap; 
    font-size: 0.8rem; 
    padding: 8px; 
    border: 1px solid #e2e8f0; 
}
.mapa-table thead th { 
    background: #f1f5f9; 
    color: #475569; 
    vertical-align: middle; 
    font-weight: 700; 
}

/* Cores de Estado */
.bg-pago { background-color: #dcfce7; color: #166534; font-weight: bold; }
.bg-parcial { background-color: #fef9c3; color: #854d0e; }
.bg-divida { background-color: #fff; color: #ef4444; }

/* Cores do Mapa Financeiro */
.bg-rec-header { background-color: #dcfce7; color: #166534; font-weight:bold; text-align:left; padding-left:15px !important; }
.bg-desp-header { background-color: #fee2e2; color: #991b1b; font-weight:bold; text-align:left; padding-left:15px !important; }
.bg-saldo-header { background-color: #dbeafe; color: #1e40af; font-weight:bold; text-align:left; padding-left:15px !important; }
.bg-saldo-caixa { background-color: #fef9c3; color: #854d0e; font-weight: bold; } 
.bg-saldo-banco { background-color: #dbeafe; color: #1e40af; font-weight: bold; }

.text-amount { font-family: 'Consolas', monospace; font-weight: 600; }
.col-nome { text-align: left; min-width: 180px; }

/* --- UPLOAD DE FICHEIROS --- */
.upload-card { 
    border: 2px dashed #cbd5e1; 
    border-radius: 16px; 
    background-color: #f8fafc; 
    transition: all 0.3s ease; 
    padding: 3rem; 
    text-align: center; 
    cursor: pointer; 
}
.upload-card:hover { 
    border-color: #3b82f6; 
    background-color: #eff6ff; 
}
.upload-icon { 
    font-size: 4rem; 
    color: #94a3b8; 
    margin-bottom: 1rem; 
    transition: color 0.3s; 
}
.upload-card:hover .upload-icon { 
    color: #3b82f6; 
}

/* Lista de Ficheiros de Upload */
.file-list-container { margin-top: 20px; text-align: left; }
.file-list-item { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 10px 15px; 
    background: #fff; 
    border: 1px solid #e2e8f0; 
    margin-bottom: 8px; 
    border-radius: 8px; 
    font-size: 0.9rem; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.02); 
}
.file-status-pending { border-left: 4px solid #cbd5e1; }
.file-status-success { border-left: 4px solid #22c55e; }
.file-status-error { border-left: 4px solid #ef4444; }
.file-status-skipped { border-left: 4px solid #f59e0b; }

/* Tabela de Validação de Importação */
.row-receita td { background-color: #dcfce7 !important; }
.row-despesa td { background-color: #fee2e2 !important; }
.row-receita td.ignore-cell, .row-despesa td.ignore-cell { background-color: #fff !important; }
.ignore-cell { border-right: 1px solid #dee2e6; }
.table-input { border: 1px solid rgba(0,0,0,0.1); background: rgba(255,255,255,0.5); font-size: 0.9rem; padding: 0.4rem; border-radius: 6px; width: 100%; }
.is-invalid { border: 2px solid #dc3545 !important; background-color: #fff8f8; }

/* Badges Personalizados */
.badge-origem { font-size: 0.7em; padding: 4px 8px; border-radius: 6px; text-transform: uppercase; font-weight: 600; letter-spacing: 0.5px; }
.badge-caixa { background-color: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.badge-banco { background-color: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* --- CHAT LAYOUT MODERNO --- */
.bg-chat {
    background-color: #f0f2f5;
    /* Padrão subtil */
    background-image: radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
}

.user-chat-link {
    border-left: 4px solid transparent;
    transition: all 0.2s;
}
.user-chat-link:hover { background-color: #f8fafc; }
.user-chat-link.active {
    background-color: #f0f9ff;
    border-left-color: #0f172a;
}

/* Linha de Mensagem (Container) */
.msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 80%;
    margin-bottom: 10px;
}

/* Avatar da Mensagem */
.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Bolha de Mensagem */
.msg-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.msg-time {
    font-size: 0.65rem;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
    display: block;
}

/* PERGUNTA (Condómino) - ESQUERDA */
.msg-left {
    align-self: flex-start;
    flex-direction: row;
    margin-right: auto;
}
.msg-left .msg-avatar {
    background-color: #64748b; /* Cinzento Azulado */
}
.msg-left .msg-bubble {
    background-color: #ffffff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

/* RESPOSTA (Admin) - DIREITA */
.msg-right {
    align-self: flex-end;
    flex-direction: row-reverse;
    margin-left: auto;
}
.msg-right .msg-avatar {
    background-color: #3b82f6; /* Azul Admin */
}
.msg-right .msg-bubble {
    background-color: #eff6ff; /* Azul muito claro */
    color: #1e40af;
    border-bottom-right-radius: 4px;
    border: 1px solid #dbeafe;
}

/* --- RESPONSIVIDADE --- */
@media (max-width: 768px) {
    .user-info-container { width: 100%; justify-content: space-between; margin-top: 10px; }
    .table-responsive { display: block; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .card-header h5 { font-size: 1.1rem; }
}