:root {
  /* Color Palette - Dark Glassmorphism */
  --bg-base: #0f172a;       /* Deep slate background */
  --bg-surface: rgba(30, 41, 59, 0.6); /* Translucent surface */
  --bg-surface-hover: rgba(51, 65, 85, 0.8);
  --bg-surface-active: rgba(71, 85, 105, 0.9);
  
  --primary: #8b5cf6;       /* Vibrant purple */
  --primary-hover: #7c3aed;
  --primary-glow: rgba(139, 92, 246, 0.5);
  
  --danger: #ef4444;
  --danger-hover: #dc2626;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --border: rgba(255, 255, 255, 0.08);
  --border-light: rgba(255, 255, 255, 0.15);
  
  --glass-blur: blur(16px);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  
  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-base);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  overflow: hidden; /* Prevent body scroll, handle scroll in sub-containers */
  -webkit-font-smoothing: antialiased;
}

/* --- Ambient Background --- */
.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  background: var(--bg-base);
}

.blob-1, .blob-2, .blob-3 {
  position: absolute;
  filter: blur(100px);
  border-radius: 50%;
  opacity: 0.5;
  animation: float 20s infinite alternate ease-in-out;
}

.blob-1 {
  top: -10%; left: -10%;
  width: 50vw; height: 50vw;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.3) 0%, transparent 60%);
  animation-delay: 0s;
}

.blob-2 {
  bottom: -20%; right: -10%;
  width: 60vw; height: 60vw;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, transparent 60%);
  animation-delay: -5s;
}

.blob-3 {
  top: 40%; left: 40%;
  width: 40vw; height: 40vw;
  background: radial-gradient(circle, rgba(236, 72, 153, 0.15) 0%, transparent 60%);
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(5%, 5%) scale(1.05); }
  100% { transform: translate(-5%, 10%) scale(0.95); }
}

/* --- Utilities --- */
.hidden { display: none !important; }
.text-danger { color: var(--danger) !important; }
.muted { color: var(--text-muted); font-size: 0.875rem; }

/* --- Glassmorphism Basics --- */
.glass-panel {
  background: var(--bg-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  box-shadow: var(--glass-shadow);
}

.glass-card {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}

/* --- Button Styles --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  font-family: inherit;
  outline: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-glow {
  box-shadow: 0 0 15px var(--primary-glow);
}

.btn-glow:hover {
  box-shadow: 0 0 25px var(--primary-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-light);
}

.btn-icon {
  padding: 0.5rem;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

.btn-icon:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.link-btn {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1rem;
  cursor: pointer;
  text-align: left;
  transition: color var(--transition-fast);
}

.link-btn:hover {
  color: var(--primary);
}

/* --- App Layout --- */
#app {
  width: 100vw;
  height: 100vh;
  display: flex;
}

.view {
  width: 100%;
  height: 100%;
}

/* --- Auth View --- */
.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.auth-header .brand-icon {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.auth-header h1 {
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.auth-header .subtitle {
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.25rem;
}

.auth-desc {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.device-panel {
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-top: 1rem;
  border: 1px solid var(--border);
  animation: slideUp 0.4s ease-out forwards;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.device-info {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.info-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
}

.info-group .label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.highlight-code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.link-glow {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.link-glow:hover {
  text-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

.status-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Main View Layout --- */
.main-view {
  display: flex;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  border-radius: 0;
  z-index: 10;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.brand-icon-small {
  font-size: 1.5rem;
  color: var(--primary);
}

.sidebar-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-footer {
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: left;
}

.nav-item i {
  font-size: 1.25rem;
}

.nav-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-main);
}

.nav-item.active {
  background: rgba(139, 92, 246, 0.15);
  color: var(--primary);
}

/* --- Content Area --- */
.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  z-index: 5;
  height: 73px;
}

.breadcrumb-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.breadcrumb-area h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.breadcrumbs {
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mode-switch-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-surface-hover);
  border-radius: var(--radius-sm);
  padding: 0.25rem;
  border: 1px solid var(--border);
}

.mode-icon {
  margin-left: 0.5rem;
  color: var(--text-muted);
}

.glass-select {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 0.375rem 0.5rem;
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
}

.glass-select option {
  background: var(--bg-surface);
  color: var(--text-main);
}

/* --- Scroll Container & Content --- */
.scroll-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2rem;
}

.scroll-container::-webkit-scrollbar {
  width: 8px;
}

.scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-container::-webkit-scrollbar-thumb {
  background: var(--bg-surface-hover);
  border-radius: var(--radius-full);
}

.content-view-inner {
  max-width: 1200px;
  margin: 0 auto;
  animation: fadeIn 0.3s ease-out forwards;
}

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

/* --- File List (Cards) --- */
.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.file-card {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  transition: all var(--transition-fast);
}

.file-card:hover {
  background: rgba(51, 65, 85, 0.6);
  border-color: var(--border-light);
  transform: translateY(-1px);
}

.file-row {
  display: grid;
  grid-template-columns: minmax(200px, 2.5fr) 100px 120px 160px auto;
  gap: 1rem;
  align-items: center;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.file-icon {
  font-size: 1.5rem; 
  color: var(--primary);
  flex-shrink: 0;
}

.file-icon.folder {
  color: #fbbf24;
}

.file-name-container {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-name-container .link-btn {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.file-name-container .muted {
  font-size: 0.75rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.file-card:hover .row-actions {
  opacity: 1;
}

/* --- Grid List for Offline Tasks & Account --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.stat-card, .offline-card {
  background: rgba(30, 41, 59, 0.4);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all var(--transition-fast);
}

.stat-card:hover, .offline-card:hover {
  border-color: var(--border-light);
}

.stat-card h3, .offline-card h3 {
  font-weight: 600;
  font-size: 1.125rem;
  color: var(--text-main);
}

.task-input-wrapper {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.glass-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0.625rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

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

/* --- Modal --- */
.glass-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--bg-surface);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  padding: 0;
  width: 90vw;
  max-width: 800px;
  max-height: 90vh;
  color: var(--text-main);
  opacity: 0;
  transition: all var(--transition-smooth);
  pointer-events: none;
}

.glass-modal[open] {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.glass-modal::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-weight: 600;
  font-size: 1.125rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  min-height: 200px;
}

.modal-body video,
.modal-body audio,
.modal-body img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

/* --- Toast --- */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
}

.toast {
  background: var(--bg-surface-active);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-light);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--glass-shadow);
  transform: translateX(120%);
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.toast.hiding {
  animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideInRight {
  to { transform: translateX(0); }
}

@keyframes slideOutRight {
  to { opacity: 0; transform: translateX(100%); }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
}
.empty-state i {
  font-size: 3rem;
  opacity: 0.5;
}
