/*
 * Tema visual acorde al logo de pmasd.ar: azul marino ("p"/"d"), celeste
 * ("masd"), negro (".ar") y rojo (punto). Bootstrap 5.3 no reteñe sus
 * componentes sólo con --bs-primary, así que además de las variables
 * globales se pisan explícitamente los tokens de cada componente.
 */

:root {
    --brand-navy: #2c5c99;
    --brand-blue: #4f97d9;
    --brand-black: #1d1d1b;
    --brand-red: #e2231a;
    --brand-gradient: linear-gradient(135deg, var(--brand-navy), var(--brand-blue));

    --bs-primary: var(--brand-navy);
    --bs-primary-rgb: 44, 92, 153;
    --bs-link-color: var(--brand-navy);
    --bs-link-color-rgb: 44, 92, 153;
    --bs-link-hover-color: var(--brand-blue);
    --bs-link-hover-color-rgb: 79, 151, 217;
}

body {
    background-color: #f2f6fb;
}

a {
    color: var(--brand-navy);
}
a:hover {
    color: var(--brand-blue);
}

/* ---------------------- Marca / logo ---------------------- */

.brand-logo {
    height: 34px;
    display: block;
}

.navbar-brand-badge {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border-radius: .4rem;
    padding: .3rem .6rem;
}

.brand-wordmark {
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: -.02em;
}
.brand-wordmark .w-navy { color: var(--brand-navy); }
.brand-wordmark .w-blue { color: var(--brand-blue); }
.brand-wordmark .w-dot { color: var(--brand-red); }
.brand-wordmark .w-ar { color: var(--brand-black); }

/* ---------------------- Navbar ---------------------- */

.navbar.bg-primary {
    background: var(--brand-gradient) !important;
}

/* ---------------------- Botones ---------------------- */

.btn-primary {
    --bs-btn-bg: var(--brand-navy);
    --bs-btn-border-color: var(--brand-navy);
    --bs-btn-hover-bg: var(--brand-blue);
    --bs-btn-hover-border-color: var(--brand-blue);
    --bs-btn-active-bg: var(--brand-blue);
    --bs-btn-active-border-color: var(--brand-blue);
    --bs-btn-disabled-bg: var(--brand-navy);
    --bs-btn-disabled-border-color: var(--brand-navy);
    --bs-btn-focus-shadow-rgb: 79, 151, 217;
}

.btn-outline-primary {
    --bs-btn-color: var(--brand-navy);
    --bs-btn-border-color: var(--brand-navy);
    --bs-btn-hover-bg: var(--brand-navy);
    --bs-btn-hover-border-color: var(--brand-navy);
    --bs-btn-active-bg: var(--brand-navy);
    --bs-btn-active-border-color: var(--brand-navy);
    --bs-btn-focus-shadow-rgb: 79, 151, 217;
}

/* ---------------------- Utilidades de color ---------------------- */

.text-primary { color: var(--brand-navy) !important; }
.border-primary { border-color: var(--brand-navy) !important; }
.badge.bg-primary { background-color: var(--brand-navy) !important; }
.badge.bg-info-subtle { background-color: #e7f1fb !important; }
.badge.bg-info-subtle.text-info-emphasis { color: var(--brand-navy) !important; }

/* ---------------------- Tabs ---------------------- */

.nav-tabs .nav-link.active {
    color: var(--brand-navy);
    border-bottom: 2px solid var(--brand-navy);
}
.nav-tabs .nav-link:hover {
    color: var(--brand-blue);
}

/* ---------------------- Formularios ---------------------- */

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 .25rem rgba(79, 151, 217, .25);
}

/* Formularios de alta/edición de cliente, artículo, configuración de facturación y Facturar */
#modalCliente .modal-title,
#modalArticulo .modal-title,
#modalConfigEmpresa .modal-title,
#tabFacturar h2 {
    color: var(--brand-red);
}
#modalCliente h6,
#modalArticulo h6,
#modalConfigEmpresa h6,
#tabFacturar h6 {
    color: var(--brand-blue) !important;
    font-weight: 700;
}
#modalCliente .form-label,
#modalArticulo .form-label,
#modalConfigEmpresa .form-label,
#tabFacturar .form-label {
    color: var(--brand-navy) !important;
    font-weight: 700;
}
#modalCliente .form-control,
#modalCliente .form-select,
#modalArticulo .form-control,
#modalArticulo .form-select,
#modalConfigEmpresa .form-control,
#modalConfigEmpresa .form-select,
#tabFacturar .form-control,
#tabFacturar .form-select {
    border-color: var(--brand-red);
}
#modalArticulo .form-check {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding-left: .75rem;
}
#modalArticulo .form-check .form-check-input {
    float: none;
    flex-shrink: 0;
    margin-left: 0;
    margin-top: 0;
    border-color: var(--brand-red);
}

/* Facturar: tipografía compacta para que entren más ítems sin scrollear */
#tabFacturar {
    font-size: .8rem;
}
#tabFacturar .form-control,
#tabFacturar .form-select {
    font-size: .78rem;
    padding: .2rem .5rem;
    min-height: calc(1.4em + .4rem + 2px);
}
#tabFacturar .btn {
    font-size: .78rem;
    padding: .25rem .6rem;
}
#tabFacturar table {
    font-size: .78rem;
}
#tabFacturar h2 {
    font-size: 1rem;
}
#tabFacturar .subtotal-box {
    display: inline-block;
    border: 1px solid var(--brand-blue);
    border-radius: .25rem;
    background: rgba(79, 151, 217, .08);
    font-weight: 700;
    padding: .2rem .5rem;
    width: 7.5rem;
    text-align: right;
}

/* Combos de cliente/artículo con búsqueda (Tom Select) dentro de Facturar.
   El dropdown se abre con dropdownParent:'body' (para no quedar recortado
   por el overflow de .table-responsive), así que no es descendiente de
   #tabFacturar en el DOM y su regla va sin scope. */
#tabFacturar .ts-wrapper,
#tabFacturar .ts-control {
    font-size: .78rem;
}
.ts-dropdown {
    font-size: .78rem;
}
#tabFacturar .ts-control {
    border-color: var(--brand-red);
    min-height: calc(1.4em + .4rem + 2px);
    padding: .2rem .5rem;
}
#tabFacturar .ts-wrapper.focus .ts-control {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 .25rem rgba(79, 151, 217, .25);
}

/* Facturas emitidas: tipografía compacta para que cada fila entre en una
   sola línea sin scroll horizontal. */
#tabFacturas table {
    font-size: .75rem;
}
#tabFacturas table td,
#tabFacturas table th {
    white-space: nowrap;
}

/* ---------------------- Tarjetas ---------------------- */

.card.shadow-sm {
    box-shadow: 0 .25rem .75rem rgba(44, 92, 153, .08) !important;
}
