/* Certificacion de Pilas - Estilos propios del modulo */
/* Paleta heredada: Navy #1e3255, Azul #444b6d, Gris #70706f */

/* ---------- Login ---------- */
.cp-login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3255 0%, #444b6d 50%, #1e3255 100%);
}

.cp-login-card {
    background: white;
    border-radius: 1rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 24rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

/* ---------- Inputs ---------- */
.cp-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
    outline: none;
    background-color: #ffffff;
}

.cp-input:focus {
    border-color: #1e3255;
    box-shadow: 0 0 0 3px rgba(30, 50, 85, 0.1);
}

.cp-select {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: #ffffff;
    outline: none;
}

.cp-select:focus {
    border-color: #1e3255;
}

/* ---------- Botones ---------- */
.cp-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    background-color: #1e3255;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cp-btn-primary:hover {
    background-color: #444b6d;
}

.cp-btn-primary:disabled {
    background-color: #9ca3af;
    cursor: not-allowed;
}

.cp-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    background-color: #ffffff;
    color: #1e3255;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cp-btn-secondary:hover {
    background-color: #f8fafc;
}

.cp-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: #dc2626;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cp-btn-danger:hover {
    background-color: #b91c1c;
}

/* ---------- Sidebar ---------- */
.cp-sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    color: rgba(255, 255, 255, 0.75);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: background-color 0.15s, color 0.15s;
}

.cp-sidebar-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.cp-sidebar-link.active {
    background-color: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 500;
}

/* ---------- Tablas ---------- */
.cp-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.cp-table thead {
    background-color: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.cp-table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #1e3255;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cp-table td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #f1f5f9;
}

.cp-table tr:hover td {
    background-color: #f8fafc;
}

/* ---------- Badges ---------- */
.cp-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.cp-badge-success { background-color: #dcfce7; color: #166534; }
.cp-badge-danger  { background-color: #fee2e2; color: #991b1b; }
.cp-badge-info    { background-color: #dbeafe; color: #1e40af; }
.cp-badge-warning { background-color: #fef3c7; color: #92400e; }

/* ---------- Tarjetas ---------- */
.cp-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

/* ---------- Formulario: secciones, etiquetas ---------- */
.cp-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e3255;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.cp-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1e3255;
    margin-bottom: 0.25rem;
}

.cp-label-required::after {
    content: " *";
    color: #dc2626;
}

.cp-help {
    font-size: 0.75rem;
    color: #70706f;
    margin-top: 0.25rem;
}

/* ---------- Tabla dinamica de pilas ---------- */
.cp-pila-row {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1fr 2fr auto;
    gap: 0.5rem;
    align-items: end;
    padding: 0.5rem 0;
    border-bottom: 1px dashed #e2e8f0;
}

.cp-pila-row-empresa {
    display: grid;
    grid-template-columns: 3fr 1.2fr auto;
    gap: 0.5rem;
    align-items: end;
    padding: 0.5rem 0;
    border-bottom: 1px dashed #e2e8f0;
}

.cp-pila-row:last-child,
.cp-pila-row-empresa:last-child {
    border-bottom: none;
}

@media (max-width: 768px) {
    .cp-pila-row,
    .cp-pila-row-empresa {
        grid-template-columns: 1fr 1fr;
    }
}

.cp-icon-btn {
    background: #fef2f2;
    color: #dc2626;
    border: none;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cp-icon-btn:hover {
    background: #fee2e2;
}

.cp-pila-total {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cp-pila-total-label {
    font-size: 0.875rem;
    color: #70706f;
}

.cp-pila-total-valor {
    font-size: 1rem;
    font-weight: 600;
    color: #1e3255;
}

/* ---------- Desglose por tipo (peso acumulado en vivo) ---------- */
.cp-desglose-wrapper {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.cp-desglose-titulo {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1e3255;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
}

.cp-desglose-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.875rem;
    color: #444b6d;
    gap: 0.75rem;
}

.cp-desglose-item:not(:last-child) {
    border-bottom: 1px dashed #e2e8f0;
}

.cp-desglose-nombre {
    flex: 1;
}

.cp-desglose-meta {
    color: #70706f;
    font-size: 0.8125rem;
}

.cp-desglose-peso {
    font-weight: 600;
    color: #1e3255;
    min-width: 6rem;
    text-align: right;
}

/* ---------- Canvas de firma ---------- */
.cp-firma-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cp-firma-canvas {
    border: 2px dashed #cbd5e1;
    border-radius: 0.5rem;
    background-color: #ffffff;
    width: 100%;
    height: 220px;
    cursor: crosshair;
    touch-action: none;
}

.cp-firma-canvas.touched {
    border-style: solid;
    border-color: #1e3255;
}

.cp-firma-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.cp-firma-status {
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.cp-firma-status[data-state="vacio"]    { color: #70706f; }
.cp-firma-status[data-state="capturada"] { color: #16a34a; font-weight: 500; }

@media (min-width: 1024px) {
    .cp-firma-canvas {
        height: 260px;
    }
}

/* ---------- Estados de certificado (badges adicionales) ---------- */
.cp-badge-borrador { background-color: #f1f5f9; color: #475569; }
.cp-badge-emitido  { background-color: #dbeafe; color: #1e40af; }
.cp-badge-enviado  { background-color: #dcfce7; color: #166534; }
.cp-badge-anulado  { background-color: #fee2e2; color: #991b1b; }

/* ---------- Vista detalle (lectura) ---------- */
.cp-detalle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.cp-detalle-item label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #70706f;
}

.cp-detalle-item p {
    margin-top: 0.25rem;
    font-size: 0.9375rem;
    color: #1e3255;
}

.cp-firma-img {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    max-width: 420px;
}

/* ---------- Dashboard: tarjetas de metrica ---------- */
.cp-metric {
    background: white;
    border-radius: 0.5rem;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.cp-metric-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #70706f;
    font-weight: 600;
    margin: 0;
}

.cp-metric-valor {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1e3255;
    margin: 0.25rem 0 0 0;
    line-height: 1;
}

.cp-metric-sub {
    font-size: 0.75rem;
    color: #70706f;
    margin: 0.25rem 0 0 0;
}

.cp-metric-highlight {
    background: linear-gradient(135deg, #1e3255 0%, #444b6d 100%);
    border: none;
}

.cp-metric-highlight .cp-metric-label,
.cp-metric-highlight .cp-metric-sub {
    color: rgba(255, 255, 255, 0.7);
}

.cp-metric-highlight .cp-metric-valor {
    color: #ffffff;
}

/* ---------- Total general del formulario ---------- */
.cp-total-general {
    background: linear-gradient(135deg, #1e3255 0%, #444b6d 100%);
    border: none;
    color: #ffffff;
}

/* ---------- Tabs (panel admin) ---------- */
.cp-tab {
    padding: 0.625rem 1rem;
    background: transparent;
    color: #70706f;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: -1px;
}

.cp-tab:hover {
    color: #1e3255;
}

.cp-tab-active {
    padding: 0.625rem 1rem;
    background: transparent;
    color: #1e3255;
    border: none;
    border-bottom: 2px solid #1e3255;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: -1px;
}
