/* CSS: Diseño Visual Premium de Alta Fidelidad */

:root {
    --bg-base: #0f121d;
    --panel-bg: rgba(22, 28, 45, 0.45);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    
    /* Colores HSL adaptados para diseño moderno */
    --primary: hsl(217, 91%, 60%);
    --primary-hover: hsl(217, 91%, 50%);
    --whatsapp: hsl(142, 70%, 45%);
    --whatsapp-hover: hsl(142, 70%, 38%);
    --danger: hsl(350, 84%, 55%);
    --danger-hover: hsl(350, 84%, 45%);
    --success: hsl(142, 70%, 45%);
    --warning: hsl(38, 92%, 50%);
    
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --radius-lg: 16px;
    --radius-md: 10px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Efectos de fondo decorativos */
.background-decor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
}

.blob-1 {
    width: 500px;
    height: 500px;
    background: var(--primary);
    top: -10%;
    right: -5%;
}

.blob-2 {
    width: 400px;
    height: 400px;
    background: var(--whatsapp);
    bottom: -10%;
    left: -5%;
}

/* Contenedor Principal */
.container {
    width: 100%;
    max-width: 1200px;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    z-index: 10;
}

/* Encabezado */
.app-header {
    text-align: center;
    margin-bottom: 5px;
}

.app-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.app-header h1 i {
    color: var(--whatsapp);
    -webkit-text-fill-color: initial;
    filter: drop-shadow(0 0 10px rgba(37, 211, 102, 0.4));
}

.app-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-top: 8px;
    font-weight: 300;
}

/* Grid de Paneles */
.app-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

@media (max-width: 900px) {
    .app-grid {
        grid-template-columns: 1fr;
    }
}

/* Efecto Glassmorphism */
.glass {
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
}

.panel {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Estilos de Pasos */
.step-card {
    display: flex;
    gap: 20px;
}

.step-card.full-height {
    height: 100%;
}

.step-num {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

.step-content {
    flex-grow: 1;
}

.flex-col {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.step-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
    font-weight: 300;
}

/* Botones Premium */
.btn {
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-whatsapp {
    background-color: var(--whatsapp);
    color: white;
}

.btn-whatsapp:hover {
    background-color: var(--whatsapp-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.3);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85rem;
}

/* Estados de Conexión */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 15px;
}

.status-badge.disconnected {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger);
}

.status-badge.connected {
    background: rgba(37, 211, 102, 0.12);
    border: 1px solid rgba(37, 211, 102, 0.25);
    color: var(--whatsapp);
}

.status-badge.connecting {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: var(--warning);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
}

.disconnected .dot {
    box-shadow: 0 0 8px var(--danger);
}

.connected .dot {
    box-shadow: 0 0 8px var(--whatsapp);
    animation: pulse 1.5s infinite;
}

/* Contenedor QR */
.qr-box {
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 15px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.qr-wrapper {
    background: white;
    padding: 15px;
    border-radius: 8px;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.qr-mock {
    font-size: 6rem;
    color: #1f2937;
    position: relative;
    line-height: 1;
}

.scan-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--whatsapp);
    box-shadow: 0 0 8px var(--whatsapp);
    animation: scan 2s infinite ease-in-out;
}

.qr-hint {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 300;
}

/* Drag and Drop Excel */
.btn-template {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    transition: var(--transition-smooth);
}

.btn-template:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-md);
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    background: rgba(255, 255, 255, 0.02);
}

.drop-zone:hover, .drop-zone.active {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.drop-icon {
    font-size: 2.2rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    transition: var(--transition-smooth);
}

.drop-zone:hover .drop-icon {
    color: var(--primary);
    transform: scale(1.1);
}

.drop-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 300;
}

.file-info {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(37, 211, 102, 0.08);
    border: 1px solid rgba(37, 211, 102, 0.2);
    border-radius: var(--radius-md);
    padding: 12px 15px;
}

.info-icon {
    font-size: 1.5rem;
    color: var(--whatsapp);
}

.info-details p:first-child {
    font-size: 0.9rem;
    font-weight: 600;
}

.info-details p:last-child {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Configuración Avanzada */
.advanced-settings {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 10px 15px;
    transition: var(--transition-smooth);
}

.advanced-settings[open] {
    background: rgba(255, 255, 255, 0.04);
}

.advanced-settings summary {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    outline: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.advanced-settings summary::-webkit-details-marker {
    color: var(--primary);
}

.advanced-settings summary:hover {
    color: var(--text-primary);
}

/* Formulario API Settings */
.api-settings-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 15px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.input-group input {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition-smooth);
    width: 100%;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

/* Editor de Mensaje */
.message-editor-container {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message-editor-container h4 {
    font-size: 1rem;
    font-weight: 600;
}

.editor-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 300;
    line-height: 1.4;
}

.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 2px;
}

.chip {
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chip:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--primary);
    transform: translateY(-1px);
}

.message-template {
    width: 100%;
    min-height: 100px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    transition: var(--transition-smooth);
}

.message-template:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.15);
}

/* PASO 3: Control y Terminal */
.control-actions {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 15px;
    margin-bottom: 25px;
}

.progress-container {
    margin-bottom: 25px;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

#progress-status {
    font-weight: 300;
    max-width: 80%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#progress-percent {
    font-weight: 600;
    color: var(--primary);
}

.progress-bar-bg {
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #34d399 100%);
    border-radius: 50px;
    transition: width 0.4s ease-out;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Consola de Logs (Estilo Terminal) */
.console-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--panel-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.console-header {
    background: rgba(15, 18, 29, 0.9);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--panel-border);
}

.dot-c {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.dot-c.red { background: #ff5f56; }
.dot-c.yellow { background: #ffbd2e; }
.dot-c.green { background: #27c93f; }

.console-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.console-logs {
    background: rgba(10, 12, 20, 0.85);
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    padding: 15px;
    flex-grow: 1;
    overflow-y: auto;
    max-height: 220px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.log-line {
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-all;
}

.log-line.system {
    color: #6366f1;
}

.log-line.success {
    color: #10b981;
}

.log-line.error {
    color: #ef4444;
}

/* Footer general */
.app-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 300;
    margin-top: 10px;
}

/* Clases de utilidad */
.hidden {
    display: none !important;
}

/* ANIMACIONES */
@keyframes scan {
    0%, 100% { top: 0%; }
    50% { top: 100%; }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.animate-bounce {
    animation: bounce 2s infinite ease-in-out;
}
