/* ================================================
   MODAL ASSET TABS - Sistema de tabs dinámicas
   ================================================ */

/* Base modal container */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-container {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
}

/* Modal más ancho para acomodar tabs */
.modal-container.modal-asset-tabs {
    max-width: 800px;
    width: 100%;
}

/* Tabs dentro del modal */
.modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    padding: 0 24px;
    background: var(--surface-secondary);
    overflow-x: auto;
    scrollbar-width: thin;
}

.modal-tabs::-webkit-scrollbar {
    height: 4px;
}

.modal-tabs::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-tab-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    margin-bottom: -2px;
}

.modal-tab-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.modal-tab-btn:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.modal-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.modal-tab-btn.active svg {
    stroke: var(--primary);
}

.modal-tab-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.modal-tab-btn.hidden-tab {
    display: none;
}

/* Tab panels */
.modal-tab-panels {
    padding: 24px;
    min-height: 400px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-tab-panel {
    display: none;
    animation: fadeInPanel 0.25s ease;
}

.modal-tab-panel.active {
    display: block;
}

@keyframes fadeInPanel {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Secciones dentro de panels */
.panel-section {
    margin-bottom: 24px;
}

.panel-section:last-child {
    margin-bottom: 0;
}

.panel-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-section-title svg {
    width: 16px;
    height: 16px;
    color: var(--primary);
}

/* Grid de campos */
.fields-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.fields-grid .full-width {
    grid-column: span 2;
}

/* Radio group horizontal */
.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.radio-option:hover {
    background: var(--surface-hover);
}

.radio-option input[type="radio"] {
    accent-color: var(--primary);
}

.radio-option span {
    font-size: 14px;
    color: var(--text-primary);
}

/* Toggle switch */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--border-color);
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.toggle-switch.active {
    background: var(--primary);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active::after {
    transform: translateX(22px);
}

.toggle-label {
    font-size: 14px;
    color: var(--text-primary);
}

/* Tabla de calibración */
.calibration-table-wrapper {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.calibration-table {
    width: 100%;
    border-collapse: collapse;
}

.calibration-table th,
.calibration-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.calibration-table th {
    background: var(--surface-secondary);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calibration-table tr:last-child td {
    border-bottom: none;
}

.calibration-table tr:hover td {
    background: var(--surface-hover);
}

.calibration-table input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-primary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-mono, monospace);
}

.calibration-table input:focus {
    outline: none;
    border-color: var(--primary);
}

.calibration-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-add-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--surface-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-row:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(6, 182, 212, 0.05);
}

.btn-add-row svg {
    width: 16px;
    height: 16px;
}

.btn-delete-row {
    padding: 6px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.btn-delete-row:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* Info box */
.info-box {
    padding: 12px 16px;
    background: var(--surface-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    font-size: 13px;
    color: var(--text-secondary);
}

.info-box.warning {
    border-left-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.info-box strong {
    color: var(--text-primary);
}

/* Empty state calibración */
.calibration-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
}

.calibration-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.calibration-empty p {
    font-size: 14px;
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .modal-container.modal-asset-tabs {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .modal-tabs {
        padding: 0 16px;
    }

    .modal-tab-btn {
        padding: 12px 14px;
        font-size: 12px;
    }

    .modal-tab-btn span {
        display: none;
    }

    .modal-tab-panels {
        padding: 16px;
        max-height: calc(100vh - 200px);
    }

    .fields-grid {
        grid-template-columns: 1fr;
    }

    .fields-grid .full-width {
        grid-column: span 1;
    }

    .radio-group {
        flex-direction: column;
        gap: 8px;
    }
}
/* Profile options */
.profile-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-option {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-option:hover {
    border-color: var(--primary);
    background: rgba(6, 182, 212, 0.03);
}

.profile-option input[type="radio"] {
    margin-top: 3px;
    accent-color: var(--primary);
}

.profile-option input[type="radio"]:checked+.profile-content .profile-name {
    color: var(--primary);
}

.profile-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.profile-conditions {
    display: block;
    font-size: 11px;
    color: var(--warning);
    line-height: 1.4;
    margin-top: 6px;
    padding: 8px 10px;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 4px;
    border-left: 2px solid var(--warning);
}

/* Checkbox list para múltiples selecciones */
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid var(--border-primary);
    border-radius: 6px;
    background: var(--surface-primary);
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.checkbox-option:hover {
    background: var(--surface-secondary);
}

.checkbox-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-option span {
    font-size: 14px;
    color: var(--text-primary);
}
/* =====================================================
   SECCIONES COLAPSABLES - MODAL GRANDE
   ===================================================== */

   .modal-container.modal-asset-sections {
       width: 95vw;
       max-width: 1100px;
       height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-asset-sections .modal-header {
    flex-shrink: 0;
}

.modal-asset-sections .modal-footer {
    flex-shrink: 0;
}

.modal-sections-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px 32px 32px 32px;
}

.collapsible-section {
    border: 1px solid var(--border-primary);
    border-radius: 10px;
    margin-bottom: 16px;
    background: var(--bg-secondary);
    overflow: hidden;
}

.collapsible-section:last-child {
    margin-bottom: 0;
}

.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    cursor: pointer;
    background: var(--bg-tertiary);
    transition: background 0.15s ease;
    position: sticky;
    top: 0;
    z-index: 10;
}

.collapsible-header:hover {
    background: var(--bg-hover);
}

.collapsible-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-primary);
}

.collapsible-header-left svg {
    width: 20px;
    height: 20px;
    color: var(--primary);
}

.collapsible-chevron {
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.collapsible-section.expanded .collapsible-chevron {
    transform: rotate(180deg);
}

.collapsible-content {
    padding: 20px 24px;
    border-top: 1px solid var(--border-primary);
}

.collapsible-content .panel-section {
    margin-bottom: 20px;
}

.collapsible-content .panel-section:last-child {
    margin-bottom: 0;
}

.collapsible-content .panel-section-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 14px;
}

.collapsible-content .fields-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px 24px;
}

.collapsible-content .fields-grid .full-width {
    grid-column: 1 / -1;
}

@media (min-width: 900px) {
    .collapsible-content .fields-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}