/* ============================================================
   SIE Deployer - Admin Plugin Styles
   ============================================================ */

#siedeployer_admin {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#siedeployer_admin h1 {
    color: #1e293b;
    font-size: 1.6em;
    margin: 0 0 5px 0;
}

.sd-subtitle {
    color: #64748b;
    margin: 0 0 20px 0;
}

/* Mensajes */
.sd-msg {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
}

.sd-success {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.sd-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

/* Cards */
.sd-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.sd-card h2 {
    margin: 0 0 16px 0;
    font-size: 1.2em;
    color: #334155;
}

.sd-card-create {
    border-left: 4px solid #3b82f6;
}

/* Formularios */
.sd-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.sd-field {
    margin-bottom: 12px;
}

.sd-field label {
    display: block;
    font-weight: 600;
    color: #475569;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.sd-field input[type="text"],
.sd-field input[type="email"],
.sd-field input[type="file"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95em;
    box-sizing: border-box;
}

.sd-field input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.sd-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.85em;
    resize: vertical;
    box-sizing: border-box;
}

.sd-input-group {
    display: flex;
    gap: 8px;
}

.sd-input-group input {
    flex: 1;
}

.sd-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0;
    cursor: pointer;
    font-weight: 600;
    color: #dc2626;
}

.sd-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* Botones */
.sd-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 0.95em;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.sd-btn-primary {
    background: #3b82f6;
    color: #fff;
}

.sd-btn-primary:hover {
    background: #2563eb;
}

.sd-btn-danger {
    background: #dc2626;
    color: #fff;
}

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

.sd-btn-sm {
    padding: 6px 14px;
    font-size: 0.85em;
}

.sd-btn-outline {
    background: transparent;
    border: 1px solid #94a3b8;
    color: #475569;
}

.sd-btn-outline:hover {
    background: #f1f5f9;
}

/* Tabla */
.sd-table {
    width: 100%;
    border-collapse: collapse;
}

.sd-table th {
    background: #f1f5f9;
    padding: 10px 12px;
    text-align: left;
    font-size: 0.85em;
    color: #64748b;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
}

.sd-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.9em;
}

.sd-table tr:hover {
    background: #f8fafc;
}

/* Progreso */
.sd-progress {
    background: #e2e8f0;
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
    display: inline-block;
    width: 100px;
    vertical-align: middle;
}

.sd-progress-lg {
    width: 100%;
    height: 10px;
    margin-top: 10px;
}

.sd-progress-bar {
    background: linear-gradient(90deg, #3b82f6, #2563eb);
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.sd-progress-text {
    font-size: 0.8em;
    color: #64748b;
    margin-left: 8px;
}

/* Badges */
.sd-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

.sd-badge-success {
    background: #d1fae5;
    color: #065f46;
}

.sd-badge-progress {
    background: #dbeafe;
    color: #1e40af;
}

/* Header de dashboard */
.sd-header {
    margin-bottom: 24px;
}

.sd-back {
    color: #3b82f6;
    text-decoration: none;
    font-size: 0.9em;
}

.sd-back:hover {
    text-decoration: underline;
}

.sd-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 10px 0;
    font-size: 0.9em;
    color: #64748b;
}

/* Pasos Accordion */
.sd-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sd-step {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.sd-step:hover {
    border-color: #cbd5e1;
}

.sd-step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    cursor: pointer;
    background: #fafbfc;
    transition: background 0.2s;
}

.sd-step-header:hover {
    background: #f1f5f9;
}

.sd-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #475569;
    font-weight: 700;
    font-size: 0.85em;
    flex-shrink: 0;
}

.sd-step-title {
    flex: 1;
    font-weight: 600;
    color: #334155;
}

.sd-step-date {
    font-size: 0.8em;
    color: #94a3b8;
}

.sd-step-chevron {
    color: #94a3b8;
    font-size: 0.7em;
    transition: transform 0.2s;
}

.sd-step-body {
    padding: 18px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
}

