@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Fira+Code:wght@400;500&display=swap');

:root {
  /* Default Colors - Linux Mint Green */
  --mint-accent: #8fae53;
  --mint-accent-hover: #7b9846;
  --mint-accent-rgb: 143, 174, 83;
  
  /* Wallpaper Gradient Stops */
  --wallpaper-start: #0f172a;
  --wallpaper-mid: #022c22;
  --wallpaper-end: #090d16;
  
  /* Active Desktop Wallpaper styling */
  --wallpaper: radial-gradient(circle at 50% 50%, var(--wallpaper-mid) 0%, var(--wallpaper-start) 60%, var(--wallpaper-end) 100%);
  
  /* Selection colors */
  --selection-bg: rgba(143, 174, 83, 0.3);
  --selection-text: #ffffff;
}

/* Light Mode Overrides */
.theme-light {
  --wallpaper-start: #f8fafc;
  --wallpaper-mid: #dcfce7;
  --wallpaper-end: #cbd5e1;
  --wallpaper: radial-gradient(circle at 50% 50%, var(--wallpaper-mid) 0%, var(--wallpaper-start) 60%, var(--wallpaper-end) 100%);
  --selection-bg: rgba(143, 174, 83, 0.4);
  --selection-text: #0f172a;
}

/* Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

::selection {
  background-color: var(--selection-bg);
  color: var(--selection-text);
}

/* Custom Scrollbar for Terminal & Nemo */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.dark ::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

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

.dark ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--mint-accent);
}

