/* style.css - DARK MODE + IA + INVERSIONES */
:root {
    --primary: #a855f7;
    --primary-light: #d8b4fe;
    --primary-dark: #7e22ce;
    --bg-color: #121212;
    --card-bg: #1e1e24;
    --text-main: #e5e7eb;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-main); padding: 0 0 20px 0; }

.top-bar { background-color: #0f0f13; color: var(--text-main); padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; border-bottom: 1px solid var(--border-color); }
.btn-logout { background-color: #ef4444; color: white; text-decoration: none; padding: 8px 15px; border-radius: 5px; font-size: 0.9rem; font-weight: bold; }
.btn-logout:hover { background-color: #dc2626; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
h1 { text-align: center; color: var(--primary-light); margin-bottom: 25px; }
h2 { color: var(--primary); margin-bottom: 20px; font-size: 1.4rem; }

.card, .form-container, .table-container, .filter-bar, .login-box { background: var(--card-bg); padding: 20px; border-radius: 10px; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); border-top: 5px solid var(--primary); }

.dashboard { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 15px; margin-bottom: 30px; }
.card { text-align: center; display: flex; flex-direction: column; justify-content: center;}
.card h3 { font-size: 1.05rem; color: var(--text-main); }
.card .amount { font-size: 1.6rem; font-weight: bold; margin-top: 10px; }
.percentage { font-size: 0.85rem; color: var(--text-muted); margin-top: 5px; display: block; }

.filter-bar { padding: 15px; margin-bottom: 20px; display: flex; gap: 15px; align-items: flex-end; flex-wrap: wrap; border-top: none; border-left: 5px solid var(--primary); }
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }
.btn-filter, .btn-clear { padding: 12px 15px; border: none; border-radius: 6px; cursor: pointer; font-weight: bold; color: white; }
.btn-filter { background-color: var(--primary); }
.btn-filter:hover { background-color: var(--primary-dark); }
.btn-clear { background-color: #4b5563; text-decoration: none; text-align: center; }
.btn-clear:hover { background-color: #374151; }

.main-content { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
@media (max-width: 900px) { .main-content { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 15px; }
label { display: block; margin-bottom: 5px; font-weight: 600; color: var(--primary-light); font-size: 0.9rem; }
input, select { width: 100%; padding: 10px; border: 1px solid var(--border-color); border-radius: 6px; outline: none; font-size: 1rem; background-color: #2a2a35; color: var(--text-main); }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.2); }
button[type="submit"] { width: 100%; padding: 12px; background-color: var(--primary); color: var(--white); border: none; border-radius: 6px; font-size: 1.1rem; font-weight: bold; cursor: pointer; transition: 0.3s; margin-top: 10px; }
button[type="submit"]:hover { background-color: var(--primary-dark); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background-color: #2d2d3a; color: var(--primary-light); font-weight: bold; }
.tipo-ingreso { color: #4ade80; font-weight: bold; }
.tipo-egreso { color: #f87171; font-weight: bold; }
.tipo-imprevisto { color: #fb923c; font-weight: bold; }
.tipo-ahorro { color: var(--primary-light); font-weight: bold; }
.tipo-gustito { color: #ec4899; font-weight: bold; }
.tipo-inversion { color: #3b82f6; font-weight: bold; } /* Color Azul para Inversiones */

.btn-delete { color: #f87171; text-decoration: none; font-size: 0.9rem; font-weight: bold; padding: 5px 10px; border: 1px solid #f87171; border-radius: 4px; transition: 0.3s; }
.btn-delete:hover { background-color: #f87171; color: #121212; }

.pagination { display: flex; justify-content: center; gap: 5px; margin-top: 25px; flex-wrap: wrap; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: 5px; background: #2a2a35; color: var(--text-main); text-decoration: none; border: 1px solid var(--border-color); font-weight: bold; }
.pagination a:hover { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .dots { background: transparent; border: none; color: var(--text-muted); }

/* --- CHATBOT WIDGET --- */
#chat-widget { position: fixed; bottom: 20px; right: 20px; z-index: 1000; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
#chat-toggle { background-color: #ec4899; color: white; padding: 15px 20px; border-radius: 30px; cursor: pointer; font-weight: bold; box-shadow: 0 4px 10px rgba(236, 72, 153, 0.4); transition: 0.3s; display: flex; align-items: center; gap: 10px; }
#chat-toggle:hover { background-color: #be185d; transform: translateY(-2px); }
#chat-box { width: 350px; height: 450px; background-color: var(--card-bg); border-radius: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.5); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border-color); margin-bottom: 15px; }
#chat-header { background-color: #ec4899; color: white; padding: 15px; font-weight: bold; display: flex; justify-content: space-between; align-items: center; }
#chat-close { cursor: pointer; font-size: 1.2rem; }
#chat-messages { flex: 1; padding: 15px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; background-color: #1a1a20; }
.chat-msg { max-width: 85%; padding: 10px 15px; border-radius: 15px; font-size: 0.95rem; line-height: 1.4; }
.msg-user { background-color: var(--primary); color: white; align-self: flex-end; border-bottom-right-radius: 2px; }
.msg-ai { background-color: #2d2d3a; color: var(--text-main); align-self: flex-start; border-bottom-left-radius: 2px; border: 1px solid var(--border-color); }
#chat-input-area { display: flex; padding: 10px; background-color: var(--card-bg); border-top: 1px solid var(--border-color); }
#chat-input { flex: 1; padding: 10px; border-radius: 20px; border: 1px solid var(--border-color); background-color: #121212; color: white; outline: none; margin-right: 10px; }
#chat-send { background-color: #ec4899; color: white; border: none; padding: 10px 15px; border-radius: 20px; cursor: pointer; font-weight: bold; }
#chat-send:hover { background-color: #be185d; }
.typing-indicator { color: var(--text-muted); font-size: 0.85rem; font-style: italic; align-self: flex-start; margin-left: 10px; }

@media (max-width: 600px) {
    table, thead, tbody, th, td, tr { display: block; }
    th { display: none; }
    tr { margin-bottom: 15px; border: 1px solid var(--border-color); border-radius: 8px; padding: 10px; background-color: #2a2a35; }
    td { text-align: right; padding-left: 50%; position: relative; border-bottom: none; padding-top: 10px; padding-bottom: 10px; }
    td::before { content: attr(data-label); position: absolute; left: 10px; width: 45%; text-align: left; font-weight: bold; color: var(--primary-light); }
    #chat-box { width: 90vw; height: 60vh; right: 5vw; bottom: 80px; }
}