/**
 * ERPlora Cloud — estilos específicos de la app (NO sistema de diseño)
 * ---------------------------------------------------------------------
 * El sistema de diseño compartido (Tailwind utils + temas + logo + layout
 * + shell de dashboard) vive en erplora-ui → style.css. Aquí solo quedan
 * clases propias de Cloud que no se comparten con el Hub.
 *
 * Cargado DESPUÉS de style.css en base.html, así que gana en cascada.
 * (Eliminadas las reglas muertas: [x-cloak] de Alpine, #htmx-indicator /
 *  .htmx-request y ::view-transition de HTMX — ambos frameworks retirados.
 *  .page-content NO se duplica aquí: la aporta layout.css.)
 */

/* ========================================
   PAGE BACKGROUND
   Gradient mesh + grid overlay (matches Hub)
   ======================================== */

.page {
    background: var(--ion-color-step-50);
    position: relative;
}

.page::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 80% 60% at 70% 10%, color-mix(in oklch, var(--ion-color-primary) 15%, transparent) 0%, transparent 60%),
        radial-gradient(ellipse 70% 50% at 20% 90%, color-mix(in oklch, var(--ion-color-secondary) 12%, transparent) 0%, transparent 60%),
        radial-gradient(ellipse 50% 40% at 50% 50%, color-mix(in oklch, var(--ion-color-primary) 6%, transparent) 0%, transparent 70%);
    z-index: 0;
}

.page::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(color-mix(in oklch, var(--ion-text-color) 3%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in oklch, var(--ion-text-color) 3%, transparent) 1px, transparent 1px);
    background-size: 60px 60px;
    z-index: 0;
}

.page>* {
    position: relative;
    z-index: 1;
}

@media (max-width: 991px) {
    .page>.drawer {
        position: absolute;
        z-index: 500;
    }

    .page>.drawer-backdrop {
        position: absolute;
        z-index: 400;
    }
}

/* Footer stays at bottom — flex layout handles positioning */
.content>.footer {
    flex-shrink: 0;
}

/* ========================================
   CONTAINER UTILITIES
   ======================================== */

.page-container {
    padding: 1rem;
    margin: 0 auto;
}

.page-container-sm {
    max-width: 500px;
    padding: 1rem;
    margin: 0 auto;
}

.page-container-md {
    max-width: 800px;
    padding: 1rem;
    margin: 0 auto;
}

.page-container-lg {
    max-width: 1000px;
    padding: 1rem;
    margin: 0 auto;
}

.page-container-xl {
    max-width: 1200px;
    padding: 1rem;
    margin: 0 auto;
}

.page-container-2xl {
    max-width: 1400px;
    padding: 1rem;
    margin: 0 auto;
}

/* ========================================
   FORM STYLING
   ======================================== */

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

.form-error {
    color: var(--ion-color-danger);
    font-size: 0.875rem;
    margin: 0.25rem 0 0.75rem 0;
    padding-left: 1rem;
}

.form-helper {
    color: var(--ion-text-color);
    opacity: 0.5;
    font-size: 0.75rem;
    margin: 0.25rem 0 0 0;
    padding-left: 1rem;
}

/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state-icon {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    opacity: 0.5;
    max-width: 400px;
    margin: 0 auto 1.5rem auto;
}

/* ========================================
   HEADER UTILITIES
   ======================================== */

.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-header-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.page-header-subtitle {
    opacity: 0.5;
    margin: 0.25rem 0 0 0;
}

/* ========================================
   STATUS ICONS
   ======================================== */

.success-icon-circle,
.warning-icon-circle,
.danger-icon-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 2rem;
}

.success-icon-circle {
    background: color-mix(in oklch, var(--ion-color-success) 15%, transparent);
    color: var(--ion-color-success);
}

.warning-icon-circle {
    background: color-mix(in oklch, var(--ion-color-warning) 15%, transparent);
    color: var(--ion-color-warning);
}

.danger-icon-circle {
    background: color-mix(in oklch, var(--ion-color-danger) 15%, transparent);
    color: var(--ion-color-danger);
}

/* ===========================================================================
   Hub deploy progress + logs (SSE streams)
   =========================================================================== */

.deploy-progress {
    margin: 1.5rem 0;
}
.deploy-progress-bar-wrapper {
    height: 8px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: 1rem;
}
.deploy-progress-bar {
    height: 100%;
    background: var(--ion-color-primary, #2563eb);
    border-radius: 9999px;
    transition: width 400ms ease-out;
    width: 0%;
}
.deploy-progress-bar.progress-error {
    background: var(--ion-color-danger, #dc2626);
}
.deploy-progress-bar.progress-done {
    background: var(--ion-color-success, #16a34a);
}

.deploy-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.deploy-steps li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: background 200ms;
}
.deploy-steps li.done {
    color: var(--ion-color-success, #16a34a);
}
.deploy-steps li.current {
    background: rgba(37, 99, 235, 0.08);
    color: var(--ion-color-primary, #2563eb);
    font-weight: 500;
}
.deploy-steps li.pending {
    opacity: 0.4;
}
.deploy-steps li.error {
    background: rgba(220, 38, 38, 0.08);
    color: var(--ion-color-danger, #dc2626);
    font-weight: 500;
}
.deploy-steps .step-icon {
    font-size: 1.25rem;
    line-height: 1;
}
.deploy-steps li.current .step-icon {
    animation: spin 1.2s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Terminal-style log viewer */
.deploy-logs-wrapper {
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 0.5rem;
    overflow: hidden;
}
.deploy-logs-summary {
    cursor: pointer;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.03);
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    font-weight: 500;
    font-size: 0.875rem;
}
.deploy-logs-summary::-webkit-details-marker { display: none; }
.deploy-logs-terminal {
    background: #0d1117;
    color: #d1d5db;
    font-family: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", monospace;
    font-size: 0.78rem;
    line-height: 1.5;
    padding: 0.75rem 1rem;
    max-height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    word-break: break-word;
}
.deploy-logs-terminal:empty::before {
    content: "Waiting for logs…";
    color: #6b7280;
    font-style: italic;
}
.log-line {
    padding: 1px 0;
    white-space: pre-wrap;
}
.log-line-text {
    color: inherit;
}
.log-line-ts {
    display: inline-block;
    width: 0;
    overflow: hidden;
}
.log-line-info { color: #93c5fd; }
.log-line-success { color: #4ade80; font-weight: 600; }
.log-line-error { color: #f87171; font-weight: 600; }
