/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 9999px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

/* ✨ Animación Shimmer (estilo Gemini) */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}
.shimmer {
    background: linear-gradient(90deg, 
        rgba(139, 92, 246, 0.1) 0%, 
        rgba(139, 92, 246, 0.4) 50%, 
        rgba(59, 130, 246, 0.4) 60%,
        rgba(139, 92, 246, 0.1) 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
}

/* 🧠 Thinking box */
.thinking-box {
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-left: 3px solid #8B5CF6;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
    max-height: 200px;
    overflow-y: auto;
}
.thinking-header {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #a78bfa;
    font-weight: 600;
    font-style: normal;
    margin-bottom: 6px;
    cursor: pointer;
    user-select: none;
}
.thinking-header .toggle-icon {
    transition: transform 0.2s;
}
.thinking-box.collapsed .toggle-icon {
    transform: rotate(-90deg);
}
.thinking-box.collapsed .thinking-content {
    display: none;
}

/* 📎 Drag & Drop overlay */
.drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    border: 4px dashed #8B5CF6;
}
.drop-overlay.active { display: flex; }
.drop-overlay-content {
    background: linear-gradient(135deg, #8B5CF6, #3B82F6);
    padding: 40px 60px;
    border-radius: 20px;
    color: white;
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.5);
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* 📎 Attachment previews */
.attachment {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    padding: 6px 10px;
    margin: 4px;
    font-size: 12px;
    color: #e2e8f0;
    max-width: 200px;
}
.attachment img, .attachment video {
    max-width: 40px;
    max-height: 40px;
    border-radius: 4px;
    object-fit: cover;
}
.attachment .remove-btn {
    cursor: pointer;
    color: #f87171;
    font-weight: bold;
    padding: 0 4px;
}

/* 🌐 HTML Preview Card */
.html-preview-card {
    margin-top: 12px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.html-preview-card .icon {
    background: linear-gradient(135deg, #8B5CF6, #3B82F6);
    color: white;
    padding: 8px;
    border-radius: 8px;
    font-size: 20px;
}
.html-preview-card .info { flex: 1; }
.html-preview-card .title {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 14px;
}
.html-preview-card .subtitle {
    font-size: 11px;
    color: #94a3b8;
}
.html-preview-card a {
    background: linear-gradient(90deg, #8B5CF6, #3B82F6);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    transition: opacity 0.2s;
}
.html-preview-card a:hover { opacity: 0.85; }

/* 💻 Bloques de código */
pre {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px;
    overflow-x: auto;
    margin: 8px 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
    color: #e2e8f0;
}
code { font-family: 'Consolas', 'Monaco', monospace; }

/* Cursor animado mientras escribe */
.typing-cursor::after {
    content: '▊';
    color: #a78bfa;
    animation: blink 1s infinite;
    margin-left: 2px;
}
@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

* { transition: background-color 0.2s ease, border-color 0.2s ease; }

/* 🚨 ALERTA INLINE (No emergente) */
.sack-alert {
    background: linear-gradient(90deg, rgba(251,146,60,0.15), rgba(239,68,68,0.15));
    border: 1px solid rgba(251,146,60,0.4);
    border-left: 4px solid #fb923c;
    color: #fed7aa;
    padding: 12px 16px;
    border-radius: 10px;
    margin: 12px 0;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.4s ease;
}
.sack-alert .alert-icon { font-size: 20px; }
.sack-alert button {
    background: linear-gradient(90deg,#fb923c,#f97316);
    color: white;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    margin-left: auto;
}
@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 🐧 Panel Dividido IDE Style */
#right-panel.active {
    display: flex !important;
}

.code-header-bar {
    background: #0f172a;
    border: 1px solid #334155;
    border-bottom: none;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    padding: 6px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
}

.run-linux-btn {
    background: linear-gradient(90deg, #10b981, #059669);
    color: white;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.run-linux-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

/* ===== Linux PC Panel (mediano, no estirado) ===== */
#main-workspace {
  display: flex;
  width: 100%;
  min-width: 0;
}

#chat-pane {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  transition: max-width 0.25s ease;
}

#right-panel {
  display: none !important;
  flex: 0 0 42%;
  width: 42%;
  max-width: 520px;
  min-width: 320px;
  height: calc(100% - 24px);
  margin: 12px 12px 12px 0;
  border-radius: 14px;
  border: 1px solid #334155;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  overflow: hidden;
  background: #090d16;
}

#right-panel.active {
  display: flex !important;
  flex-direction: column;
}

/* Cuando la PC está abierta, el chat cede espacio */
#main-workspace:has(#right-panel.active) #chat-pane {
  max-width: calc(100% - 340px);
}

/* Header tipo ventana de PC */
#right-panel .h-14,
#right-panel > div:first-child {
  border-radius: 14px 14px 0 0;
  flex-shrink: 0;
}

#right-panel-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 0 0 14px 14px;
}

/* Móvil: panel a pantalla completa si no cabe */
@media (max-width: 900px) {
  #right-panel.active {
    position: fixed;
    right: 10px;
    top: 60px;
    bottom: 10px;
    width: min(92vw, 420px);
    max-width: 92vw;
    z-index: 50;
  }
}

/* ===== Navegador visual de la PC Sack ===== */
.sack-browser {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #0b1220;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1e293b;
}
.sack-browser-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: #111827;
  border-bottom: 1px solid #1f2937;
}
.sack-browser-bar input {
  flex: 1;
  background: #0f172a;
  border: 1px solid #334155;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
}
.sack-browser-bar button {
  background: #3b82f6;
  color: #fff;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.sack-browser-body {
  flex: 1;
  overflow: auto;
  padding: 14px;
  background: #0a0f1a;
}
.sack-result {
  background: #111827;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}
.sack-result a {
  color: #60a5fa;
  font-weight: 600;
  text-decoration: none;
  font-size: 13px;
}
.sack-result p {
  color: #94a3b8;
  font-size: 12px;
  margin: 6px 0 0;
  line-height: 1.4;
}
.sack-empty {
  color: #fbbf24;
  font-size: 12px;
  line-height: 1.5;
  padding: 10px;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 8px;
}