/* Glassmorphism Styles */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.dark .glass {
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-panel {
  background: rgba(248, 250, 252, 0.85);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.dark .glass-panel {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Window Custom Styling & States */
.app-window {
  position: absolute;
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3), 0 0 1px 1px rgba(255, 255, 255, 0.1) inset;
  transition: box-shadow 0.15s ease, transform 0.15s ease-out, opacity 0.15s ease-out;
  pointer-events: auto !important; /* Enable pointer events inside spawn zone */
}

.app-window.active-window {
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.45), 0 0 0 1.5px var(--mint-accent) inset, 0 0 10px 1px rgba(var(--mint-accent-rgb), 0.25);
}

/* Animations */
@keyframes window-open {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.window-opening {
  animation: window-open 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Desktop Icon Styles */
.desktop-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 86px;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.desktop-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(4px);
}

.theme-light .desktop-icon:hover {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.desktop-icon:focus-within {
  background: rgba(var(--mint-accent-rgb), 0.2) !important;
  border: 1px solid rgba(var(--mint-accent-rgb), 0.4) !important;
}

/* Custom overrides for icons on the desktop grid */
#desktop-grid .desktop-icon {
  height: auto;
  min-height: 96px;
  justify-content: flex-start;
}

/* Mint Accent Custom Utilities */
.bg-mint-accent {
  background-color: var(--mint-accent);
}
.bg-mint-accent-hover:hover {
  background-color: var(--mint-accent-hover);
}
.text-mint-accent {
  color: var(--mint-accent);
}
.border-mint-accent {
  border-color: var(--mint-accent);
}
.focus-ring-mint:focus {
  outline: 2px solid var(--mint-accent);
  outline-offset: 1px;
}

/* Resizing Borders & Grabs */
.window-resizer {
  position: absolute;
  z-index: 10;
}
.resizer-n { top: -4px; left: 4px; right: 4px; height: 8px; cursor: ns-resize; }
.resizer-s { bottom: -4px; left: 4px; right: 4px; height: 8px; cursor: ns-resize; }
.resizer-e { right: -4px; top: 4px; bottom: 4px; width: 8px; cursor: ew-resize; }
.resizer-w { left: -4px; top: 4px; bottom: 4px; width: 8px; cursor: ew-resize; }
.resizer-nw { top: -4px; left: -4px; width: 10px; height: 10px; cursor: nwse-resize; }
.resizer-ne { top: -4px; right: -4px; width: 10px; height: 10px; cursor: nesw-resize; }
.resizer-sw { bottom: -4px; left: -4px; width: 10px; height: 10px; cursor: nesw-resize; }
.resizer-se { bottom: -4px; right: -4px; width: 10px; height: 10px; cursor: nwse-resize; }

/* Custom Terminal styling */
.terminal-output {
  font-family: 'Fira Code', 'Courier New', Courier, monospace;
}

/* Mobile viewport adaptive constraints (under 768px) */
@media (max-width: 767px) {
  .app-window {
    left: 0 !important;
    top: 0 !important;
    width: 100vw !important;
    height: calc(100vh - 48px) !important;
    transform: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  
  .window-resizer {
    display: none !important;
  }
}

/* Custom overrides for icons on the Nemo files grid to prevent overlapping of multiline names */
#nemo-files-grid .desktop-icon {
  width: 76px !important;
  height: auto !important;
  min-height: 82px !important;
  justify-content: flex-start !important;
  padding-bottom: 8px;
}

/* ==========================================
   Xreader Application Styling
   ========================================== */
.xreader-container {
  display: flex;
  flex: 1;
  min-height: 0;
  position: relative;
}

/* Sidebar list index */
.xreader-sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, padding 0.2s ease, border-width 0.2s ease;
}

.xreader-sidebar.collapsed {
  width: 0px !important;
  padding-left: 0px !important;
  padding-right: 0px !important;
  border-right-width: 0px !important;
  overflow: hidden;
}

.xreader-sidebar-list button {
  transition: all 0.15s ease;
}

.xreader-sidebar-list button:hover {
  background-color: rgba(143, 174, 83, 0.1);
  color: var(--mint-accent);
}

.xreader-sidebar-list button.active {
  background-color: rgba(143, 174, 83, 0.18);
  color: var(--mint-accent);
  border-left: 3px solid var(--mint-accent);
  padding-left: calc(0.75rem - 3px);
}

/* Main Canvas Viewport */
.xreader-canvas-viewport {
  flex: 1;
  overflow: auto;
  background-color: #f1f5f9;
  padding: 2.5rem 1rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-width: 0;
}

.dark .xreader-canvas-viewport {
  background-color: #0f172a;
}

/* A4 Sheet Simulation */
.xreader-page-sheet-container {
  display: flex;
  justify-content: center;
  width: 100%;
  transform-origin: top center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.xreader-page-sheet {
  background-color: #ffffff;
  color: #0f172a;
  width: 210mm;
  min-height: 297mm;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  padding: 3rem 2.5rem;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
  user-select: text; /* Allow text selection inside pages */
}

.dark .xreader-page-sheet {
  background-color: #1e293b;
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Content Typography inside A4 page */
.xreader-page-sheet h1 {
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 0.5rem;
}

.dark .xreader-page-sheet h1 {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.xreader-page-sheet h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-top: 1.8rem;
  margin-bottom: 0.8rem;
}

.xreader-page-sheet p {
  line-height: 1.6;
  margin-bottom: 1rem;
}

.xreader-page-sheet ul, .xreader-page-sheet ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
  list-style-type: disc;
}

.xreader-page-sheet li {
  margin-bottom: 0.4rem;
  line-height: 1.5;
}

/* Responsive media scaling */
.xreader-page-sheet img {
  display: block;
  margin: 1.5rem auto;
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.xreader-page-sheet iframe {
  display: block;
  margin: 1.5rem auto;
  max-width: 100%;
}

/* Interactive elements */
.xreader-btn {
  cursor: pointer;
}

/* Mobile-Specific Adaptations (< 768px) */
@media (max-width: 767px) {
  .xreader-sidebar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    z-index: 40;
    box-shadow: 10px 0 15px -3px rgba(0, 0, 0, 0.12);
  }
  
  .dark .xreader-sidebar {
    box-shadow: 10px 0 25px -3px rgba(0, 0, 0, 0.5);
  }
  
  .xreader-canvas-viewport {
    padding: 1rem 0.5rem;
  }
  
  .xreader-page-sheet {
    width: 100% !important;
    padding: 2rem 1.2rem !important;
    min-height: auto !important;
    border-radius: 0px !important;
    border-left: none !important;
    border-right: none !important;
  }
  
  .xreader-page-sheet-container {
    transform: none !important; /* Lock zoom to normal on mobile since we fit to screen */
  }
}

