/* --- Base Styles & Reset --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-image: url('./Wallpaper2.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-attachment: fixed;
  font-family: Arial, sans-serif, Helvetica, "Noto Sans";
  height: 100vh;
  overflow: hidden; 
  background-color: #0d1117; /* Fallback */
}

/* --- Top Bar (Glass Effect) --- */
.topBar {
  position: absolute;
  top: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(10, 15, 25, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 15px;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 9999;
}

.osName, .timeElement, .welcomeButton {
  background: linear-gradient(135deg, #1f2937, #111827);
  color: #e5e7eb;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.topBarRight {
  display: flex;
  gap: 15px;
}

.welcomeButton {
  cursor: pointer;
  color: #00ffaa;
  transition: all 0.2s ease;
  box-shadow: 0 0 10px rgba(0, 255, 170, 0.1);
}

.welcomeButton:hover {
  background: linear-gradient(135deg, #111827, #000);
  border-color: #00ffaa;
  box-shadow: 0 0 15px rgba(0, 255, 170, 0.3);
}

/* --- Desktop Icons --- */
.modalAppIcon {
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s ease;
  padding: 8px;
}
.modalAppIcon.selected {
  background-color: rgba(255, 255, 255, 0.15);
  outline: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(5px);
}
.iconText {
  margin-top: 8px; 
  color: #ffffff; 
  font-size: 14px; 
  font-weight: 500; 
  text-shadow: 0px 2px 4px rgba(0,0,0,0.9);
}

.cyberIcon {
  width: 100px;
  height: 100px;
  border-radius: 20px;
  background: rgba(10, 15, 20, 0.85);
  border: 2px solid var(--glow-color);
  box-shadow: 0 0 15px var(--glow-color), inset 0 0 10px var(--glow-color);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.3s ease-in-out;
}

.cyberIcon:hover {
  box-shadow: 0 0 25px var(--glow-color), inset 0 0 20px var(--glow-color);
  transform: scale(1.05);
}

.cyberEmoji {
  font-size: 48px;
  filter: drop-shadow(0 0 10px var(--glow-color));
  user-select: none;
}


/* --- Draggable Modal Window (The Sleek Redesign) --- */
.modalWindow {
  position: absolute;
  top: calc(50% - 175px); 
  left: calc(50% - 250px);
  width: 90%;
  max-width: 500px;
  background: rgba(15, 20, 30, 0.75); /* Dark Glass */
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 12px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 170, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #fff;
  resize: both;
  overflow: hidden;
  min-width: 250px;
  min-height: 200px;
}

/* Sleek top glowing border accent */
.modalWindow::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, #ffaa00, #dd500e, transparent);
  z-index: 10;
}

/* --- Modal Header --- */
.modalHeader {
  background: linear-gradient(90deg, rgba(7, 25, 45, 0.8), rgba(20, 10, 5, 0.8));
  padding: 12px 15px;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modalHeader:active {
  cursor: grabbing;
}

.modalTitle {
  background: -webkit-linear-gradient(#ffaa00, #ff5e00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  user-select: none;
}

.closeButton {
  cursor: pointer;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  font-weight: 600;
  color: #888;
  transition: all 0.2s;
}

.closeButton:hover {
  color: #ff3c00;
  transform: scale(1.15) rotate(90deg);
}

/* --- Modal Content General --- */
.modalContent {
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1; 
  width: 100%;
  box-sizing: border-box;
}

#welcomeDragImage {
  cursor: grab;
  border-radius: 50%;
  object-fit: cover;
  width: 100px;
  height: 100px;
  margin-bottom: 20px;
  box-shadow: 0 0 20px rgba(255, 170, 0, 0.4);
  transition: transform 0.2s;
}
#welcomeDragImage:hover {
  transform: scale(1.05);
}

.modalContent h1 {
  font-size: 22px;
  margin-bottom: 12px;
  color: #e2e8f0;
}

.modalContent p {
  font-size: 14px;
  line-height: 1.6;
  color: #9ca3af;
}

/* --- Vault UI --- */
.vaultContent {
  background: radial-gradient(circle at center, rgba(20,25,35,0.9) 0%, rgba(10,15,20,0.9) 100%);
}
.vaultContent h2 {
  color: #ffaa00;
  margin-bottom: 5px;
}
.vault-input-group {
  display: flex;
  gap: 12px;
  margin: 30px 0;
}
.vault-digit {
  width: 45px;
  height: 55px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 170, 0, 0.4);
  border-radius: 8px;
  color: #00ffaa;
  font-size: 28px;
  font-weight: bold;
  text-align: center;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.8);
  transition: all 0.2s ease;
  outline: none;
}
.vault-digit:focus {
  border-color: #00ffaa;
  box-shadow: 0 0 10px rgba(0, 255, 170, 0.4), inset 0 2px 5px rgba(0,0,0,0.8);
}
#vaultStatusMessage {
  font-weight: bold;
  letter-spacing: 1px;
  color: #ffaa00;
  margin-top: 10px;
}

/* --- Chadwick Chat UI --- */
.chadwickContent {
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden; /* Fixes window expansion */
}

/* Chadwick Dev Mode Override */
.dev-mode-active {
    border-color: #00ff00 !important;
    box-shadow: 0 0 15px rgba(0, 255, 0, 0.5) !important;
}
.dev-mode-active .modalTitle, .dev-mode-active .chadwick-text {
    color: #00ff00 !important;
}
.dev-mode-active #chadwickChat {
    background: rgba(0, 20, 0, 0.8) !important;
}

