/* ========================================
   BOHIKE — CSS Global v2
   Font Awesome + Diseño PC amigable
   ======================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg:           #0F172A;
    --bg-card:      #1E293B;
    --bg-input:     #0F172A;
    --border:       #334155;
    --text:         #F1F5F9;
    --text-2:       #94A3B8;
    --text-muted:   #64748B;
    --accent:       #818CF8;
    --accent-dark:  #6366F1;
    --gradient:     linear-gradient(135deg, #6366F1, #8B5CF6);
    --green:        #22C55E;
    --red:          #EF4444;
    --yellow:       #F59E0B;
    --radius:       14px;
    --radius-sm:    10px;
    --sidebar-w:    250px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
}

a { color: inherit; text-decoration: none; }

/* ==========================================
   LAYOUT
   ========================================== */

.app-layout {
    display: flex;
    min-height: 100vh;
}

.app-body {
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================
   SIDEBAR — Solo PC
   ========================================== */

.sidebar {
    display: none;
}

@media (min-width: 768px) {
    .sidebar {
        display: flex;
        flex-direction: column;
        width: var(--sidebar-w);
        background: var(--bg-card);
        border-right: 1px solid var(--border);
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 200;
        padding: 0;
    }

    .app-body {
        margin-left: var(--sidebar-w);
    }
}

/* Logo del sidebar */
.sidebar__logo {
    padding: 24px 22px 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar__logo-name {
    font-size: 22px;
    font-weight: 800;
    background: linear-gradient(135deg, #818CF8, #C084FC);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

/* Navegación */
.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 16px 12px;
    flex: 1;
}

.sidebar__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    transition: background .18s, color .18s;
}

.sidebar__item:hover {
    background: rgba(129, 140, 248, 0.08);
    color: var(--text);
}

.sidebar__item--active {
    background: rgba(99, 102, 241, 0.18);
    color: var(--accent);
    font-weight: 600;
}

.sidebar__icon {
    width: 18px;
    text-align: center;
    font-size: 15px;
}

/* Footer del sidebar con avatar */
.sidebar__footer {
    padding: 14px 12px;
    border-top: 1px solid var(--border);
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
}

.sidebar__avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.sidebar__user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.sidebar__username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__logout {
    font-size: 12px;
    color: var(--text-muted);
    transition: color .2s;
}

.sidebar__logout:hover { color: var(--red); }

/* ==========================================
   TOPBAR — Solo móvil
   ========================================== */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    height: 58px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0; z-index: 100;
}

.topbar__logo {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #818CF8, #C084FC);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.topbar__user {
    font-size: 13px;
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .topbar { display: none; }
}

/* ==========================================
   MAIN CONTENT
   ========================================== */

.main {
    padding: 20px 18px 90px;
    max-width: 100%;
}

@media (min-width: 768px) {
    .main {
        padding: 32px 40px 60px;
        max-width: 1000px;
    }
}

@media (min-width: 1280px) {
    .main {
        padding: 36px 56px 60px;
        max-width: 1100px;
    }
}

/* Mensajes */
.messages-wrapper {
    padding: 12px 18px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (min-width: 768px) {
    .messages-wrapper { padding: 20px 40px 0; }
}

/* ==========================================
   BOTTOM NAV — Solo móvil
   ========================================== */

.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 14px;
    z-index: 100;
}

.bottom-nav__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    color: var(--text-muted);
    transition: color .2s;
    font-size: 10px;
}

.bottom-nav__item--active { color: var(--accent); }
.bottom-nav__icon { font-size: 18px; }
.bottom-nav__label { font-weight: 500; }
.bottom-nav__item--active .bottom-nav__label { font-weight: 700; }

@media (min-width: 768px) {
    .bottom-nav { display: none; }
}

