/* Custom CSS for DriftRemote - Premium Space Glassmorphic Design */

:root {
  --bg-color: #0b0713;
  --panel-bg: rgba(22, 16, 35, 0.65);
  --border-color: rgba(147, 51, 234, 0.15);
  --border-glow: rgba(147, 51, 234, 0.3);
  
  --primary: #9333ea;
  --primary-glow: rgba(147, 51, 234, 0.5);
  --secondary: #ec4899;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  --transition-speed: 0.25s;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent; /* Disable tap highlight on mobile */
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Beautiful Animated Particle/Star Overlay */
.stars-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 75px 120px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 150px 80px, #9333ea, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 220px 240px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 290px 180px, #ec4899, rgba(0,0,0,0));
  background-size: 350px 350px;
  opacity: 0.45;
  z-index: 0;
  pointer-events: none;
  animation: starsAnimation 120s linear infinite;
}

@keyframes starsAnimation {
  from { background-position: 0 0; }
  to { background-position: 350px 1050px; }
}

/* --- Header --- */
header {
  position: relative;
  z-index: 10;
  padding: 1rem 1.25rem;
  background: rgba(11, 7, 19, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pulse-ring {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 10px var(--primary);
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.8; }
  50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 14px var(--primary); }
  100% { transform: scale(0.9); opacity: 0.8; }
}

.logo h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 2px;
  color: #fff;
}

.logo h1 .highlight {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transition: background var(--transition-speed);
}

.status-indicator.connected {
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

.status-indicator.disconnected {
  background: #ef4444;
  box-shadow: 0 0 10px #ef4444;
}

.status-indicator.connecting {
  background: var(--accent-amber);
  box-shadow: 0 0 10px var(--accent-amber);
  animation: blink 1s infinite alternate;
}

@keyframes blink {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
}

.icon-btn:hover, .icon-btn:active {
  background: rgba(147, 51, 234, 0.2);
  border-color: var(--primary);
  color: #fff;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* --- Layout --- */
.app-container {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem 1rem 1.5rem 1rem;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

/* --- Glassmorphic Cards --- */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.glass-card:hover {
  border-color: var(--border-glow);
  box-shadow: 0 10px 30px rgba(147, 51, 234, 0.05);
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.5rem;
}

.card-header h3 {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #fff;
  text-transform: uppercase;
}

.glow-icon {
  color: var(--primary);
  filter: drop-shadow(0 0 3px var(--primary));
}

/* --- Status Grid --- */
.status-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 480px) {
  .status-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.status-card.collapsed .diagnostics-metrics,
.status-card.collapsed .power-controls {
  display: none !important;
}

.status-card.collapsed .collapse-chevron {
  transform: rotate(-90deg);
}

/* Diagnostics metric styles */
.diagnostics-metrics {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.metric-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.progress-bar-container {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent-cyan));
  border-radius: 3px;
  transition: width 0.6s ease-in-out;
  box-shadow: 0 0 8px var(--primary-glow);
}

.metric-value {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  text-align: right;
  margin-top: -2px;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.25rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.05);
  padding-top: 0.5rem;
}

.small-metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.small-metric .label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.small-metric .val {
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
}

.small-metric .badge {
  background: rgba(147, 51, 234, 0.2);
  border: 1px solid var(--primary);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  display: inline-block;
  font-size: 0.65rem;
  width: fit-content;
}

/* Power & Audio Controls */
.power-controls {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 0.65rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.action-btn:active {
  transform: scale(0.97);
}

.sleep-theme {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--accent-amber);
}

.sleep-theme:hover, .sleep-theme:active {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent-amber);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.plan-selector {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.plan-selector label, .audio-controls label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.button-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  background: rgba(255, 255, 255, 0.04);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.plan-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.4rem 0.25rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.plan-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 0 8px var(--primary-glow);
}

.audio-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}

.icon-control-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-speed);
}

.icon-control-btn:active {
  background: rgba(6, 182, 212, 0.15);
  border-color: var(--accent-cyan);
  color: #fff;
}

