/**
 * Estilos Personalizados - Sistema EPSA de Agua Potable (Diseño Minimalista y Limpio)
 */

:root {
    --epsa-primary: #184c78;
    --epsa-primary-dark: #0f3352;
    --epsa-sidebar-bg: #0f233a;
    --epsa-sidebar-hover: rgba(255, 255, 255, 0.08);
    --epsa-sidebar-active: #0284c7;
    --epsa-accent: #0ea5e9;
    --epsa-accent-hover: #0284c7;
    --epsa-bg: #f8fafc;
    --epsa-card-bg: #ffffff;
    --epsa-text-main: #0f172a;
    --epsa-text-muted: #64748b;
    --epsa-border: #e2e8f0;
    --epsa-border-subtle: #f1f5f9;
}

body {
    background-color: var(--epsa-bg);
    color: var(--epsa-text-main);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    font-size: 0.925rem;
    line-height: 1.5;
}

/* ========================================================
   Sidebar de Navegación Minimalista
   ======================================================== */
.sidebar {
    background-color: var(--epsa-sidebar-bg);
    min-height: 100vh;
    width: 260px;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.05);
    transition: width 0.25s ease, left 0.25s ease;
    z-index: 1020;
}

.sidebar .brand {
    padding: 1.15rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar .brand-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.3px;
}

.sidebar-heading {
    color: #94a3b8;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    padding: 1rem 1.25rem 0.35rem;
    margin-top: 0.25rem;
}

.sidebar .nav-link {
    color: #cbd5e1;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.55rem 0.9rem;
    border-radius: 8px;
    margin: 0.1rem 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    transition: all 0.15s ease-in-out;
}

.sidebar .nav-link i {
    font-size: 1.05rem;
    opacity: 0.85;
}

.sidebar .nav-link:hover {
    color: #ffffff;
    background-color: var(--epsa-sidebar-hover);
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    color: #ffffff;
    background-color: var(--epsa-sidebar-active);
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.sidebar .nav-link.active i {
    opacity: 1;
}

/* Submenús indentados */
.sidebar-subnav {
    list-style: none;
    padding-left: 2rem;
    margin: 0.2rem 0;
}

.sidebar-subnav .nav-link {
    font-size: 0.825rem;
    padding: 0.4rem 0.75rem;
    margin: 0.05rem 0.5rem;
    color: #94a3b8;
}

.sidebar-subnav .nav-link:hover {
    color: #ffffff;
}

.sidebar-subnav .nav-link.active {
    background-color: rgba(2, 132, 199, 0.25);
    color: #38bdf8;
    box-shadow: none;
}

/* ========================================================
   Topbar y Cabecera Superior
   ======================================================== */
.topbar {
    background: #ffffff;
    border-bottom: 1px solid var(--epsa-border);
    padding: 0.65rem 1.5rem;
    min-height: 60px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Buscador Rápido Global */
.global-search-container {
    position: relative;
    width: 100%;
    max-width: 420px;
}

.global-search-input {
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 0.45rem 1rem 0.45rem 2.25rem;
    font-size: 0.85rem;
    color: #1e293b;
    transition: all 0.2s;
    width: 100%;
}

.global-search-input:focus {
    background-color: #ffffff;
    border-color: #0284c7;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
    outline: none;
}

.global-search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
}

.global-search-kbd {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    padding: 1px 5px;
    color: #64748b;
    pointer-events: none;
}

/* Panel flotante de resultados de búsqueda */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    max-height: 420px;
    overflow-y: auto;
    z-index: 1050;
    display: none;
}

.search-results-dropdown.show {
    display: block;
}

.search-item {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s;
}

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

.search-item:hover, .search-item:focus {
    background-color: #f8fafc;
}

.search-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Botón de Cobro Rápido en Topbar */
.btn-quick-cobro {
    background-color: #059669;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.825rem;
    border-radius: 8px;
    padding: 0.45rem 0.9rem;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.btn-quick-cobro:hover {
    background-color: #047857;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

/* ========================================================
   Migas de Pan (Breadcrumbs)
   ======================================================== */
.breadcrumb-wrapper {
    background: transparent;
    padding: 0.4rem 0 0.85rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.breadcrumb-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    font-size: 0.825rem;
    color: #64748b;
    list-style: none;
    margin: 0;
    padding: 0;
}

.breadcrumb-nav a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.15s;
}

.breadcrumb-nav a:hover {
    color: var(--epsa-primary);
}

.breadcrumb-nav .separator {
    color: #cbd5e1;
    font-size: 0.7rem;
}

.breadcrumb-nav .active {
    color: #0f172a;
    font-weight: 600;
}

/* ========================================================
   Tarjetas y Contenedores Minimalistas
   ======================================================== */
.card-custom {
    background: var(--epsa-card-bg);
    border: 1px solid var(--epsa-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card-custom:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.kpi-card {
    border-radius: 12px;
    border: 1px solid var(--epsa-border);
    padding: 1.15rem;
    background: #ffffff;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.05);
}

.kpi-card .kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.kpi-title {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--epsa-text-muted);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--epsa-text-main);
    line-height: 1.2;
}

/* Tablas Minimalistas */
.table-custom {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.table-custom th {
    background-color: #f8fafc;
    color: #475569;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--epsa-border);
    border-top: none;
}

.table-custom td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--epsa-border);
    font-size: 0.875rem;
}

.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

/* Badges Suaves (Soft Badges) */
.badge-status-pendiente, .badge-soft-warning {
    background-color: #fef3c7;
    color: #92400e;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    border: 1px solid #fde68a;
}

.badge-status-pagada, .badge-status-activo, .badge-status-confirmado, .badge-status-aprobado, .badge-status-ejecutado, .badge-soft-success {
    background-color: #dcfce7;
    color: #166534;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    border: 1px solid #bbf7d0;
}

.badge-status-vencida, .badge-status-cortado, .badge-status-anulada, .badge-status-rechazado, .badge-soft-danger {
    background-color: #fee2e2;
    color: #991b1b;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    border: 1px solid #fecaca;
}

.badge-status-parcial, .badge-status-observada {
    background-color: #ffedd5;
    color: #9a3412;
    font-weight: 600;
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    border: 1px solid #fed7aa;
}

/* Botones Principales */
.btn-epsa {
    background-color: var(--epsa-primary);
    color: #ffffff;
    border: none;
    font-weight: 600;
    border-radius: 8px;
    padding: 0.45rem 1.1rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-epsa:hover {
    background-color: var(--epsa-primary-dark);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(24, 76, 120, 0.25);
}

/* Botón Regresar Limpio */
.btn-back-clean {
    color: #64748b;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    transition: all 0.15s;
}

.btn-back-clean:hover {
    color: var(--epsa-primary);
    background-color: #f1f5f9;
}

/* Responsive */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -270px;
        width: 270px;
        height: 100%;
    }
    .sidebar.show {
        left: 0;
    }
    .global-search-container {
        max-width: 260px;
    }
}