/* ==========================================
   PAGE HEADER
   ========================================== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header__title {
    font-size: 22px;
    font-weight: 700;
}

@media (min-width: 768px) {
    .page-header__title { font-size: 26px; }
}

/* ==========================================
   STATS GRID
   ========================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
}

@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 18px 20px;
    border: 1px solid var(--border);
    transition: border-color .2s, transform .2s;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.stat-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.stat-card__label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.stat-card__icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
}

.stat-card__value {
    font-size: 24px;
    font-weight: 700;
}

.stat-card__value--green  { color: var(--green); }
.stat-card__value--red    { color: var(--red); }
.stat-card__value--yellow { color: var(--yellow); }
.stat-card__value--accent { color: var(--accent); }

/* ==========================================
   CARDS
   ========================================== */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 22px;
    border: 1px solid var(--border);
    margin-bottom: 18px;
}

.card--accent {
    background: linear-gradient(135deg, #312E81, #1E1B4B);
    border-color: #4338CA;
}

.card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

/* Grid de dos columnas en PC */
.two-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

@media (min-width: 900px) {
    .two-col { grid-template-columns: 1fr 1fr; }
}

/* ==========================================
   TRANSACTION LIST
   ========================================== */

.txn-list { list-style: none; }

.txn-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 8px;
    border-radius: var(--radius-sm);
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}

.txn-item:last-child { border-bottom: none; }
.txn-item:hover { background: rgba(255,255,255,0.03); }

