:root {
    /* --primary: #0dcaf0;
    --primary-dark: #02C7EC; */
    --primary: #4a46fb;
    --primary-rgb: 74, 70, 251;
    --primary-dark: #3e2de6;
    --dark-blue: #24225c;
    --secondary: #7986CB;
    --secondary-dark: #525c9e;
    --secondary-dark-hover: #475191;
    --hover-bg: #f1f5f9;
    --dark: #121212;
    --dark-gray: #1E1E1E;
    --medium-gray: #282828;
    --light-gray: #333333;
    --text-light: #E0E0E0;
    --text-muted: #9E9E9E;
    --accent: #FF4081;
    --bs-link-color-rgb: 255, 255, 255;
    --bs-link-opacity: 0.5;
    --bs-link-hover-color-rgb: 255, 255, 255;
    --bs-primary-rgb: 74, 70, 252;
    --bs-danger-rgb: 255, 64, 129;
    --bs-danger: #FF4081;
    --bs-danger-text: #FF4081;
    --bs-danger-bg-subtle: #ffe2eb;
    --bs-success-text: #00dc86;
    --bs-success-bg-subtle: #e4ffed;
    --bs-success-border-subtle: #00dc86;

    /* Tabler overrides */
    --tblr-primary: #4a46fb;
    --tblr-primary-rgb: 74, 70, 251;
    --tblr-danger: #FF4081;
    --tblr-danger-rgb: 255, 64, 129;
    --tblr-form-invalid-color: #FF4081;
    --tblr-form-invalid-border-color: #FF4081;
    --tblr-border-radius-lg: calc(13px * var(--tblr-border-radius-scale, 1));
    --tblr-tertiary-bg-rgb: 243, 244, 246;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: rgb(248, 250, 252) !important;
}

a {
    position: relative;
    color: var(--dark);
}

a:hover,
a:focus {
    color: var(--primary);
}

a.underline:hover {
    color: inherit;
    text-decoration: none;
}

a.underline::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    background-color: currentColor;
    transition: width 0.3s ease-out;
}

a.underline:hover::after {
    width: 100%;
}

.stretched-link::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    content: "";
}

.rounded-top-left-3 {
    border-top-left-radius: var(--tblr-border-radius-lg) !important;

}

.rounded-top-right-3 {
    border-top-right-radius: var(--tblr-border-radius-lg) !important;
}

.dropdown-item.active,
.dropdown-item:active {
    color: #fff !important;
}

.bg-dark {
    background-color: var(--dark) !important;
}

.bg-medium-gray {
    background-color: var(--medium-gray) !important;
}

.bg-body-tertiary {
    background-color: rgb(248, 250, 252) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--primary) !important;
}

.text-danger {
    color: var(--bs-danger) !important;
}

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-outline-primary {
    color: var(--primary) !important;
    border-color: var(--primary) !important;
}

.btn-outline-primary:hover {
    border-color: var(--primary) !important;
    background-color: var(--primary) !important;
    color: #fff !important;
}

.border-primary {
    border-color: var(--primary) !important;
}

.alert-danger {
    display: block;
    background-color: var(--bs-danger-bg-subtle);
    color: var(--bs-danger-text);
    border-color: var(--bs-danger);
}

.alert-danger a {
    color: var(--bs-danger-text);
    text-decoration: underline;
}

.nav-bordered .nav-item.show .nav-link,
.nav-bordered .nav-link.active {
    color: var(--dark);
}

@media (min-width: 992px) {
    .navbar-vertical.navbar-expand-lg {
        width: 17rem;
    }

    .navbar-expand-lg.navbar-vertical~.navbar,
    .navbar-expand-lg.navbar-vertical~.page-wrapper,
    .navbar-expand-lg.navbar-vertical~.footer {
        margin-left: 17rem;
    }

    .w-lg-auto {
        width: auto !important;
    }

    .border-bottom-lg-0 {
        border-bottom: 0;
    }
}

/* Card Hover */
.card-hover {
    transition: all 0.3s ease-in-out;
}

