/* Main Desktop Styles */
body {
  margin: 0;
  padding: 0;
  font-family: "Chicago", monospace;
  overflow: hidden;
  background: #c0c0c0;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.1) 2px,
    rgba(0, 0, 0, 0.1) 4px
  );
}

/* Daily Facts Styles */
.daily-facts-container {
  margin: 20px auto;
  max-width: 550px;
  text-align: left;
}

.fact-box {
  margin-bottom: 12px;
  padding: 12px;
  background: #ffffff;
  border: 2px inset #c0c0c0;
  box-shadow: inset -1px -1px #dfdfdf, inset 1px 1px #0a0a0a;
}

.fact-title {
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 8px;
  color: #000080;
}

.fact-text {
  font-size: 12px;
  line-height: 1.4;
  color: #000000;
}

.fact-loading {
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: #808080;
  font-style: italic;
}

.fact-error {
  text-align: center;
  padding: 12px;
  font-size: 12px;
  color: #800000;
  background: #ffeeee;
  border: 1px solid #ff0000;
}

.desktop {
  width: 100dvw;
  height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Menu Bar Styles */
.menu-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 20px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  display: flex;
  align-items: center;
  z-index: 1000;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff;
}

.menu-item {
  padding: 2px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: normal;
  color: #000;
  user-select: none;
  border: 1px solid transparent;
}

.menu-item:hover {
  background: #000;
  color: #fff;
  border: 1px solid #000;
}

.menu-item:active {
  background: #808080;
  border: 1px solid #000;
}

/* Windows Container */
.windows-container {
  position: absolute;
  top: 20px;
  left: 0;
  width: 100%;
  height: calc(100dvh - 20px);
  pointer-events: none;
}

/* Window Styles */
.os-window {
  position: absolute;
  min-width: 300px;
  min-height: 200px;
  background: #c0c0c0;
  border: 2px outset #c0c0c0;
  pointer-events: all;
  z-index: 100;
  /* Animation properties */
  --translate-x: 0px;
  --translate-y: 0px;
  transform-origin: top left;
  /* System 6 inspired drop shadow */
  box-shadow: 2px 2px 0px #808080,
    /* Main shadow bottom-right */ 3px 3px 0px #404040,
    /* Deeper shadow for depth */ 4px 4px 0px #202020,
    /* Darkest shadow for classic Mac look */ -1px 4px 0px #606060,
    /* Left side shadow */ 0px 4px 0px #606060; /* Bottom shadow extension */
}

.os-window.active {
  z-index: 200;
  /* Enhanced shadow for active window */
  box-shadow: 2px 2px 0px #808080,
    /* Main shadow bottom-right */ 3px 3px 0px #404040,
    /* Deeper shadow */ 4px 4px 0px #202020,
    /* Darkest shadow */ 5px 5px 0px #101010,
    /* Extra depth for active window */ -1px 4px 0px #505050,
    /* Left side shadow (darker for active) */ 0px 5px 0px #505050; /* Bottom shadow extension */
}

.os-window.maximized {
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  /* Remove borders and shadows for clean fullscreen look */
  border: none !important;
  box-shadow: none !important;
}

/* Window animations */
@keyframes windowOpen {
  0% {
    transform: translate(var(--translate-x, 0), var(--translate-y, 0)) scale(0);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes windowClose {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(var(--translate-x, 0), var(--translate-y, 0)) scale(0);
  }
}

.os-window.opening {
  animation: windowOpen 0.3s ease-out forwards;
}

.os-window.closing {
  animation: windowClose 0.25s ease-in forwards;
}

/* Title Bar */
.os-window .title-bar {
  height: 19px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  user-select: none;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff;
}

.os-window.inactive {
  /* Subtler shadow for inactive windows */
  box-shadow: 1px 1px 0px #909090,
    /* Lighter main shadow bottom-right */ 2px 2px 0px #606060,
    /* Reduced depth */ 3px 3px 0px #404040,
    /* Lighter darkest shadow */ -1px 0px 0px #707070,
    /* Left side shadow (lighter for inactive) */ 0px 3px 0px #707070; /* Bottom shadow extension */
}

.os-window.inactive .title-bar {
  background: #808080;
  color: #c0c0c0;
}

.title-bar .title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  font-weight: bold;
  margin: 0;
  padding: 0 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: move;
  pointer-events: none;
}

.title-bar .window-controls {
  display: flex;
  gap: 6px;
  padding: 0 6px;
}

