/* Visora - Estilos del lienzo de dashboards */

/* Oculta plantillas Vue hasta que la app monte (evita flash de {{ error }}). */
[v-cloak] {
    display: none !important;
}

:root {
    --visora-primary: #00788e;
    --visora-bg: #f4f6f9;
    --visora-card: #ffffff;
    --visora-border: #dee2e6;
    --visora-navbar-height: 56px;
}

html {
    margin: 0;
    padding: 0;
}

body.visora-body {
    background: var(--visora-bg);
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

#visora-builder,
#visora-dashboard,
#visora-public {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

.visora-navbar {
    background: linear-gradient(135deg, #2c3e50, var(--visora-primary));
    flex-shrink: 0;
    margin: 0;
    border-radius: 0;
    min-height: var(--visora-navbar-height);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.visora-navbar .navbar-brand {
    font-size: 1.25rem;
    line-height: 1.2;
}

/* Constructor: navbar pegado al borde superior del viewport */
.visora-navbar-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    width: 100%;
}

body.visora-page-builder #visora-builder .visora-builder-main {
    padding-top: var(--visora-navbar-height);
}

body.visora-page-builder #visora-builder {
    display: block;
    min-height: 100vh;
}

.visora-login-card {
    max-width: 420px;
    margin: 8vh auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    border: none;
    border-radius: 12px;
}

.visora-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-rows: minmax(100px, auto);
    gap: 1rem;
    padding: 1rem 0;
    align-items: stretch;
}

.visora-dashboard-grid.visora-grid-has-tabs {
    padding-bottom: 0.5rem;
}

.visora-viewer-tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.65rem 0.25rem 0.85rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--visora-border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), #fff);
    -webkit-overflow-scrolling: touch;
}

.visora-viewer-tab {
    flex: 0 0 auto;
    border: 1px solid var(--visora-border);
    background: #fff;
    color: #495057;
    border-radius: 999px;
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.visora-viewer-tab:hover {
    border-color: var(--visora-primary);
    color: var(--visora-primary);
}

.visora-viewer-tab.active {
    background: var(--visora-primary);
    border-color: var(--visora-primary);
    color: #fff;
}

.visora-kpi-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
}

.visora-grid-refreshing .visora-widget {
    opacity: 0.72;
    transition: opacity 0.15s ease;
}

.visora-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 8px;
}

.visora-widget {
    background: var(--visora-card);
    border: 1px solid var(--visora-border);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.visora-widget canvas,
.visora-chart-canvas {
    flex: 1;
    max-height: 320px;
    width: 100% !important;
}

.visora-chart-wrap {
    min-height: 180px;
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.visora-widget-map {
    align-self: start;
    height: auto;
}

.visora-map-wrap {
    flex: 0 0 auto;
    height: 240px;
    min-height: 0;
    max-height: 240px;
    overflow: hidden;
}

.visora-map-canvas {
    flex: none;
    width: 100%;
    height: 240px;
    max-height: 240px;
    min-height: 0;
    touch-action: none;
    cursor: grab;
}

.visora-map-canvas:active {
    cursor: grabbing;
}

.visora-sidebar {
    background: var(--visora-card);
    border-right: 1px solid var(--visora-border);
    min-height: calc(100vh - 56px);
}

.visora-sidebar .list-group-item.active {
    background: var(--visora-primary);
    border-color: var(--visora-primary);
}

.visora-user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    font-size: 0.85rem;
    font-weight: 600;
}

.visora-builder-tabs .nav-link.active {
    font-weight: 600;
    color: var(--visora-primary);
}

.visora-sql-templates {
    line-height: 1.8;
}

.visora-sql-editor {
    font-family: Consolas, 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.45;
    background: #1e1e2e;
    color: #cdd6f4;
    border-color: #45475a;
    tab-size: 2;
}

.font-monospace {
    font-family: Consolas, 'Courier New', monospace;
}

.visora-preview-table {
    max-height: 280px;
    overflow: auto;
}

.visora-data-table-wrap {
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.visora-table-scroll {
    min-height: 0;
    overflow: auto;
}

.visora-table-footer {
    border-top: 1px solid #e9ecef;
    background: #fafbfc;
    flex-shrink: 0;
}

.visora-data-table-wrap .table {
    font-size: 0.85rem;
}

.visora-data-table-wrap .sticky-top {
    z-index: 1;
}

.visora-table-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding-top: 0.25rem;
}

.visora-column-picker {
    max-height: 160px;
    overflow-y: auto;
}

.visora-color-picker-row .visora-color-swatch {
    width: 3.25rem;
}

.visora-color-picker-row .form-control-color {
    width: 2.75rem;
    height: 2.5rem;
    padding: 0.2rem;
    cursor: pointer;
}

.visora-badge-pbi {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
