/* ====== GESTOR DE MÓDULOS - ESTILOS ====== */

/* El resto de estilos se heredan de base.css */

/* Container principal */
.main-container {
    display: flex;
    height: calc(100vh - 70px);
    gap: 1px;
    background-color: #e2e8f0;
}

/* Paneles */
.panel {
    background: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-izquierdo {
    width: 300px;
    min-width: 250px;
}

.panel-central {
    flex: 1;
}

.panel-derecho {
    width: 350px;
    min-width: 300px;
}

/* Panel header */
.panel-header {
    padding: 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-nuevo {
    background: white;
    color: #667eea;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-nuevo:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-save {
    background: #10b981;
    color: white;
}

.btn-export {
    background: #3b82f6;
    color: white;
}

.btn-duplicate {
    background: #f59e0b;
    color: white;
}

.btn-delete {
    background: #ef4444;
    color: white;
}

.btn-save, .btn-export, .btn-duplicate, .btn-delete {
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-save:hover:not(:disabled) {
    background: #059669;
    transform: translateY(-2px);
}

.btn-export:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-2px);
}

.btn-duplicate:hover:not(:disabled) {
    background: #d97706;
    transform: translateY(-2px);
}

.btn-delete:hover:not(:disabled) {
    background: #dc2626;
    transform: translateY(-2px);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Search box */
.search-box {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.search-box input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Filtros */
.filtros {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.875rem;
}

.filtros label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

/* Lista scrollable */
.lista-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

/* Módulo item */
.modulo-item {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.modulo-item:hover {
    background: #f8fafc;
    border-color: #667eea;
    transform: translateX(4px);
}

.modulo-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.modulo-header i {
    color: #667eea;
    font-size: 1.25rem;
}

.modulo-nombre {
    font-weight: 600;
    color: #1e293b;
}

.modulo-info {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

.modulo-tipo {
    background: #dbeafe;
    color: #1e40af;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.modulo-version {
    background: #e5e7eb;
    color: #4b5563;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
}

.modulo-codigo {
    font-size: 0.75rem;
    color: #64748b;
    font-family: monospace;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid #e2e8f0;
    background: #f8fafc;
    padding: 0 1rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab:hover {
    color: #667eea;
    background: white;
}

.tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

/* Tab content */
.tab-content {
    display: none;
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.tab-content.active {
    display: block;
}

/* Form sections */
.form-section {
    max-width: 800px;
}

.form-section h3 {
    margin: 1.5rem 0 1rem 0;
    color: #1e293b;
    font-size: 1.1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.form-section h3:first-child {
    margin-top: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.875rem;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.help-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #64748b;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
}

/* Content header */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.btn-add {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-add:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
}

.info-panel {
    font-size: 0.875rem;
    color: #64748b;
}

/* Opciones grid */
.opciones-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.opcion-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    background: white;
}

.opcion-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.opcion-card .card-body {
    font-size: 0.875rem;
}

.opcion-info {
    margin-bottom: 0.75rem;
}

.opcion-info > div {
    margin-bottom: 0.25rem;
    color: #4b5563;
}

.opcion-desc {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f3f4f6;
    font-style: italic;
    color: #64748b;
}

.btn-icon-delete {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s;
}

.btn-icon-delete:hover {
    background: #dc2626;
}

.btn-edit-small {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-edit-small:hover {
    background: #2563eb;
}

/* Variables list */
.variables-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.variable-item {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.75rem;
    background: #f8fafc;
}

.variable-nombre {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.variable-nombre code {
    background: #dbeafe;
    color: #1e40af;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
}

.variable-formula {
    padding: 0.5rem;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 0.5rem;
}

.variable-desc {
    font-size: 0.75rem;
    color: #64748b;
    font-style: italic;
}

/* Componentes grid mini */
.componentes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.componente-card-mini {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    background: white;
}

.componente-card-mini .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.componente-card-mini .card-body > div {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #4b5563;
}

/* JSON editor */
#json-editor {
    width: 100%;
    height: calc(100vh - 250px);
    font-family: monospace;
    font-size: 0.875rem;
    padding: 1rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    resize: none;
}

.json-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.btn-format, .btn-validate, .btn-copy {
    background: #64748b;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-format:hover {
    background: #475569;
}

.btn-validate:hover {
    background: #475569;
}

.btn-copy:hover {
    background: #475569;
}

.validation-result {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
}

.validation-success {
    background: #d1fae5;
    color: #065f46;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.validation-error {
    background: #fee2e2;
    color: #991b1b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Documentación */
.docs-container {
    padding: 1rem;
    font-size: 0.875rem;
    overflow-y: auto;
}

.docs-container h3 {
    margin: 1.5rem 0 0.75rem 0;
    color: #1e293b;
    font-size: 1rem;
}

.docs-container h3:first-child {
    margin-top: 0;
}

.doc-section {
    background: #f8fafc;
    border-left: 4px solid #667eea;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.doc-section h4 {
    margin: 0 0 0.5rem 0;
    color: #374151;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.doc-section p {
    margin: 0.5rem 0;
    color: #4b5563;
}

.doc-section ul {
    margin: 0.5rem 0 0 1.5rem;
    color: #4b5563;
}

.doc-section li {
    margin-bottom: 0.25rem;
}

.doc-section code {
    background: #e5e7eb;
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.85rem;
}

.doc-section strong {
    color: #1e293b;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state p {
    margin: 0.5rem 0;
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Toast notifications */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-success {
    border-left: 4px solid #10b981;
}

.toast-success i {
    color: #10b981;
}

.toast-error {
    border-left: 4px solid #ef4444;
}

.toast-error i {
    color: #ef4444;
}

.toast-warning {
    border-left: 4px solid #f59e0b;
}

.toast-warning i {
    color: #f59e0b;
}

.toast-info {
    border-left: 4px solid #3b82f6;
}

.toast-info i {
    color: #3b82f6;
}