.card-hover:hover {
    /* background-color: var(--hover-bg); */
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Card tables */
.card-table tr:last-child td {
    border-bottom: 0;
}

.card-table tr:last-child td:first-child {
    border-bottom-left-radius: var(--tblr-border-radius-lg);
}

.card-table tr:last-child td:last-child {
    border-bottom-right-radius: var(--tblr-border-radius-lg);
}

/* Para searchInputs */
.input-icon-addon--search {
    right: 0;
    left: auto;
}

.input-icon-addon--clear {
    cursor: pointer;
    z-index: 2;
    pointer-events: auto;
    right: 0;
    left: auto;
}

/* Visualización de mapas */
.map-container {
    height: 300px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.route-log-map {
    height: 400px;
    width: 100%;
}

.leaflet-attribution-flag {
    display: none !important;
}

/* Filtro de actividades en RouteLogDetail */
.accordion-item.filterable {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.accordion-item.filterable.show-filter {
    opacity: 1;
    /* large enough to fit any content */
    max-height: 2000px;

}

/* List Groups Hover */

.list-group-item:active,
.list-group-item:focus,
.list-group-item:hover {
    background-color: var(--hover-bg);
}

/* Tables */

.markdown>table thead th,
.table thead th {
    background: rgba(15, 23, 42, .05);
}

.table-hover>tbody>tr:hover>* {
    --tblr-table-bg-state: var(--hover-bg);
}



/* ===== Sidebar estilo Twitter ===== */

/* Base del nav */
.navbar-vertical .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--dark);
    border-radius: 9999px !important;
    padding: 0.75rem 1rem;
    transition: background-color 0.2s, color 0.2s;
}

/* Íconos más grandes */
.navbar-vertical .nav-link .nav-link-icon i {
    font-size: 1.5rem;
}

/* Hover estilo píldora en links principales */
.navbar-vertical .nav-link:hover,
.navbar-vertical .nav-link.show {
    background-color: #e2e8f0 !important;
    color: var(--dark) !important;
}

/* Activo en links principales */
.navbar-vertical .nav-link.active {
    font-weight: 700;
    color: var(--dark);
}

/* ================= DROPDOWNS ================= */

/* Items del dropdown */
.navbar-vertical .dropdown-menu .dropdown-item {
    font-size: 1rem;
    font-weight: 400;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    /* opcional, no píldora */
    color: var(--dark);
    transition: color 0.2s;
}

/* Hover dropdown → solo texto primary */
.dropdown-menu .dropdown-item:hover {
    color: var(--primary) !important;
    background-color: transparent;
}

/* Activo en dropdown → negrita y texto dark */
.dropdown-menu .dropdown-item.active {
    font-weight: 700;
    color: var(--dark) !important;
    background-color: transparent !important;
}

.dropdown-menu .dropdown-item:active {
    color: var(--dark) !important;
    background-color: transparent !important;
}

.dropdown-menu .dropdown-item.active:hover {
    color: var(--primary) !important;
}

/* Sidebar layout */
/* ===== Layout tipo Twitter solo en escritorio ===== */
.navbar-vertical .sidebar-footer .dropdown-toggle::after {
    display: none !important;
    /* quita chevron */
}

@media (min-width: 992px) {
    .navbar-vertical .container-fluid {
        display: flex;
        flex-direction: column;
        height: 100vh;
        padding: 1rem 0;
    }

    /* Menú principal centrado */
    .navbar-vertical .collapse.navbar-collapse {
        flex: 1;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    /* Footer (usuario/avatar) */
    .navbar-vertical .sidebar-footer {
        margin-top: auto;
        margin-bottom: 40px;
        /* espacio inferior */
        padding-top: 1rem;
    }

    /* Dropdown toggle estilo avatar */
    .navbar-vertical .sidebar-footer .dropdown-toggle {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        border-radius: 9999px;
        padding: 0.5rem 0.75rem;
        transition: background-color 0.2s;
        color: var(--dark);
        text-decoration: none;
    }

    .navbar-vertical .sidebar-footer .dropdown-toggle:hover {
        background-color: #e2e8f0 !important;
    }

    /* Forzar dropdown hacia arriba solo en escritorio */
    .navbar-vertical .sidebar-footer .dropup .dropdown-menu {
        bottom: 100%;
        top: auto;
        margin-bottom: 0.5rem;
    }
}

/* Desktop: dropup */
@media (min-width: 992px) {
    .navbar-vertical .sidebar-footer .dropdown-menu {
        bottom: 100%;
        top: auto;
        margin-bottom: 0.5rem;
    }
}

/* Móvil: dropdown hacia abajo */
@media (max-width: 991.98px) {
    .navbar-vertical .sidebar-footer .dropdown-menu {
        right: 0;
        left: auto;
        top: 100%;
        bottom: auto;
        margin-top: 0.5rem;
    }
}

/* QR Widgets */
.qr-download .download-icon {
    margin-right: .5rem !important;
}

.qr-download-sm .download-icon {
    margin-right: 0 !important;
}

.qr-download-sm .download-label {
    display: none;
}

.qr-download-sm .card-btn {
    padding: .25rem !important;
}

/* BITÁCORA */
/* Square images for photo gallery */
.square-img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    width: 100%;
    max-width: 150px;
    max-height: 150px;
}


/* Log Entry Card */
.card-hover.log-entry:hover {
    background-color: #fff;
}

.log-entry {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    max-width: 600px;
    margin: 0 auto 1rem;
}

.log-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}


/* PANEL */
.dashboard-header {
    background: #3E2DE6;
    background: linear-gradient(97deg, rgba(62, 45, 230, 1) 0%, rgba(36, 34, 92, 1) 100%);
    color: white;
    padding: 2rem 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
}

.dashboard-title {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.dashboard-subtitle {
    font-size: 1.125rem;
    opacity: 0.8;
    margin-bottom: 0;
}


/* Clean Metric Card Styles */
.metric-card {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    height: 100%;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: rgba(148, 163, 184, 0.3);
}

.metric-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #64748b;
    margin-bottom: 1.25rem;
    text-align: center;
}

/* Progress Indicator */
.progress-container {
    margin-bottom: 1.5rem;
    text-align: center;
}

.progress-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    animation: progressAnimation 2s ease-out forwards;
}

@keyframes progressAnimation {
    from {
        width: 0%;
    }
}

.progress-label {
    font-size: 0.7rem;
    font-weight: 500;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Status colors - clean and professional */
.status-excellent .progress-bar-fill {
    background: #10b981;
}

.status-good .progress-bar-fill {
    background: #3b82f6;
}

.status-warning .progress-bar-fill {
    background: #f59e0b;
}

.status-critical .progress-bar-fill {
    background: #ef4444;
}

/* Clean metric details */
.metric-details {
    background: #f8fafc;
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #e2e8f0;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.metric-item:last-child {
    border-bottom: none;
}

.metric-item-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: #475569;
    flex: 1;
}

.metric-item-value {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.metric-badge {
    color: #94a3b8;
    font-size: 0.7rem;
    letter-spacing: 0.025em;
}

/* Subtle focus states */
.metric-card:focus-within {
    border-color: #3b82f6;
    outline: none;
}

.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    margin-bottom: 1.5rem;
}

.line-chart-container {
    position: relative;
    height: 300px;
    width: 100%;
    margin-bottom: 1.5rem;
}

.user-metrics-table tbody tr:last-child,
.user-metrics-table tbody tr:last-child td {
    border-bottom: none;
}