/* --- Memory Viewer UI --- */
.memoryContent {
  font-family: 'Courier New', Courier, monospace;
  background: #000;
  color: #00ffaa;
  padding: 10px;
}
.memory-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}
.memory-input {
  background: #111;
  border: 1px solid #00ffaa;
  color: #00ffaa;
  padding: 5px 10px;
  outline: none;
}
.memory-btn {
  background: #00ffaa;
  color: #000;
  border: none;
  padding: 5px 15px;
  cursor: pointer;
  font-weight: bold;
}
#memoryOutput {
  height: 250px;
  overflow-y: auto;
  white-space: pre-wrap;
  font-size: 13px;
}

.chatLog {
  flex: 1;
  padding: 15px;
  background: rgba(5, 10, 15, 0.4);
  overflow-y: auto; /* Forces scrolling only on the chat area */
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  box-sizing: border-box;
}
.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.42;
  word-wrap: break-word;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.bubble-bot {
  background: rgba(7, 50, 87, 0.6);
  border: 1px solid rgba(0, 255, 170, 0.2);
  color: #00ffaa;
  align-self: flex-start;
  border-bottom-left-radius: 3px;
}
.bubble-user {
  background: rgba(221, 80, 14, 0.6);
  border: 1px solid rgba(255, 170, 0, 0.2);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 3px;
}
.chatInputContainer {
  display: flex;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 15, 25, 0.8);
  width: 100%;
  flex-shrink: 0; /* Prevents input bar from being crushed */
  box-sizing: border-box;
}
#chadwickInput {
  flex: 1;
  border: none;
  background: transparent;
  padding: 14px 15px;
  font-size: 14px;
  color: #fff;
  outline: none;
}
#chadwickSendBtn {
  background: rgba(7, 50, 87, 0.8);
  color: #00ffaa;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 22px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.15s ease;
}
#chadwickSendBtn:hover {
  background: rgba(7, 50, 87, 1);
}

/* --- Image Editor UI --- */
.editorContent {
  gap: 20px;
}
.slider-controls {
  width: 100%;
  background: rgba(0,0,0,0.4);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
}
.slider-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.slider-row:last-child {
  margin-bottom: 0;
}
.slider-row label {
  color: #ffaa00;
  font-size: 14px;
  font-weight: bold;
  width: 80px;
  text-align: left;
}
.slider-row input[type=range] {
  flex: 1;
  margin-left: 10px;
  accent-color: #00ffaa;
}
.canvas-container {
  position: relative;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  background: #000;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
#editorCanvasImage {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.1s;
}
#hiddenClueText {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ff3c00;
  font-size: 20px; /* Smaller font to fit */
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(255, 0, 0, 0.8), 2px 2px 0px #000;
  opacity: 0; 
  pointer-events: none; 
  transition: opacity 0.1s;
  width: 100%;
  text-align: center;
}

/* --- Downloading Animation --- */
.downloading-sign {
  position: absolute;
  color: #00ffaa;
  font-weight: bold;
  font-size: 14px;
  background: rgba(0,0,0,0.7);
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid #00ffaa;
  animation: pulse 1s infinite alternate;
  pointer-events: none;
  z-index: 9000;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.05); opacity: 1; box-shadow: 0 0 10px #00ffaa; }
}
/* --- Files App UI --- */
.files-top-bar {
  background: #1e293b;
  padding: 10px 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  width: 100%;
  box-sizing: border-box;
}
.files-path-text {
  background: rgba(0, 0, 0, 0.4);
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  color: #00ffaa;
  flex: 1;
  margin-left: 10px;
}
.files-sidebar {
  width: 150px;
  background: rgba(10, 15, 20, 0.8);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  padding: 10px 0;
}
.sidebar-item {
  padding: 10px 15px;
  font-size: 13px;
  color: #ccc;
  cursor: pointer;
  text-align: left;
  transition: 0.2s;
}
.sidebar-item:hover, .sidebar-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.files-grid {
  flex: 1;
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  padding: 15px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 15px;
  position: relative;
  overflow-y: auto;
}
.file-app-icon {
  width: 70px;
  text-align: center;
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  transition: 0.1s;
}
.file-app-icon:hover {
  background: rgba(255, 255, 255, 0.15);
}
.file-icon-symbol {
  font-size: 32px;
  margin-bottom: 5px;
}
.file-icon-name {
  font-size: 12px;
  color: #fff;
  word-wrap: break-word;
}
.files-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.2s;
}
.files-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Right Click Context Menu */
.context-menu {
  display: none;
  position: absolute;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.8);
  width: 150px;
  z-index: 1000;
  overflow: hidden;
}
.context-item {
  padding: 10px 15px;
  font-size: 13px;
  color: #fff;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.context-item:hover {
  background: #1f2937;
}


.terminalContent {
  padding: 0;
  background-color: #020804;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 255, 170, 0.05) 2px,
    rgba(0, 255, 170, 0.05) 4px
  );
  animation: scanline 10s linear infinite;
  
  /* Force vertical flex alignment */
  display: flex;
  flex-direction: column;
  height: 100%; 
  width: 100%;
  overflow: hidden;
}
@keyframes scanline {
  0% { background-position: 0 0; }
  100% { background-position: 0 1000px; }
}
.terminalOutput {
  flex: 1; 
  width: 100%;
  padding: 15px;
  overflow-y: auto;
  color: #00ffaa;
  text-shadow: 0 0 5px rgba(0, 255, 170, 0.4);
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  box-sizing: border-box;
}
.terminalInput {
  background: rgba(0, 0, 0, 0.9);
  color: #00ffaa;
  border: none;
  border-top: 1px solid rgba(0, 255, 170, 0.3);
  padding: 12px 15px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 14px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
}