/* ============================================================
   FIKA — Custom CSS sobre Argon Dashboard 3
   Dimension Estudios — 2026
   Naranja: #f96302 | Dark: #344767 | Gris: #67748e
   ============================================================ */

/* === FUENTE GLOBAL === */
body, .card, .sidenav, .btn, .form-control, h1, h2, h3, h4, h5, h6 {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* === LOGO FIKA === */
.fika-logo { font-size: 1.05rem; font-weight: 800; color: #344767; letter-spacing: -0.02em; }
.fika-logo span { color: #f96302; }
.fika-logo-icon {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(310deg, #f96302 0%, #e55a02 100%);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.fika-logo-icon i { color: #fff; font-size: 16px; }

/* === NAVBAR === */
.navbar-main { padding-top: .5rem !important; padding-bottom: .5rem !important; }

/* === SIDEBAR === */
.sidenav { max-width: 13.5rem !important; }
.sidenav .nav-link { border-radius: .5rem; margin: 0 .5rem; transition: background .15s; }
.sidenav .nav-link:not(.active) .icon i { color: #67748e !important; opacity: 1 !important; }
.sidenav .nav-link:not(.active) .nav-link-text { color: #67748e !important; font-weight: 500; }
.sidenav .nav-link:not(.active):hover { background: rgba(0,0,0,.05) !important; }
.sidenav .nav-link.active { background: #f6f9fc !important; box-shadow: none !important; }
.sidenav .nav-link.active .icon i { color: #f96302 !important; opacity: 1 !important; }
.sidenav .nav-link.active .nav-link-text { color: #f96302 !important; font-weight: 700; }

/* === ANIMACIÓN DE VISTAS === */
.view-section { animation: fadeUp .25s ease; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* === LOADING SCREEN === */
#loading-screen {
    position: fixed; inset: 0; background: #f8f9fa; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.loading-logo { font-size: 2rem; font-weight: 800; color: #344767; }
.loading-logo span { color: #f96302; }

/* === PRICE TICKER === */
.price-ticker-card {
    background: #fff; border-radius: .75rem;
    border: 1px solid #e9ecef;
    margin-bottom: 1rem;
}
#ticker-header:hover { background: #f8f9fa; }
.ticker-item {
    display: flex; align-items: center; gap: 8px; white-space: nowrap;
}
.ticker-symbol {
    font-size: .75rem; font-weight: 700; color: #344767;
    padding: 2px 7px; border-radius: 5px; background: #f0f2f5;
}
.ticker-price { font-size: .95rem; font-weight: 700; color: #344767; }
.ticker-change { font-size: .82rem; font-weight: 600; }
.ticker-change.pos { color: #2dce89; }
.ticker-change.neg { color: #f5365c; }
.ticker-divider { width: 1px; height: 20px; background: #e9ecef; flex-shrink: 0; }
.ticker-loading { font-size: .75rem; color: #8392ab; }
.ticker-ts { font-size: .65rem; color: #adb5bd; margin-left: auto; white-space: nowrap; }

/* === CRIPTO ICON (in cards/tables) === */
.cripto-icon {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; color: #fff;
}
.cripto-icon-sm {
    width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: .65rem; color: #fff;
}

/* === CRIPTO CARDS === */
.cripto-card {
    transition: transform .15s, box-shadow .15s;
    border: 1px solid #e9ecef !important;
}
.cripto-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 20px rgba(50,50,93,.1), 0 3px 6px rgba(0,0,0,.08) !important;
}
.cripto-stat-label { font-size: .72rem; color: #8392ab; font-weight: 500; margin-bottom: 2px; }
.cripto-stat-value { font-size: 1rem; font-weight: 700; color: #344767; }
.cripto-stat-value.text-success { color: #2dce89 !important; }
.cripto-stat-value.text-danger  { color: #f5365c !important; }

/* === PROGRESS BAR === */
.fika-progress {
    height: 5px; background: #e9ecef; border-radius: 3px; overflow: hidden;
    margin-top: 8px;
}
.fika-progress-bar {
    height: 100%; border-radius: 3px; transition: width .5s ease;
}
.fika-progress-bar.success { background: linear-gradient(90deg, #2dce89, #2dcecc); }
.fika-progress-bar.warning { background: linear-gradient(90deg, #f5a623, #fb6340); }
.fika-progress-bar.danger  { background: linear-gradient(90deg, #f5365c, #f56036); }

/* === BLOQUES TABLE === */
.bloques-table-wrapper { overflow-x: auto; }
.bloques-table { min-width: 800px; }
.bloques-table thead th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: #8392ab; font-weight: 700; border-bottom: 1px solid #e9ecef !important;
    padding: .75rem .5rem; white-space: nowrap;
}
.bloques-table tbody td { font-size: .875rem; padding: .7rem .5rem; vertical-align: middle; }
.bloques-table tbody tr:hover { background: #f8f9fa; }
.bloques-table tbody tr.row-clickable { cursor: pointer; }

/* === OPERACIONES TABLE === */
.ops-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: #8392ab; font-weight: 700; }
.ops-table tbody td { font-size: .875rem; vertical-align: middle; }
.ops-table tbody tr.op-pending td { color: #67748e; }
.ops-table tbody tr.op-cancelled td { color: #adb5bd; text-decoration: line-through; }

.op-type-badge {
    padding: .2rem .55rem; border-radius: 5px; font-size: .65rem; font-weight: 700;
    display: inline-block;
}
.op-type-badge.sell { background: #fdeef2; color: #f5365c; }
.op-type-badge.buy  { background: #eafaf3; color: #2dce89; }

.op-status-badge {
    padding: .15rem .5rem; border-radius: 4px; font-size: .62rem; font-weight: 600;
    display: inline-block;
}
.op-status-badge.executed  { background: #eafaf3; color: #2dce89; }
.op-status-badge.pending   { background: #fff8e6; color: #f5a623; border: 1px dashed #f5a623; }
.op-status-badge.cancelled { background: #fdeef2; color: #f5365c; }

/* === BACK BUTTON (detalle view) === */
.btn-back-detalle {
    background: rgba(249,99,2,.08);
    border: 1px solid #f96302 !important;
    color: #f96302;
    font-size: .8rem;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 8px;
    box-shadow: none !important;
    transition: background .15s, border-color .15s;
}
.btn-back-detalle:hover {
    background: rgba(249,99,2,.15);
    border-color: #f96302;
    color: #f96302;
}
.btn-back-detalle i { font-size: .75rem; }

/* === CARD TABS (bloques view) === */
.fika-card-tabs {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    border-bottom: none;
    gap: 2px;
    padding-top: 10px;
}
.fika-card-tabs .nav-link {
    font-size: .8rem; font-weight: 600; color: #8392ab;
    border: none; border-bottom: 2px solid transparent;
    border-radius: 0; padding: 8px 14px;
    transition: color .15s, border-color .15s;
    background: none !important;
    cursor: pointer;
    outline: none;
}
.fika-card-tabs .nav-link:hover { color: #344767; }
.fika-card-tabs .nav-link.active {
    color: #f96302 !important;
    border-bottom-color: #f96302 !important;
}
.fika-card-tabs .nav-link i { opacity: .7; }

/* Footer total row in tables */
.table-footer-total td {
    background: #f8f9fa !important;
    border-top: 2px solid #dee2e6 !important;
    font-size: .88rem;
}

/* === DETALLE BLOCK SUMMARY === */
.bloque-detail-card { border: 2px solid #e9ecef !important; }
.gain-display { line-height: 1; }
.gain-display .gain-big { font-size: 2rem; font-weight: 800; }
.gain-display .gain-sub { font-size: .8rem; font-weight: 600; margin-top: 2px; }
.gain-display.positive .gain-big,
.gain-display.positive .gain-sub { color: #2dce89; }
.gain-display.negative .gain-big,
.gain-display.negative .gain-sub { color: #f5365c; }
.gain-display.neutral .gain-big   { color: #67748e; }

.detail-stat { }
.detail-stat-label { font-size: .72rem; color: #8392ab; margin-bottom: 2px; }
.detail-stat-value { font-size: 1.05rem; font-weight: 700; color: #344767; }
.detail-stat-value.green  { color: #2dce89; }
.detail-stat-value.yellow { color: #f5a623; }
.detail-stat-value.orange { color: #f96302; }
.detail-stat-value.red    { color: #f5365c; }

/* === SUMMARY BOX === */
.summary-result-card {
    background: #f0faf6; border: 1px solid #c3e6d6 !important;
    border-radius: .75rem;
}
.summary-result-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: .5rem 0; border-bottom: 1px solid #e9ecef; font-size: .9rem;
}
.summary-result-row:last-child { border-bottom: none; }
.summary-result-label { color: #67748e; font-weight: 500; }
.summary-result-value { font-weight: 700; color: #344767; }
.summary-result-value.green  { color: #2dce89; }
.summary-result-value.orange { color: #f96302; }
.summary-result-value.yellow { color: #f5a623; }
.summary-result-value.red    { color: #f5365c; }

/* === BUTTONS === */
.btn-fika {
    background: linear-gradient(310deg, #f96302, #e55a02);
    border: none; color: #fff !important; font-weight: 600;
}
.btn-fika:hover { background: linear-gradient(310deg, #e55a02, #d44a00); color: #fff; }

/* === YEAR SELECTOR === */
.year-select {
    font-size: .78rem; font-weight: 600; border: 1px solid #e9ecef;
    border-radius: .5rem; padding: 4px 10px; color: #344767;
    background: #fff; cursor: pointer;
}
.year-select:focus { outline: 2px solid #f96302; border-color: #f96302; }

/* === STAT MINI CARDS === */
.stat-mini-value { font-size: 1.75rem; font-weight: 800; }
.stat-mini-label { font-size: .8rem; color: #8392ab; }

/* === TOOLTIPS & MISC === */
.text-fika { color: #f96302 !important; }
.bg-fika   { background: #f96302 !important; }

.btn-icon-action {
    width: 28px; height: 28px; border-radius: 7px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: transparent; cursor: pointer; font-size: .75rem;
    transition: all .15s; color: #8392ab;
}
.btn-icon-action:hover { background: #f0f2f5; color: #344767; }
.btn-icon-action.danger:hover { background: #fdeef2; color: #f5365c; }
.btn-icon-action.success:hover { background: #eafaf3; color: #2dce89; }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 3rem 1rem; color: #8392ab; }
.empty-state i { font-size: 2.5rem; margin-bottom: 1rem; display: block; opacity: .4; }
.empty-state h6 { font-weight: 600; color: #67748e; }
.empty-state p  { font-size: .82rem; }

/* === BREADCRUMB === */
.breadcrumb { background: transparent; padding: 0; margin: 0; }
.breadcrumb-item { font-size: .78rem; }
.breadcrumb-item a { color: #8392ab; text-decoration: none; }
.breadcrumb-item a:hover { color: #f96302; }
.breadcrumb-item.active { color: #344767; font-weight: 600; }
.breadcrumb-item + .breadcrumb-item::before { color: #adb5bd; }

/* === TOAST === */
.fika-toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    background: #344767; color: #fff; padding: 10px 18px;
    border-radius: 10px; font-size: .82rem; font-weight: 600;
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
    animation: toastIn .2s ease;
}
@keyframes toastIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fika-toast.hide { opacity: 0; transform: translateY(8px); transition: all .3s; }

/* === SIDEBAR BLOQUES ACCORDION === */
/* Ocultar la flecha automática de Argon/Bootstrap en este toggle */
#sidebar-bloques-toggle::after,
#sidebar-bloques-toggle::before { display: none !important; }

#sidebar-bloques-collapse .nav-link {
    border-radius: .4rem;
    margin: 1px .25rem;
    padding: .3rem .5rem !important;
}
#sidebar-bloques-collapse .nav-link:not(.active) { color: #67748e !important; }
#sidebar-bloques-collapse .nav-link.active { background: #f6f9fc !important; }
#sidebar-bloques-collapse .nav-link.active .nav-link-text { color: #f96302 !important; font-weight: 700; }
#sidebar-bloques-toggle[aria-expanded="true"] .sidebar-chevron { transform: rotate(-180deg); }

/* Badge de conteo de bloques: tamaño uniforme */
.sidebar-blq-badge {
    min-width: 18px; height: 18px;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .6rem; font-weight: 700;
    background: #e9ecef; color: #67748e;
    flex-shrink: 0;
}

/* === SELL ORDER BOX (detalle) === */
.sell-order-box {
    background: #f8f9fa; border: 1px solid #e9ecef;
    border-radius: .75rem; padding: 14px 18px;
}
.sell-order-label {
    font-size: .65rem; text-transform: uppercase; letter-spacing: .08em;
    color: #8392ab; font-weight: 700; margin-bottom: 6px;
}
.sell-order-main {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin-bottom: 10px;
}
.sell-qty   { font-size: 1.15rem; font-weight: 800; color: #344767; }
.sell-arrow { font-size: .9rem; color: #adb5bd; }
.sell-price { font-size: .95rem; font-weight: 700; color: #67748e; }
.sell-total { font-size: 1rem; font-weight: 700; color: #f96302; }

.sell-done-badge {
    font-size: .82rem; font-weight: 600; color: #2dce89;
    display: flex; align-items: center;
}
.sell-pending-badge {
    font-size: .82rem; font-weight: 600; color: #f5a623;
    display: flex; align-items: center; flex-wrap: wrap; gap: 4px;
}

/* === DRAG & DROP REORDER === */
.sortable-ghost { opacity: .4; background: #f0f4ff !important; }
.drag-handle { cursor: grab; padding: 4px 2px; }
.drag-handle:active { cursor: grabbing; }

/* === DETALLE HEADER LAYOUT === */
.detalle-header-wrap {
    display: flex; flex-direction: column; gap: 12px;
}
.detalle-top-row {
    display: flex; align-items: flex-start; gap: 12px;
}
.detalle-top-right {
    display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex-shrink: 0;
}
.detalle-actions {
    display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
}
.min-width-0 { min-width: 0; }
/* Stats row below sell-order-box */
.detalle-stats-row {
    display: flex; flex-wrap: wrap; gap: 12px 20px;
}
.detalle-stat-item {
    /* same visual as col-auto detail stats */
}
.sell-order-box { margin-top: 0; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .gain-display .gain-big { font-size: 1.5rem; }
    .bloques-table { min-width: 600px; }

    /* Cripto cards en móvil: stats ocultas por defecto, toggle las muestra */
    .cripto-stats-detail { display: none; }

    /* Padding reducido en móvil */
    .card-body.py-3.px-3 { padding: .75rem !important; }

    /* Main content sin margen lateral */
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .container-fluid { padding: .75rem !important; }

    /* Navbar más compacta */
    .navbar-main { padding: .25rem .5rem !important; }

    /* Ocultar drag handle en móvil */
    .drag-handle { display: none !important; }

    /* Tabs: caben en una línea */
    .fika-card-tabs { gap: 0; }
    .fika-card-tabs .nav-link { font-size: .72rem; padding: 8px 10px; }

    /* Detalle header en móvil: gain display + actions debajo del nombre */
    .detalle-top-row { flex-wrap: wrap; }
    .detalle-top-right {
        flex-direction: column; align-items: stretch;
        width: 100%; order: 3;
    }
    .detalle-actions {
        display: flex; gap: 6px;
        justify-content: stretch;
    }
    .detalle-actions .btn {
        flex: 1; justify-content: center;
        display: flex; align-items: center;
    }
    .gain-display { text-align: left; }
    .gain-display .gain-big { font-size: 1.4rem; }

    /* Stats items full-width friendly */
    .detalle-stats-row { gap: 10px 16px; }
    .detalle-stat-item { min-width: 0; }

    /* Sell order box: wrap values on small screens */
    .sell-order-main { gap: 6px; }
    .sell-qty { font-size: 1rem; }
    .sell-total { font-size: .9rem; }
}

@media (min-width: 769px) {
    /* En desktop el toggle chevron es menos prominente */
    .cripto-toggle-btn { opacity: .5; }
    .cripto-toggle-btn:hover { opacity: 1; }
}

/* === MOBILE SIDEBAR === */
@media (max-width: 1199px) {
    .sidenav {
        transform: translateX(-17.125rem);
        transition: transform .2s ease !important;
    }
    .sidenav.show {
        transform: translateX(0) !important;
        z-index: 1050;
    }
    body.g-sidenav-pinned::after {
        content: '';
        position: fixed; inset: 0;
        background: rgba(0,0,0,.35);
        z-index: 1049;
    }
}