/* --- Chat Card --- */
.chat-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 250px;
}

.chat-card .card-header {
  justify-content: space-between;
}

.feedback-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.feedback-toggle span {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* Switch Toggle Styling */
.switch {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 16px;
}

.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: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

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

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

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

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

/* Chat History Window */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding-right: 0.25rem;
  max-height: 65vh;
  min-height: 350px;
  font-size: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.system-message {
  background: rgba(255, 255, 255, 0.02);
  border-left: 2px solid var(--accent-cyan);
  padding: 0.6rem 0.8rem;
  border-radius: 0 8px 8px 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.user-bubble {
  align-self: flex-end;
  background: rgba(147, 51, 234, 0.18);
  border: 1px solid rgba(147, 51, 234, 0.25);
  border-radius: 12px 12px 0 12px;
  padding: 0.65rem 0.85rem;
  max-width: 85%;
  color: #fff;
}

.agent-bubble {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px 12px 12px 0;
  padding: 0.65rem 0.85rem;
  max-width: 85%;
  color: var(--text-main);
  line-height: 1.4;
}

.thinking-bubble {
  color: var(--text-muted);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.thinking-dots {
  display: inline-block;
}

.thinking-dots span {
  animation: typing 1.4s infinite;
  display: inline-block;
  opacity: 0.3;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

/* Tool execution sub-bubbles */
.tool-bubble {
  align-self: flex-start;
  font-family: monospace;
  font-size: 0.7rem;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  color: var(--accent-cyan);
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  width: 90%;
  white-space: pre-wrap;
  word-break: break-all;
}

.tool-bubble summary {
  cursor: pointer;
  outline: none;
  font-weight: bold;
}

/* Live Voice Overlay */
.voice-transcribe-overlay {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 7, 19, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  padding: 2rem;
  border-radius: 0 0 16px 16px;
  animation: fadeIn 0.2s ease-out;
}

.voice-transcribe-overlay.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.transcript-preview {
  font-size: 1.1rem;
  text-align: center;
  color: #fff;
  margin: 1.5rem 0;
  line-height: 1.4;
  font-weight: 500;
  max-width: 90%;
}

.voice-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Pulsing voice wave bars */
.waves-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 50px;
}

.wave {
  width: 5px;
  height: 15px;
  background: linear-gradient(to top, var(--primary), var(--accent-cyan));
  border-radius: 3px;
  animation: waveAnimation 1s ease-in-out infinite alternate;
}

.wave:nth-child(1) { height: 10px; animation-delay: 0.1s; }
.wave:nth-child(2) { height: 25px; animation-delay: 0.3s; }
.wave:nth-child(3) { height: 40px; animation-delay: 0.5s; }
.wave:nth-child(4) { height: 20px; animation-delay: 0.2s; }
.wave:nth-child(5) { height: 8px; animation-delay: 0.4s; }

@keyframes waveAnimation {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.5); }
}

/* Chat Input Bar */
.chat-input-area {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  position: relative;
}

.chat-input-area input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  color: #fff;
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-speed);
}

.chat-input-area input:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 10px var(--primary-glow);
}

.mic-button {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 15px var(--primary-glow);
  transition: all var(--transition-speed);
}

.mic-button:active {
  transform: scale(0.92);
  box-shadow: 0 2px 8px var(--primary-glow);
}

.mic-button svg {
  width: 20px;
  height: 20px;
}

.send-button {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.send-button:active {
  background: rgba(147, 51, 234, 0.2);
  border-color: var(--primary);
  color: #fff;
}

.send-button svg {
  width: 16px;
  height: 16px;
}

/* --- Settings Panel Slide-Over --- */
.settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.25s ease-out;
}

.settings-overlay.hidden {
  display: none !important;
}

.settings-content {
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  border-radius: 20px 20px 0 0;
  border-bottom: none;
  background: #120b22;
  border-color: rgba(255, 255, 255, 0.08);
  padding: 1.5rem;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 0.5rem;
}

.settings-header h2 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 1px;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.75rem;
  cursor: pointer;
}

.close-btn:hover {
  color: #fff;
}