.title-bar .control-btn {
  width: 30px;
  height: 30px;
  border: 1px outset #c0c0c0;
  background: #c0c0c0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
}

.title-bar .control-btn:hover {
  background: #d0d0d0;
}

.title-bar .control-btn:active {
  border: 1px inset #c0c0c0;
  background: #a0a0a0;
}

.title-bar .close-btn:hover {
  background: #ff6b6b;
  color: #fff;
}

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

.title-bar .maximize-btn:hover {
  background: #fff;
  color: #fff;
}

.title-bar .maximize-btn:hover::after {
  color: #fff;
}

.title-bar .close-btn::after {
  content: "✕";
  color: #000;
  font-size: 20px;
}

.title-bar .maximize-btn::after {
  content: "⬛";
  color: #000;
  font-size: 20px;
}

/* Window Content */
.window-content {
  padding: 0;
  height: calc(100% - 27px);
  overflow: auto;
  background: #c0c0c0;
}

/* Resize Handle */
.resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  cursor: nw-resize;
  background: linear-gradient(
    45deg,
    transparent 40%,
    #808080 40%,
    #808080 50%,
    transparent 50%,
    transparent 60%,
    #808080 60%,
    #808080 70%,
    transparent 70%
  );
}

/* Hide resize handle when window is maximized */
.os-window.maximized .resize-handle {
  display: none !important;
}

/* Module-specific content styling */
.module-content {
  width: 100%;
  height: 100%;
  font-size: 12px;
  line-height: 1.4;
  overflow: auto;
  box-sizing: border-box;
}

.module-content h1 {
  font-size: 16px;
  margin: 0 0 8px 0;
  font-weight: bold;
}

.module-content h2 {
  font-size: 14px;
  margin: 8px 0 4px 0;
  font-weight: bold;
}

.module-content p {
  margin: 4px 0;
}

/* Scrollbar styling for webkit browsers */
.window-content::-webkit-scrollbar {
  width: 16px;
}

.window-content::-webkit-scrollbar-track {
  background: #c0c0c0;
  border: 1px inset #c0c0c0;
}

.window-content::-webkit-scrollbar-thumb {
  background: #808080;
  border: 1px outset #808080;
}

.window-content::-webkit-scrollbar-thumb:hover {
  background: #707070;
}

/* ASCII Art Styles */
.ascii-art {
  font-family: "Courier New", Courier, monospace;
  font-weight: bold;
  white-space: pre;
}

/* Username Change Dialog Styles */
.username-dialog .dialog-box {
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff,
    inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  font-family: "Chicago", monospace;
  font-size: 12px;
}

.username-dialog .dialog-title {
  font-family: "Chicago", monospace;
  font-size: 12px;
}

.username-dialog #username-input {
  font-family: "Chicago", monospace;
  background: #ffffff;
  border: 2px inset #c0c0c0;
  color: #000000;
}

.username-dialog #username-input:focus {
  outline: none;
  background: #ffffff;
}

.username-dialog .btn {
  min-width: 60px;
  padding: 2px 8px;
  font-family: "Chicago", monospace;
  font-size: 12px;
  background: #c0c0c0;
  border: 2px outset #c0c0c0;
  cursor: pointer;
}

.username-dialog .btn:hover {
  background: #d0d0d0;
}

.username-dialog .btn:active {
  border: 2px inset #c0c0c0;
}

.username-dialog .btn:disabled {
  color: #808080;
  cursor: not-allowed;
}

/* Mobile Window Class - applied to windows on mobile breakpoint */
.os-window.mobile-window {
  position: fixed !important;
  top: 20px !important; /* Account for menu bar */
  left: 0 !important;
  width: 100% !important;
  height: calc(100% - 20px) !important; /* Subtract menu bar height */
  min-width: unset !important;
  min-height: unset !important;
  border: none !important;
  box-shadow: none !important;
}

.os-window.mobile-window .resize-handle {
  display: none !important;
}

.os-window.mobile-window .title-bar {
  cursor: default !important;
}

/* Mobile Styles */
@media (max-width: 640px) {
  .username-dialog .dialog-box {
    width: 90%;
    min-width: 280px;
  }

  /* Remove borders and shadows for mobile fullscreen windows */
  .os-window {
    border: none !important;
    box-shadow: none !important;
  }

  /* Larger touch targets for mobile */
  .title-bar .control-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .title-bar .close-btn::after,
  .title-bar .maximize-btn::after {
    font-size: 24px;
  }
}

