/**
 * Estilos del módulo Automatizaciones
 */

.automations-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.automations-intro {
    background: linear-gradient(135deg, #f6f8fc 0%, #f0f4ff 100%);
    border-radius: 16px;
    padding: 24px 28px;
    border: 1px solid #e5e7eb;
}

.automations-intro-text {
    margin: 0;
    color: #4b5563;
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
}

.automations-establecimiento-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
    color: #1e40af;
    font-size: 14px;
    font-weight: 500;
}

.automations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
}

.automation-card {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 24px;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.automation-card.habilitada {
    border-color: #10b981;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.automation-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.automation-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
}

.automation-status-badge {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.automation-status-badge.activa {
    background: #d1fae5;
    color: #065f46;
}

.automation-status-badge.inactiva {
    background: #f3f4f6;
    color: #6b7280;
}

.automation-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.automation-desc {
    margin: 0 0 16px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

.automation-flow {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #eef0f3;
}

.automation-flow-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.automation-flow-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #9ca3af;
}

.automation-flow-value {
    font-size: 13px;
    color: #374151;
    line-height: 1.4;
}

.automation-flow-arrow {
    display: flex;
    align-items: center;
    color: #9ca3af;
    font-size: 18px;
    padding-top: 14px;
}

.automation-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.automation-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.automation-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.automation-switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #d1d5db;
    transition: 0.3s;
    border-radius: 34px;
}

.automation-switch-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.automation-switch input:checked + .automation-switch-slider {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.automation-switch input:checked + .automation-switch-slider:before {
    transform: translateX(22px);
}

.automation-switch input:focus + .automation-switch-slider {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.automation-switch input:disabled + .automation-switch-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

.automation-btn-config {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.automation-btn-config:hover:not(:disabled) {
    background: #f9fafb;
}

.automation-btn-config:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.automation-btn-config img {
    width: 16px;
    height: 16px;
}

.automation-config-panel {
    border-top: 1px solid #e5e7eb;
    padding-top: 12px;
}

.automation-config-summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #4b5563;
    list-style: none;
    user-select: none;
}

.automation-config-summary::-webkit-details-marker {
    display: none;
}

.automation-config-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.automation-field-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.automation-placeholders {
    margin: 4px 0 8px;
    font-size: 12px;
    color: #6b7280;
}

.automation-placeholders code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.automation-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px 24px;
    color: #6b7280;
    background: #f9fafb;
    border-radius: 12px;
    border: 1px dashed #d1d5db;
}

.automation-empty-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    color: #9ca3af;
}

.automation-empty h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: #374151;
}

.automation-empty p {
    margin: 0 0 20px;
    font-size: 14px;
}

.automation-empty-cta,
#automations-nuevo-btn-empty {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 200px;
    justify-content: center;
}

/* Header acciones (mismo patrón que pagos-header-actions) */
#automatizaciones .content-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

#automatizaciones .content-header h1 {
    margin: 0;
    flex: 1;
}

.automations-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: auto;
}

#automatizaciones .automations-header-actions .btn,
#automatizaciones #automations-nuevo-btn-empty {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.automations-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 4px;
}

.automations-section-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.automations-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Modal catálogo */
.automation-catalog-overlay {
    z-index: 10050;
}

.automation-catalog-modal {
    max-width: 820px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.automation-catalog-modal .modal-body {
    overflow-y: auto;
}

.automation-catalog-intro {
    margin: 0 0 20px;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

.automation-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.automation-catalog-card {
    display: flex;
    flex-direction: column;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.automation-catalog-card:hover:not(.no-disponible) {
    border-color: #c7d2fe;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
}

.automation-catalog-card.no-disponible {
    opacity: 0.65;
    background: #fafafa;
}

.automation-catalog-card.instalada {
    border-color: #10b981;
    background: linear-gradient(135deg, #fff 0%, #f0fdf4 100%);
}

.automation-catalog-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #fff;
    margin-bottom: 12px;
}

.automation-catalog-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.automation-catalog-desc {
    margin: 0 0 12px;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.45;
    flex: 1;
}

.automation-catalog-flow {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 8px;
    font-size: 12px;
    color: #4b5563;
    line-height: 1.4;
}

.automation-catalog-flow strong {
    color: #374151;
}

.automation-catalog-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-top: auto;
}

.automation-catalog-add {
    font-size: 13px;
    padding: 8px 16px;
}

.automation-catalog-badge {
    display: inline-flex;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.automation-catalog-badge.proximamente {
    background: #f3f4f6;
    color: #9ca3af;
}

.automation-catalog-badge.instalada {
    background: #d1fae5;
    color: #065f46;
}

.automation-catalog-loading {
    grid-column: 1 / -1;
    text-align: center;
    color: #6b7280;
    padding: 24px;
}
