:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-glass: rgba(30, 41, 59, 0.7);
    --border-glass: rgba(255, 255, 255, 0.08);

    --accent-mc: #06b6d4;
    --accent-mc-glow: rgba(6, 182, 212, 0.3);
    --accent-tt: #f43f5e;
    --accent-tt-glow: rgba(244, 63, 94, 0.3);
    --accent-gold: #fbbf24;

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;

    --font-sans: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-glow: 0 0 20px;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background grid effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(6, 182, 212, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(6, 182, 212, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    pointer-events: none;
    z-index: 0;
}

/* Layout */
.app-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Sidebar */
.sidebar {
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--border-glass);
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    padding: 2rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-glass);
}

.brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--accent-mc), var(--accent-tt));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 0 30px rgba(6, 182, 212, 0.4);
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    border-color: var(--border-glass);
}

.nav-item.active {
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-mc);
    border-color: rgba(6, 182, 212, 0.3);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.connection-status {
    margin-top: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.status-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.status-title {
    font-size: 0.875rem;
    font-weight: 600;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.3);
}

.status-indicator.online {
    color: var(--success);
    background: rgba(16, 185, 129, 0.15);
}

.status-indicator.offline {
    color: var(--error);
    background: rgba(239, 68, 68, 0.15);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* Main Content */
.main-content {
    padding: 2rem;
    overflow-y: auto;
    height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.header-title h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-text-fill-color: transparent;
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: var(--font-sans);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-mc), #0891b2);
    color: white;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error), #dc2626);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.fa-spinner.fa-spin {
    animation: spin 1s linear infinite !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn:disabled {
    opacity: 0.7;
    cursor: wait !important;
}


/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.card {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    backdrop-filter: blur(20px);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.card-title i {
    color: var(--accent-mc);
}

.card-full {
    grid-column: span 12;
}

.card-large {
    grid-column: span 8;
}

.card-medium {
    grid-column: span 6;
}

.card-small {
    grid-column: span 4;
}

@media (max-width: 1200px) {
    .card-large {
        grid-column: span 12;
    }

    .card-medium {
        grid-column: span 6;
    }

    .card-small {
        grid-column: span 6;
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar {
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-glass);
        padding: 1rem;
    }

    .card-medium,
    .card-small {
        grid-column: span 12;
    }
}

/* Stats */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border-glass);
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-tt);
}

.stat-item.mc::before {
    background: var(--accent-mc);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-change {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 0.75rem;
    color: var(--success);
    font-weight: 600;
}

/* Connection Cards */
.connection-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.connection-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.connection-input-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.input-field {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: all 0.2s;
    width: 100%;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-mc);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.input-field::placeholder {
    color: var(--text-muted);
}

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

.connection-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.status-connected {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Actions Builder */
.action-builder {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    min-height: 400px;
}

.action-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.action-type-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-size: 0.9rem;
}

.action-type-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.action-type-btn.active {
    border-color: var(--accent-mc);
    background: rgba(6, 182, 212, 0.1);
    color: var(--accent-mc);
}

.action-type-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    font-size: 1.25rem;
}

.action-type-btn.active .action-type-icon {
    background: rgba(6, 182, 212, 0.2);
}

.action-editor {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.hint-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

code {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--accent-gold);
}

.code-editor {
    width: 100%;
    min-height: 120px;
    background: #0b1120;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1rem;
    color: #e2e8f0;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    transition: all 0.2s;
}

.code-editor:focus {
    outline: none;
    border-color: var(--accent-mc);
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

/* Actions List */
.actions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
}

.action-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.action-item:hover {
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.action-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tag-gift {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
}

.tag-comment {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.tag-like {
    background: rgba(236, 72, 153, 0.15);
    color: #ec4899;
}

.tag-follow {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.action-trigger {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
}

.action-command-preview {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

.action-controls {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-glass);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.btn-icon.delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Log Console */
.console {
    background: #0b1120;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    height: 300px;
    overflow-y: auto;
    position: relative;
}

.log-entry {
    padding: 0.25rem 0;
    display: flex;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.log-time {
    color: var(--text-muted);
    font-size: 0.8rem;
    min-width: 60px;
}

.log-type {
    min-width: 60px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.log-type.system {
    color: var(--accent-gold);
}

.log-type.gift {
    color: var(--accent-tt);
}

.log-type.comment {
    color: #60a5fa;
}

.log-type.like {
    color: #ec4899;
}

.log-type.follow {
    color: var(--success);
}

.log-type.command {
    color: var(--accent-mc);
}

.log-message {
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.toggle-label {
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-description {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent-mc);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

/* Responsive */
@media (max-width: 1024px) {
    .action-builder {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Variables help */
.variables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}

.variable-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-gold);
    border: 1px solid transparent;
}

.variable-chip:hover {
    border-color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.1);
}

/* Quick Test Panel */
.quick-test {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.quick-test .input-field {
    flex: 1;
}

/* Grid de Actions como Cards */
.actions-grid {
  align-items: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) rgba(0,0,0,0.2);
}

.actions-grid::-webkit-scrollbar {
  width: 6px;
}

.actions-grid::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}


/* Mejoras para cards de acciones */
.action-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
}

.action-card:hover {
    transform: translateY(-2px);
    border-color: rgba(6, 182, 212, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}


/* Pills de comandos */
.command-pill {
  transition: all 0.2s;
  cursor: pointer; 
  position: relative;
  z-index: 1;
}

.command-pill:hover {
  white-space: normal !important;
  overflow: visible !important;
  background: var(--bg-primary) !important;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  z-index: 50;
}

/* Clase para comandos ocultos inicialmente */
.hidden-command {
  display: none;
  opacity: 0;
}

/* Botón toggle */
.command-toggle:hover {
  border-color: var(--accent-mc) !important;
  color: var(--accent-mc) !important;
}

/* Animación de aparición */
@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translateY(-5px); 
  }
  to { 
    opacity: 1; 
    transform: translateY(0); 
  }
}


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

/* ======================
   Toggle Switch Cola Acciones
   ====================== */

.toggle-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(15, 23, 42, 0.6);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-container:hover {
    background: rgba(15, 23, 42, 0.8);
}

.toggle-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* Ocultamos el checkbox real */
.toggle-container input[type="checkbox"] {
    display: none;
}

/* Píldora del switch */
.toggle-switch {
    position: relative;
    width: 46px;
    height: 24px;
    background: rgba(148, 163, 184, 0.6); /* gris */
    border-radius: 999px;
    transition: background 0.25s ease;
    flex-shrink: 0;
}

/* Circulito que se mueve */
.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    transition: transform 0.25s ease;
}

/* Hint a la derecha en gris */
.toggle-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Estado ON: cambia color + mueve el círculo */
.toggle-container input[type="checkbox"]:checked + .toggle-switch {
    background: var(--accent-mc); /* tu verde Minecraft */
}

.toggle-container input[type="checkbox"]:checked + .toggle-switch .toggle-slider {
    transform: translateX(22px);
}