.settings-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.setting-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.setting-item label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.setting-item h3 {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  border-left: 3px solid var(--primary);
  padding-left: 0.4rem;
  margin-bottom: 0.25rem;
}

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

.input-with-action input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  color: #fff;
  font-size: 0.8rem;
  outline: none;
}

.input-with-action input:focus {
  border-color: var(--primary);
}

.btn {
  background: var(--primary);
  border: none;
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-speed);
}

.btn:hover, .btn:active {
  background: #7e22ce;
}

.small-btn {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

.help-text {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.wol-details {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.wol-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.wol-row .label {
  color: var(--text-muted);
}

.wol-row .val {
  font-family: monospace;
  font-weight: bold;
  color: var(--accent-cyan);
}

.select-all {
  user-select: all;
  -webkit-user-select: all;
}

.wol-instructions {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-top: 0.25rem;
}

.wol-instructions ol {
  padding-left: 1rem;
  margin-top: 0.25rem;
}

.wol-instructions li {
  margin-bottom: 0.2rem;
}

.access-url {
  font-family: monospace;
  background: rgba(6, 182, 212, 0.1);
  border: 1px dashed var(--accent-cyan);
  padding: 0.5rem;
  border-radius: 8px;
  text-align: center;
  color: var(--accent-cyan);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Model Selector dropdown in Header */
.model-select-wrapper {
  margin-right: 0.5rem;
}

.header-select {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 0.75rem;
  outline: none;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.header-select:focus {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.1);
}

.header-select option {
  background: #120b22;
  color: #fff;
}

/* File Explorer Drawer Overlay (Slide from left) */
.explorer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  display: flex;
  justify-content: flex-start;
  animation: fadeIn 0.25s ease-out;
}

.explorer-overlay.hidden {
  display: none !important;
}

.explorer-content {
  width: 85%;
  max-width: 320px;
  height: 100%;
  background: #0f0a1c;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-top: none;
  border-bottom: none;
  border-left: none;
  border-radius: 0;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  box-shadow: 10px 0 30px rgba(0,0,0,0.5);
  animation: slideRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideRight {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

/* File explorer tree items */
.explorer-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-main);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.03);
  text-align: left;
  word-break: break-all;
  transition: all var(--transition-speed);
}

.explorer-item:active {
  background: rgba(6, 182, 212, 0.15);
  border-color: rgba(6, 182, 212, 0.3);
  color: #fff;
}

.explorer-item.directory {
  font-weight: 600;
  color: var(--accent-cyan);
}

.explorer-item.file {
  opacity: 0.85;
}

.explorer-item-icon {
  font-size: 1rem;
}

/* Code Viewer Slide-up Sheet */
.sheet-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 95;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.25s ease-out;
}

.sheet-overlay.hidden {
  display: none !important;
}

.sheet-content {
  width: 100%;
  max-width: 600px;
  height: 85vh;
  border-radius: 20px 20px 0 0;
  border-bottom: none;
  background: #0d0818;
  border-color: rgba(255, 255, 255, 0.08);
  padding: 1.25rem;
  box-shadow: 0 -10px 30px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Keyboard Special Buttons Style */
.kbd-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-family: monospace;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}
.kbd-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}
.kbd-btn:active {
  background: var(--primary);
  border-color: var(--primary-glow);
  transform: scale(0.95);
}

/* Prevent automatic zoom and weird shifts on mobile devices when zooming */
@media (max-width: 768px) {
  html, body {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
  }
  
  /* Make app container fill the exact remaining viewport height */
  .app-container {
    flex: 1;
    height: 0; /* Let flexbox control the height */
    padding: 0.5rem;
    gap: 0.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent container itself from scrolling, let children scroll */
  }

  .chat-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    padding: 1rem;
  }

  .chat-messages {
    max-height: none !important;
    flex: 1;
    overflow-y: auto;
  }

  /* Prevent zoom on focus */
  input, textarea, select, .chat-input-area input {
    font-size: 16px !important;
  }
}

.hidden {
  display: none !important;
}