.txn-icon {
    width: 40px; height: 40px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.txn-info { flex: 1; min-width: 0; }
.txn-desc { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.txn-amount { font-size: 15px; font-weight: 700; flex-shrink: 0; }
.txn-amount--income  { color: var(--green); }
.txn-amount--expense { color: var(--text); }

/* ==========================================
   PROGRESS BAR
   ========================================== */

.progress {
    width: 100%; height: 7px;
    background: rgba(255,255,255,0.06);
    border-radius: 99px; overflow: hidden;
}

.progress__bar {
    height: 100%; border-radius: 99px;
    transition: width 0.5s ease;
}

.progress__bar--over { background: var(--red) !important; }

/* ==========================================
   DONUT CHART
   ========================================== */

.donut-container {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.donut-chart {
    width: 130px; height: 130px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}

.donut-chart::after {
    content: '';
    position: absolute;
    top: 22px; left: 22px;
    width: 86px; height: 86px;
    background: var(--bg-card);
    border-radius: 50%;
}

.donut-chart--empty { background: var(--border); }

.donut-legend { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 150px; }
.donut-legend__item { display: flex; align-items: center; gap: 8px; }
.donut-legend__dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.donut-legend__name { font-size: 13px; color: var(--text-2); flex: 1; }
.donut-legend__value { font-size: 13px; font-weight: 600; }

/* ==========================================
   BAR CHART
   ========================================== */

.bar-chart { display: flex; flex-direction: column; gap: 12px; }
.bar-chart__item { display: flex; align-items: center; gap: 10px; }
.bar-chart__label { font-size: 17px; width: 28px; text-align: center; }
.bar-chart__track {
    flex: 1; height: 18px;
    background: rgba(255,255,255,0.05);
    border-radius: 6px; overflow: hidden;
}
.bar-chart__fill {
    height: 100%; border-radius: 6px;
    transition: width 0.5s ease; min-width: 4px;
}
.bar-chart__fill--over { background: var(--red) !important; }
.bar-chart__value { font-size: 12px; color: var(--text-muted); width: 60px; text-align: right; }

/* ==========================================
   BUTTONS
   ========================================== */

.btn {
    display: inline-flex;
    align-items: center; justify-content: center;
    gap: 8px; border: none; border-radius: var(--radius-sm);
    padding: 11px 22px;
    font-weight: 600; font-size: 14px;
    cursor: pointer;
    transition: opacity .2s, transform .1s;
}

.btn:hover   { opacity: 0.88; }
.btn:active  { transform: scale(0.98); }
.btn--primary   { background: var(--gradient); color: #fff; }
.btn--secondary { background: rgba(255,255,255,0.07); color: var(--text); border: 1px solid var(--border); }
.btn--danger    { background: var(--red); color: #fff; }
.btn--small     { padding: 6px 14px; font-size: 12px; border-radius: 8px; }
.btn--full      { width: 100%; }

.btn-delete {
    color: var(--text-muted); font-size: 13px;
    padding: 5px 8px; border-radius: 6px;
    transition: all .2s; flex-shrink: 0; border: none;
    background: transparent; cursor: pointer;
}
.btn-delete:hover { color: var(--red); background: rgba(239, 68, 68, 0.1); }

/* ==========================================
   FORMS
   ========================================== */

.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 12px; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .5px;
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px; outline: none;
    transition: border-color .2s;
    font-family: inherit;
}

.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-row { display: flex; gap: 10px; }
.form-row > * { flex: 1; }

.form-toggle { display: flex; gap: 8px; margin-bottom: 14px; }

.form-toggle__btn {
    flex: 1; padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-2);
    font-size: 13px; font-weight: 500;
    cursor: pointer; text-align: center;
    transition: all .2s;
}

.form-toggle input[type="radio"] { display: none; }

.form-toggle input[type="radio"]:checked + .form-toggle__btn,
.form-toggle label:has(input:checked) {
    border-color: var(--accent);
    color: var(--text);
    background: rgba(99, 102, 241, 0.2);
}

/* ==========================================
   ALERTS
   ========================================== */

.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500;
}

.alert--success { background: rgba(34,197,94,.15); color: #86efac; border: 1px solid rgba(34,197,94,.25); }
.alert--error   { background: rgba(239,68,68,.15);  color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }
.alert--warning { background: rgba(245,158,11,.15); color: #fcd34d; border: 1px solid rgba(245,158,11,.25); }

/* ==========================================
   AUTH PAGES
   ========================================== */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--bg);
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 36px 30px;
    border: 1px solid var(--border);
}

.auth-logo {
    text-align: center;
    font-size: 34px;
    font-weight: 900;
    background: linear-gradient(135deg, #818CF8, #C084FC);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.auth-tagline {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 28px;
}

.auth-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

.auth-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 20px;
}

.auth-footer a { color: var(--accent); font-weight: 600; }

/* ==========================================
   BUDGET ITEM
   ========================================== */

.budget-item { display: flex; flex-direction: column; gap: 10px; }
.budget-item__header { display: flex; justify-content: space-between; align-items: center; }
.budget-item__info   { display: flex; align-items: center; gap: 10px; }
.budget-item__icon   { font-size: 22px; }
.budget-item__name   { font-size: 15px; font-weight: 600; }
.budget-item__limit  { font-size: 12px; color: var(--text-muted); }
.budget-item__spent  { font-size: 16px; font-weight: 700; text-align: right; }
.budget-item__pct    { font-size: 11px; margin-top: 2px; color: var(--text-muted); }
.budget-item__warning{ font-size: 12px; color: var(--red); margin-top: 4px; }

/* ==========================================
   CHAT
   ========================================== */

.chat-container {
    display: flex; flex-direction: column;
    height: calc(100vh - 180px); min-height: 400px;
}

@media (min-width: 768px) {
    .chat-container { height: calc(100vh - 130px); }
}

.chat-header {
    display: flex; align-items: center;
    gap: 14px; margin-bottom: 16px;
}
.chat-header__icon { font-size: 30px; }
.chat-header__title { font-size: 18px; font-weight: 700; }
.chat-header__subtitle { font-size: 12px; color: var(--accent); }

.chat-messages {
    flex: 1; overflow-y: auto;
    display: flex; flex-direction: column; gap: 12px;
    background: rgba(0,0,0,.2);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.chat-bubble {
    max-width: 78%; padding: 10px 14px;
    border-radius: 14px; font-size: 14px; line-height: 1.55;
}
.chat-bubble--ai {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}
.chat-bubble--user {
    align-self: flex-end;
    background: var(--accent-dark); color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-input-row { display: flex; gap: 8px; margin-bottom: 10px; }
.chat-input-row .form-input { flex: 1; }

.chat-suggestions { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
    background: var(--bg-card); color: var(--text-2);
    border: 1px solid var(--border); border-radius: 99px;
    padding: 6px 14px; font-size: 12px; cursor: pointer;
    transition: all .2s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ==========================================
   UTILIDADES
   ========================================== */

.mb-0     { margin-bottom: 0 !important; }
.hidden   { display: none; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.divider  { height: 1px; background: var(--border); margin: 16px 0; }