/* Iconos de estado */
.sd-icon-ok { color: #16a34a; font-weight: bold; }
.sd-icon-run { color: #f59e0b; }
.sd-icon-err { color: #dc2626; font-weight: bold; }
.sd-icon-pend { color: #cbd5e1; }

/* Estados de pasos */
.sd-step-completed {
    border-left: 3px solid #16a34a;
}

.sd-step-completed .sd-step-num {
    background: #d1fae5;
    color: #065f46;
}

.sd-step-failed {
    border-left: 3px solid #dc2626;
}

.sd-step-failed .sd-step-num {
    background: #fee2e2;
    color: #991b1b;
}

.sd-step-running {
    border-left: 3px solid #f59e0b;
}

/* Warning text */
.sd-warn {
    color: #dc2626;
    font-weight: 600;
    font-size: 0.9em;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 6px;
    margin: 8px 0;
}

/* Log */
.sd-step-log {
    margin-top: 12px;
}

.sd-loading {
    color: #f59e0b;
    font-weight: 600;
    padding: 10px;
    background: #fffbeb;
    border-radius: 6px;
}

.sd-log-ok {
    color: #16a34a;
    font-weight: 600;
    padding: 10px;
    background: #f0fdf4;
    border-radius: 6px;
}

.sd-log-err {
    color: #dc2626;
    font-weight: 600;
    padding: 10px;
    background: #fef2f2;
    border-radius: 6px;
}

.sd-log-entries {
    margin-top: 10px;
}

.sd-log-entries h4 {
    margin: 0 0 6px 0;
    color: #64748b;
    font-size: 0.85em;
}

.sd-log-entries pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 14px;
    border-radius: 8px;
    font-size: 0.82em;
    overflow-x: auto;
    line-height: 1.5;
    margin: 0;
}

.sd-log-info { color: #93c5fd; }
.sd-log-success { color: #6ee7b7; }
.sd-log-warning { color: #fcd34d; }
.sd-log-error { color: #fca5a5; }

/* Scan results */
.sd-scan-results {
    margin-top: 8px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 10px;
    background: #f8fafc;
}

.sd-scan-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sd-scan-list li {
    padding: 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}

.sd-scan-list li:hover {
    background: #eff6ff;
}

.sd-scan-list a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
}

.sd-scan-title {
    color: #94a3b8;
    font-size: 0.85em;
    margin-left: 8px;
}

/* Tabs de navegacion */
.sd-tabs {
    display: flex;
    gap: 2px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.sd-tab {
    padding: 10px 20px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.sd-tab:hover {
    color: #3b82f6;
    background: #f8fafc;
}

.sd-tab-active {
    font-weight: 700;
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

/* Migracion: controles */
.sd-mig-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

/* Boton secundario (descarga) */
.sd-btn-secondary {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #cbd5e1;
}

.sd-btn-secondary:hover {
    background: #e2e8f0;
    color: #334155;
}

/* ============================================================
   Actualizaciones - Grid de parches
   ============================================================ */

.sd-updates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.sd-update-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0 20px 20px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s;
}

.sd-update-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.sd-update-card-header {
    padding: 16px 0 8px 0;
    margin: 0 -20px 12px -20px;
    padding-left: 20px;
}

.sd-update-card-header h3 {
    margin: 0;
    font-size: 1.05em;
    color: #1e293b;
}

.sd-update-card p {
    color: #64748b;
    font-size: 0.9em;
    margin: 0 0 12px 0;
    line-height: 1.4;
}

/* Log de parche */
.sd-patch-log {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    max-height: 300px;
    overflow-y: auto;
}

.sd-patch-detail {
    margin-top: 8px;
}

.sd-patch-detail pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 12px;
    border-radius: 6px;
    font-size: 0.8em;
    overflow-x: auto;
    line-height: 1.4;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Responsive */
@media (max-width: 768px) {
    .sd-form-grid {
        grid-template-columns: 1fr;
    }

    .sd-meta {
        flex-direction: column;
        gap: 4px;
    }

    .sd-progress {
        width: 60px;
    }

    .sd-tabs {
        gap: 0;
    }

    .sd-tab {
        padding: 8px 12px;
        font-size: 0.9em;
    }

    .sd-mig-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .sd-updates-grid {
        grid-template-columns: 1fr;
    }
}