/* Desktop Icons */
.desktop-icon {
  position: absolute;
  width: 80px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  padding: 4px;
  border: 1px solid transparent;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid #808080;
}

.desktop-icon.selected {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid #000;
}

.desktop-icon-image {
  font-size: 32px;
  margin-bottom: 4px;
  pointer-events: none;
}

.desktop-icon-label {
  font-size: 11px;
  text-align: center;
  background: #c0c0c0;
  padding: 2px 4px;
  border: 1px solid #808080;
  max-width: 70px;
  word-wrap: break-word;
  pointer-events: none;
}

.desktop-icon.selected .desktop-icon-label {
  background: #000;
  color: #fff;
}

/* Folder Module */
.folder-module {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #c0c0c0;
}

.folder-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
}

.folder-back-btn {
  padding: 4px 8px;
  font-size: 12px;
  background: #c0c0c0;
  border: 2px outset #c0c0c0;
  cursor: pointer;
  font-family: "Chicago", monospace;
}

.folder-back-btn:hover:not(:disabled) {
  background: #d0d0d0;
}

.folder-back-btn:active:not(:disabled) {
  border: 2px inset #c0c0c0;
}

.folder-back-btn:disabled {
  color: #808080;
  cursor: not-allowed;
}

.folder-path {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-family: "Chicago", monospace;
}

.folder-path-label {
  font-weight: bold;
}

.folder-path-value {
  color: #000;
}

.folder-content {
  flex: 1;
  padding: 16px;
  overflow: auto;
  background: #fff;
  border: 2px inset #c0c0c0;
  margin: 8px;
}

.folder-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
}

.folder-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
}

.folder-item:hover {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid #c0c0c0;
}

.folder-item.selected {
  background: #000;
  color: #fff;
  border: 1px solid #000;
}

.folder-item-icon {
  font-size: 32px;
  margin-bottom: 4px;
}

.folder-item-name {
  font-size: 11px;
  text-align: center;
  word-wrap: break-word;
  max-width: 100%;
}

.folder-empty {
  text-align: center;
  color: #808080;
  font-size: 14px;
  padding: 32px;
}

/* Text Editor */
.text-editor {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #c0c0c0;
}

.text-editor-content {
  flex: 1;
  padding: 8px;
  display: flex;
  flex-direction: column;
}

.text-editor-textarea {
  flex: 1;
  width: 100%;
  padding: 8px;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  line-height: 1.5;
  background: #fff;
  color: #000;
  border: 2px inset #c0c0c0;
  resize: none;
  outline: none;
}

.text-editor-textarea:focus {
  background: #fff;
  color: #000;
}

/* Browser Window */
.browser-window {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #c0c0c0;
}

.browser-toolbar {
  padding: 4px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
}

.browser-address-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 2px inset #c0c0c0;
  padding: 2px 4px;
}

.browser-protocol {
  font-size: 12px;
}

.browser-url {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  color: #000;
}

.browser-open-tab {
  padding: 2px 8px;
  font-size: 14px;
  background: #c0c0c0;
  border: 2px outset #c0c0c0;
  cursor: pointer;
  font-weight: bold;
}

.browser-open-tab:hover {
  background: #d0d0d0;
}

.browser-open-tab:active {
  border-style: inset;
}

.browser-content {
  flex: 1;
  background: #fff;
  border: 2px inset #c0c0c0;
  margin: 4px;
  overflow: hidden;
}

.browser-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.browser-error {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}

.browser-error-content {
  text-align: center;
  padding: 20px;
  max-width: 400px;
}

.browser-error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.browser-error-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #000;
}

.browser-error-message {
  font-size: 12px;
  margin-bottom: 16px;
  color: #333;
  line-height: 1.5;
}

.browser-error-open {
  padding: 6px 16px;
  font-size: 12px;
  background: #c0c0c0;
  border: 2px outset #c0c0c0;
  cursor: pointer;
  font-weight: bold;
}

.browser-error-open:hover {
  background: #d0d0d0;
}

.browser-error-open:active {
  border-style: inset;
}

/* GitHub Repository Viewer */
.github-repo {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #c0c0c0;
}

.github-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
}

.github-breadcrumb {
  flex: 1;
  padding: 4px 8px;
  background: #fff;
  border: 2px inset #c0c0c0;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  overflow-x: auto;
  white-space: nowrap;
}

.github-breadcrumb-item {
  cursor: pointer;
  color: #0000ee;
}

