/* =================================================================
   JCR Cotizaciones - Hoja de estilos principal
   ================================================================= */

/* ---------- Reset y tipografía base ---------- */
* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: #1f2933;
    background: #f4f6f8;
    min-height: 100vh;
}

h1, h2, h3, h4 {
    color: #1e3a5f;
    margin-top: 0;
    line-height: 1.25;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

a {
    color: #1e3a5f;
    text-decoration: none;
}
a:hover { text-decoration: underline; }

p { margin: 0 0 0.75rem; }

/* ---------- Navbar ---------- */
.navbar {
    background: #1e3a5f;
    color: #fff;
    padding: 0 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    padding: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.navbar-brand:hover { text-decoration: none; color: #fff; }

.navbar-logo {
    background: #27ae60;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.navbar-menu a {
    color: rgba(255, 255, 255, 0.85);
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    font-size: 0.95rem;
    display: inline-block;
}

.navbar-menu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
}

.navbar-menu a.active {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.navbar-user {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    padding-left: 0.75rem;
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    margin-left: 0.25rem;
}

.navbar-logout {
    color: rgba(255, 255, 255, 0.9);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}
.navbar-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
    color: #fff;
}

.navbar-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
}

/* ---------- Layout principal ---------- */
.contenedor {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 3rem;
}

.encabezado-pagina {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.encabezado-pagina h1,
.encabezado-pagina h2 { margin: 0; }

.texto-ayuda {
    color: #6b7785;
    font-size: 0.9rem;
    font-style: italic;
    margin: 0 0 1rem;
}

/* ---------- Tarjetas ---------- */
.tarjeta {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
}

.tarjeta h3 {
    margin-top: 0;
    border-bottom: 1px solid #e1e5ea;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

/* ---------- Botones ---------- */
.btn,
button.btn {
    display: inline-block;
    background: #1e3a5f;
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.05s ease;
    font-family: inherit;
}

.btn:hover {
    background: #163050;
    color: #fff;
    text-decoration: none;
}

.btn:active { transform: translateY(1px); }

.btn-primario { background: #1e3a5f; }
.btn-exito    { background: #27ae60; }
.btn-exito:hover { background: #1e8449; }
.btn-peligro  { background: #c0392b; }
.btn-peligro:hover { background: #a12818; }
.btn-secundario {
    background: #6b7785;
}
.btn-secundario:hover { background: #52606d; }

.btn-chico {
    padding: 0.3rem 0.7rem;
    font-size: 0.85rem;
}

.grupo-botones {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* ---------- Tablas ---------- */
.tabla-contenedor {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.tabla-contenedor table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.tabla-contenedor th,
.tabla-contenedor td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #e1e5ea;
    vertical-align: middle;
}

.tabla-contenedor th {
    background: #f4f6f8;
    color: #1e3a5f;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tabla-contenedor tr:last-child td { border-bottom: none; }
.tabla-contenedor tr:hover td { background: #fafbfc; }

.tabla-contenedor .col-numerica { text-align: right; }
.tabla-contenedor .col-acciones { text-align: right; white-space: nowrap; }

/* ---------- Badges de estado ---------- */
.badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #e1e5ea;
    color: #52606d;
}

.badge-borrador  { background: #e1e5ea; color: #52606d; }
.badge-enviada   { background: #d6e6f2; color: #1e3a5f; }
.badge-aprobada  { background: #d6efd9; color: #1e6e2c; }
.badge-rechazada { background: #f5d3d0; color: #8a1d12; }
.badge-vigente   { background: #d6efd9; color: #1e6e2c; }

/* ---------- Formularios ---------- */
.formulario {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 1.25rem;
}

.form-grid .campo-full { grid-column: 1 / -1; }

.campo { display: flex; flex-direction: column; }

.campo label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #52606d;
    margin-bottom: 0.3rem;
}

.campo input[type="text"],
.campo input[type="email"],
.campo input[type="password"],
.campo input[type="date"],
.campo input[type="number"],
.campo select,
.campo textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid #d4dae0;
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fff;
    color: #1f2933;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.campo input:focus,
.campo select:focus,
.campo textarea:focus {
    outline: none;
    border-color: #1e3a5f;
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.campo textarea { resize: vertical; min-height: 80px; }

.campo-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    color: #1f2933;
    margin-top: 0.5rem;
}
.campo-checkbox input { width: auto !important; }

fieldset.item-grupo {
    border: 1px solid #e1e5ea;
    border-radius: 6px;
    padding: 0.9rem 1rem;
    margin: 0 0 0.75rem;
    background: #fafbfc;
}

fieldset.item-grupo legend {
    font-weight: 600;
    color: #1e3a5f;
    padding: 0 0.4rem;
    font-size: 0.9rem;
}

fieldset.item-grupo .form-grid { gap: 0.6rem 0.9rem; }

/* ---------- Resumen / datos en detalle ---------- */
.dato-lista {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.5rem 1rem;
    margin: 0;
}
.dato-lista dt {
    font-weight: 600;
    color: #52606d;
    font-size: 0.9rem;
}
.dato-lista dd { margin: 0; color: #1f2933; }

.total-destacado {
    background: #1e3a5f;
    color: #fff;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
}
.total-destacado .etiqueta {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.85;
}
.total-destacado .monto {
    font-size: 1.6rem;
    font-weight: 700;
}

.versiones-nav {
    background: #fafbfc;
    border: 1px solid #e1e5ea;
    border-radius: 6px;
    padding: 0.6rem 0.9rem;
    font-size: 0.9rem;
    margin: 0.75rem 0 1rem;
}
.versiones-nav a {
    font-weight: 600;
}

/* ---------- Dashboard (atajos) ---------- */
.dashboard-atajos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
}
.dashboard-atajo {
    display: block;
    background: #f4f6f8;
    border: 1px solid #e1e5ea;
    border-radius: 8px;
    padding: 1rem 1.1rem;
    color: #1f2933;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.dashboard-atajo:hover {
    background: #e8eff7;
    border-color: #1e3a5f;
    text-decoration: none;
    color: #1f2933;
}
.dashboard-atajo:active { transform: translateY(1px); }
.dashboard-atajo-titulo {
    font-weight: 700;
    color: #1e3a5f;
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
}
.dashboard-atajo-desc {
    font-size: 0.88rem;
    color: #52606d;
}

/* ---------- Mensajes flash ---------- */
.mensaje {
    padding: 0.7rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    border: 1px solid transparent;
}
.mensaje-error   { background: #fdecea; color: #8a1d12; border-color: #f5c6c1; }
.mensaje-exito   { background: #e7f4ea; color: #1e6e2c; border-color: #c5e3cd; }
.mensaje-info    { background: #e8eff7; color: #1e3a5f; border-color: #c8d6e6; }

/* ---------- Login ---------- */
.login-pagina {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a5f 0%, #2c5282 100%);
    padding: 1rem;
}

.login-tarjeta {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    padding: 2.25rem 2rem;
    width: 100%;
    max-width: 400px;
}

.login-tarjeta .logo {
    background: #1e3a5f;
    color: #fff;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.login-tarjeta h1 {
    text-align: center;
    margin: 0 0 0.25rem;
    font-size: 1.5rem;
}
.login-tarjeta .subtitulo {
    text-align: center;
    color: #6b7785;
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
}

/* ---------- Utilidades ---------- */
.vacio {
    text-align: center;
    padding: 2rem 1rem;
    color: #6b7785;
    font-style: italic;
}

.mt-0  { margin-top: 0; }
.mt-1  { margin-top: 0.5rem; }
.mt-2  { margin-top: 1rem; }
.mb-0  { margin-bottom: 0; }
.mb-1  { margin-bottom: 0.5rem; }
.texto-derecha { text-align: right; }
.texto-mayusculas { text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.05em; color: #6b7785; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .navbar-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #1e3a5f;
        flex-direction: column;
        align-items: stretch;
        padding: 0.5rem 0.75rem 0.75rem;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }
    .navbar-menu.abierto { display: flex; }
    .navbar-menu a { padding: 0.7rem 0.9rem; }
    .navbar-toggle { display: inline-block; }
    .navbar-user { display: none; }

    .form-grid { grid-template-columns: 1fr; }
    .dato-lista { grid-template-columns: 1fr; gap: 0.15rem 0; }
    .dato-lista dt { margin-top: 0.6rem; }

    .dashboard-atajos { grid-template-columns: 1fr; }

    .tabla-contenedor {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tabla-contenedor table { min-width: 600px; }

    .encabezado-pagina { flex-direction: column; align-items: stretch; }
    .total-destacado { flex-direction: column; align-items: flex-start; gap: 0.25rem; }
}

@media (max-width: 480px) {
    .contenedor { padding: 1rem 0.75rem 2rem; }
    .tarjeta, .formulario { padding: 1rem; }
    h1 { font-size: 1.4rem; }
}
.logo-login {
    display: block;
    max-width: 140px;
    height: auto;
    margin: 0 auto 20px auto;
    border: none;
    background: none;
    border-radius: 0;
    box-shadow: none;
}
