/* RESET Y BASE */
.sim-wrapper * { box-sizing: border-box; }

.sim-wrapper {
    font-family: 'Rubik', sans-serif;
    max-width: 900px;
    margin: 20px auto;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid #e5e7eb;
    color: #374151;
    overflow: hidden;
    position: relative;
}

/* CABECERA */
.sim-header {
    background-color: #f8fafc;
    color: #1e293b;
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.sim-header h2 { margin: 0; font-size: 1.8rem; font-weight: 600; color: #fff; }
.sim-header p { color: #4b5563; margin-top: 5px; font-weight: 300; }

/* NAVEGACIÓN Y BUSCADOR */
.sim-nav {
    padding: 30px 40px;
    border-bottom: 1px solid #e5e7eb;
    background: #f8fafc;
}

.sim-search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.sim-search-input {
    width: 100%;
    padding: 15px 20px;
    padding-left: 45px;
    border: 2px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: border-color 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    font-family: 'Rubik', sans-serif;
    background-color: #fff;
}

.sim-search-input:focus { outline: none; border-color: #2563eb; }

.sim-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.5;
    pointer-events: none;
}

/* DROPDOWN RESULTADOS */
.sim-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 50;
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.sim-dropdown-item {
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    color: #475569;
    transition: background 0.1s;
}

.sim-dropdown-item:last-child { border-bottom: none; }
.sim-dropdown-item:hover { background-color: #eff6ff; color: #2563eb; }

/* LISTA ESTÁTICA RESPONSIVA */
.sim-static-list {
    margin-top: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 15px;
}

.sim-static-item {
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
    padding: 5px 0;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

.sim-static-item::before {
    content: "•";
    color: #cbd5e1;
    margin-right: 8px;
    font-size: 1.2rem;
    line-height: 0;
}

.sim-static-item:hover { color: #2563eb; text-decoration: underline; }
.sim-static-item.active-item { font-weight: 600; color: #2563eb; }

/* ÁREA DE TRABAJO */
.sim-workspace {
    padding: 40px;
    display: none;
    animation: fadeIn 0.4s;
}

.sim-form-title {
    font-size: 1.5rem;
    color: #1e293b;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid #2563eb;
    display: inline-block;
    font-weight: 500;
}

/* GRID RESPONSIVO PARA INPUTS */
.sim-inputs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    margin-bottom: 20px;
    align-items: start;
}

@media (min-width: 650px) {
    .sim-inputs-grid {
        grid-template-columns: 1fr 1fr;
    }
}

#dynamicForm { display: block !important; width: 100%; }

.sim-group { display: flex; flex-direction: column; position: relative; margin-bottom: 10px; }
.sim-label { font-size: 0.9rem; font-weight: 500; margin-bottom: 8px; color: #475569; }

.sim-input, .sim-select {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 1rem;
    width: 100%;
    font-family: 'Rubik', sans-serif;
}

.sim-custom-iva-input {
    margin-top: 10px;
    display: none;
    animation: fadeIn 0.3s;
    border-color: #2563eb;
    background-color: #eff6ff;
}

/* OPCIONES */
.sim-options-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #4b5563;
    margin-bottom: 10px;
    display: none;
    margin-top: 25px;
    width: 100%;
}

.sim-options-wrapper {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    display: none;
    width: 100%;
}

.sim-option-block {
    margin-bottom: 10px;
    width: 100%;
    display: block;
}

.sim-option-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #334155;
    user-select: none;
    padding: 5px 0;
}

.sim-option-toggle span { font-size: 0.9rem; font-weight: 500; }
.sim-option-toggle input { width: 18px; height: 18px; cursor: pointer; accent-color: #2563eb; }

/* Contenido opciones responsivo */
.sim-option-content {
    display: none;
    margin-top: 10px;
    padding: 15px 0;
    border-top: 1px dashed #cbd5e1;
    border-bottom: 1px dashed #cbd5e1;
    margin-bottom: 15px;
    grid-template-columns: 1fr;
    gap: 20px;
    animation: fadeIn 0.3s;
}

@media (min-width: 650px) {
    .sim-option-content:not(.full-width) {
        grid-template-columns: 1fr 1fr;
    }
}

.sim-option-content.show { display: grid; }
.sim-option-content.full-width { grid-template-columns: 1fr; }

.width-reduced { max-width: 280px; }

/* PLAZOS */
.plazos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.plazo-item input { border-color: #bfdbfe; }
.plazo-msg-error { color: #ef4444; font-size: 0.8rem; margin-top: 5px; display: none; }
.max-msg { color: #ef4444; font-size: 0.8rem; margin-left: 10px; display:none;}

.sim-plazo-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 10px;
    border-radius: 6px;
}
.sim-date-small { font-size: 0.7rem; color: #2563eb; font-weight: 600; margin-top: 4px; display: block; }

.sim-btn {
    grid-column: 1 / -1;
    width: 100%;
    background-color: #2563eb;
    color: white;
    font-weight: 600;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 10px;
    font-family: 'Rubik', sans-serif;
}
.sim-btn:hover { background-color: #1d4ed8; }
.sim-btn:disabled { background-color: #94a3b8; cursor: not-allowed; }

/* RESULTADO */
.sim-result-area {
    margin-top: 40px;
    border-top: 1px dashed #cbd5e1;
    padding-top: 20px;
    display: none; /* Se mostrará con JS */
}

.journal-container {
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow-x: auto; /* Scroll en móvil */
    background: white;
}

.journal-header-table {
    width: 100%;
    min-width: 600px;
    border-collapse: collapse;
    background-color: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
}

.journal-header-table td {
    padding: 10px 15px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #334155;
}

.header-date {
    width: 150px;
    color: #64748b !important;
    font-weight: 500 !important;
    border-right: 1px solid #e2e8f0;
    white-space: nowrap;
}

.header-title { color: #334155; text-align: left; }

.journal-table { width: 100%; min-width: 600px; border-collapse: collapse; font-family: 'Rubik', sans-serif; }
.journal-table th { background-color: #ffffff; text-align: left; padding: 12px; border-bottom: 2px solid #f1f5f9; font-size: 0.85rem; color: #64748b; font-weight: 600; text-transform: uppercase; }
.journal-table td { padding: 12px; border-bottom: 1px solid #f1f5f9; font-size: 0.95rem; }
.journal-table tr:last-child td { border-bottom: none; }

.col-cuenta { width: 15%; font-weight: 600; color: #334155; }
.col-desc { width: 55%; }
.col-debe { width: 15%; text-align: right; background-color: #f8fafc; font-weight: 500; }
.col-haber { width: 15%; text-align: right; font-weight: 500; }
.journal-row-debe td.col-desc { padding-left: 0; }
.journal-row-haber td.col-desc { padding-left: 40px; color: #64748b; }

/* SECCIÓN DETALLE CUENTAS (EXPLICACIÓN) */
.sim-account-details {
    margin-top: 20px; margin-bottom: 30px; padding: 20px;
    background-color: #f8fafc; border-radius: 8px; border-left: 4px solid #cbd5e1;
    display: none; /* Importante: empieza oculto */
}
.sim-account-details h4 { margin: 0 0 15px 0; font-size: 1rem; color: #334155; font-weight: 600; border-bottom: 1px solid #e2e8f0; padding-bottom: 8px; }
.sim-account-item { font-size: 0.9rem; color: #475569; margin-bottom: 8px; line-height: 1.5; }
.sim-account-item strong { color: #1e293b; font-weight: 600; }

/* BOTONERA ACCIONES */
.sim-actions-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 15px; margin-top: 25px; }
.sim-action-btn { padding: 12px; border-radius: 6px; cursor: pointer; font-weight: 600; transition: all 0.2s; font-size: 0.95rem; border: none; display: flex; align-items: center; justify-content: center; gap: 8px; font-family: 'Rubik', sans-serif; text-align: center; }
.btn-copy { background-color: #3b82f6; color: white; } .btn-copy:hover { background-color: #2563eb; }
.btn-excel { background-color: #10b981; color: white; } .btn-excel:hover { background-color: #059669; }
.btn-reset { background-color: #ef4444; color: white; } .btn-reset:hover { background-color: #dc2626; }

.journal-connector { text-align: center; color: #cbd5e1; font-size: 1.5rem; margin: -15px 0 15px 0; }

.copy-feedback { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #1e293b; color: white; padding: 10px 20px; border-radius: 30px; font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 1000; box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.copy-feedback.show { opacity: 1; }

.sim-info-note { font-size: 0.8rem; color: #2563eb; background: #eff6ff; padding: 10px; border-radius: 6px; margin-top: 5px; border-left: 3px solid #3b82f6; line-height: 1.4; }
.sim-success-note { font-size: 0.8rem; color: #059669; background: #ecfdf5; padding: 10px; border-radius: 6px; margin-top: 5px; border-left: 3px solid #10b981; }

.sim-loading{padding:12px 14px;border:1px dashed #cfcfcf;border-radius:10px;background:#fafafa;font-size:.95rem}
.sim-error{padding:12px 14px;border:1px solid #f5c2c7;border-radius:10px;background:#f8d7da;color:#842029;font-size:.95rem}

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* RESULT PREVIEW BOX (Venta Inmovilizado) */
.sim-result-preview { 
    font-size: 0.9rem; 
    margin-top: 15px; 
    padding: 15px; 
    border-radius: 8px; 
    font-weight: 500;
    display: none;
    line-height: 1.5;
}
.sim-result-ok { background-color: #ecfdf5; color: #059669; border: 1px solid #a7f3d0; }
.sim-result-bad { background-color: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* ESTILOS ESPECIFICOS PARA TABLAS DE RESUMEN DE CALCULO */
.sim-summary-table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-bottom: 15px; 
    font-size: 0.9rem; 
    border: 1px solid #e2e8f0; 
    border-radius: 6px; 
    overflow: hidden; 
    background-color: #fff;
}

.sim-summary-table th { 
    background: #f1f5f9; 
    padding: 8px 12px; 
    text-align: left; 
    color: #475569; 
    font-weight: 600; 
    border-bottom: 1px solid #e2e8f0; 
}

.sim-summary-table td { 
    padding: 8px 12px; 
    border-bottom: 1px solid #f1f5f9; 
    color: #334155; 
}

.sim-summary-table tr:last-child td { 
    border-bottom: none; 
}

.sim-highlight { color: #2563eb; font-weight: 600; }
.sim-positive { color: #059669; font-weight: 600; }
.sim-negative { color: #dc2626; font-weight: 600; }                            