.github-breadcrumb-item:hover {
  text-decoration: underline;
}

.github-open-browser {
  padding: 2px 8px;
  font-size: 14px;
  background: #c0c0c0;
  border: 2px outset #c0c0c0;
  cursor: pointer;
}

.github-open-browser:hover {
  background: #d0d0d0;
}

.github-open-browser:active {
  border-style: inset;
}

.github-content {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  margin: 4px;
  border: 2px inset #c0c0c0;
  padding: 8px;
}

.github-loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 12px;
}

.github-error {
  text-align: center;
  padding: 40px;
}

.github-error-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.github-error-message {
  font-size: 12px;
  color: #666;
}

.github-file-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.github-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  cursor: pointer;
  border: 1px solid transparent;
}

.github-item:hover {
  background: #e0e0e0;
  border: 1px dotted #000;
}

.github-item-icon {
  font-size: 14px;
  width: 20px;
  text-align: center;
}

.github-item-name {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  color: #000;
}

.github-readme-section {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 2px solid #c0c0c0;
}

.github-readme-header {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 12px;
  padding: 4px 8px;
  background: #c0c0c0;
  border: 2px outset #c0c0c0;
}

.github-readme-content {
  padding: 8px;
  font-size: 12px;
  line-height: 1.6;
}

.github-readme-content h1 {
  font-size: 18px;
  margin: 16px 0 8px 0;
  border-bottom: 1px solid #ccc;
  padding-bottom: 4px;
}

.github-readme-content h2 {
  font-size: 16px;
  margin: 14px 0 6px 0;
}

.github-readme-content h3 {
  font-size: 14px;
  margin: 12px 0 4px 0;
}

.github-readme-content p {
  margin: 8px 0;
}

.github-readme-content code {
  background: #f0f0f0;
  padding: 2px 4px;
  border: 1px solid #ccc;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
}

.github-readme-content pre {
  background: #f0f0f0;
  border: 2px inset #c0c0c0;
  padding: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.github-readme-content pre code {
  background: transparent;
  border: none;
  padding: 0;
}

.github-readme-content a {
  color: #0000ee;
  text-decoration: none;
}

.github-readme-content a:hover {
  text-decoration: underline;
}

.github-file-viewer {
  display: flex;
  flex-direction: column;
}

.github-file-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px;
  background: #c0c0c0;
  border: 2px outset #c0c0c0;
  margin-bottom: 8px;
}

.github-file-name {
  font-weight: bold;
  font-size: 12px;
}

.github-file-size {
  font-size: 11px;
  color: #666;
}

.github-code-viewer {
  background: #f0f0f0;
  border: 2px inset #c0c0c0;
  padding: 12px;
  overflow: auto;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre;
  max-height: 500px;
}

.github-markdown-viewer {
  padding: 12px;
  font-size: 12px;
  line-height: 1.6;
}

.github-markdown-viewer h1 {
  font-size: 18px;
  margin: 16px 0 8px 0;
  border-bottom: 1px solid #ccc;
  padding-bottom: 4px;
}

.github-markdown-viewer h2 {
  font-size: 16px;
  margin: 14px 0 6px 0;
}

.github-markdown-viewer h3 {
  font-size: 14px;
  margin: 12px 0 4px 0;
}

.github-markdown-viewer p {
  margin: 8px 0;
}

.github-markdown-viewer code {
  background: #f0f0f0;
  padding: 2px 4px;
  border: 1px solid #ccc;
  font-family: "Courier New", Courier, monospace;
  font-size: 11px;
}

.github-markdown-viewer pre {
  background: #f0f0f0;
  border: 2px inset #c0c0c0;
  padding: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.github-markdown-viewer pre code {
  background: transparent;
  border: none;
  padding: 0;
}

.github-markdown-viewer a {
  color: #0000ee;
  text-decoration: none;
}

.github-markdown-viewer a:hover {
  text-decoration: underline;
}

.github-image-viewer {
  padding: 12px;
  text-align: center;
  background: #f0f0f0;
  border: 2px inset #c0c0c0;
}

.github-image-viewer img {
  max-width: 100%;
  height: auto;
  border: 1px solid #ccc;
}

/* Responsive adjustments for folder module */
@media (max-width: 640px) {
  .folder-items {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
  }

  .desktop-icon {
    width: 60px;
    height: 60px;
  }

  .desktop-icon-image {
    font-size: 24px;
  }

  .desktop-icon-label {
    font-size: 10px;
    max-width: 55px;
  }
}
