/* AQUA 2.0 — Custom Styles */
/* Core styles are handled by Tailwind CDN */
/* This file adds only custom utilities not covered by Tailwind */

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
.dark .skeleton {
  background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
  background-size: 200% 100%;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Transitions */
.page { transition: opacity 0.15s ease; }
.page.active { opacity: 1; }

/* PIN shake animation */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-4px); }
}

/* PIN dot transition */
.pin-dot { transition: all 0.15s ease; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }

/* Print */
@media print {
  header, nav, aside, .touch-target, #icon-rail, #folder-pane, #pane-resize-handle { display: none !important; }
  main, #content-area { margin: 0 !important; padding: 0 !important; }
}

/* ═════════════════════════════════════════════════════
   Outlook Layout Shell — Phase 1
   ═════════════════════════════════════════════════════ */

:root {
  --rail-width: 48px;
  --folder-pane-width: 250px;
  --top-bar-height: 48px;
  --row-height-compact: 28px;
  --row-height-normal: 36px;
  --row-height-spacious: 44px;
  --accent: #0078d4;
  --accent-hover: #106ebe;
  --row-height: var(--row-height-normal);
}
.dark {
  --accent: #4da6ff;
  --accent-hover: #78bcff;
}

/* ── Icon Rail ────────────────────────────────────── */
#icon-rail {
  width: var(--rail-width);
  background: #1e293b;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  flex-shrink: 0;
  z-index: 30;
  overflow-y: auto;
  overflow-x: hidden;
}
.dark #icon-rail { background: #0f172a; }

#icon-rail::-webkit-scrollbar { width: 0; }

.rail-logo {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: #22d3ee;
  font-size: 18px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.rail-divider {
  width: 24px; height: 1px;
  background: #334155;
  margin: 6px 0;
  flex-shrink: 0;
}

.rail-spacer { flex: 1; min-height: 8px; }

.rail-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  color: #94a3b8;
  cursor: pointer;
  position: relative;
  margin: 1px 0;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
  font-size: 16px;
  border: none; background: none;
}
.rail-icon:hover { background: rgba(255,255,255,0.08); color: #e2e8f0; }
.rail-icon.active { background: rgba(0,120,212,0.15); color: var(--accent); }

/* Tooltip */
.rail-icon[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%; transform: translateY(-50%);
  background: #1e293b; color: #f8fafc;
  padding: 4px 10px; border-radius: 4px;
  font-size: 12px; white-space: nowrap;
  z-index: 50; pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Badge */
.rail-badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px;
  background: #ef4444; color: white;
  font-size: 10px; font-weight: 700;
  border-radius: 8px; display: none;
  align-items: center; justify-content: center; padding: 0 4px;
}
.rail-badge.visible { display: flex; }

/* ── Folder Pane ──────────────────────────────────── */
#folder-pane {
  width: var(--folder-pane-width);
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.2s ease;
}
.dark #folder-pane { background: #1e293b; border-color: #334155; }
#folder-pane.collapsed { width: 0; overflow: hidden; border-right: none; }

#folder-pane-body { padding: 0; }

/* ── Resize Handle ────────────────────────────────── */
#pane-resize-handle {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  transition: background 0.15s;
  position: relative;
  z-index: 10;
}
#pane-resize-handle:hover,
#pane-resize-handle.dragging { background: var(--accent); }

/* ── Top App Bar ──────────────────────────────────── */
#top-app-bar {
  height: var(--top-bar-height);
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #ffffff;
  flex-shrink: 0;
  gap: 8px;
}
.dark #top-app-bar { background: #1a1f2e; border-color: #2a3040; }

#top-app-bar .bar-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  border: none; background: none;
  transition: background 0.15s, color 0.15s;
  font-size: 14px;
}
#top-app-bar .bar-btn:hover { background: #f1f5f9; color: #334155; }
.dark #top-app-bar .bar-btn:hover { background: #334155; color: #e2e8f0; }

#breadcrumb-module {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
}
.dark #breadcrumb-module { color: #e2e8f0; }

#global-search {
  font-size: 13px;
  outline: none;
}
#global-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0,120,212,0.15);
}

#user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #0891b2;
  display: flex; align-items: center; justify-content: center;
  color: white;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* User menu dropdown */
#user-menu {
  position: absolute; top: 44px; right: 8px;
  background: white; border: 1px solid #e2e8f0;
  border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 60; min-width: 180px;
  display: none;
}
.dark #user-menu { background: #1e293b; border-color: #334155; }
#user-menu.visible { display: block; }
#user-menu a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; font-size: 13px;
  color: #475569; cursor: pointer;
  transition: background 0.1s;
}
.dark #user-menu a { color: #cbd5e1; }
#user-menu a:hover { background: #f1f5f9; }
.dark #user-menu a:hover { background: #334155; }

/* ── Density System ───────────────────────────────── */
html[data-density="compact"] { --row-height: var(--row-height-compact); }
html[data-density="normal"]  { --row-height: var(--row-height-normal); }
html[data-density="spacious"]{ --row-height: var(--row-height-spacious); }

/* ── Improved Dark Mode (Outlook-matching) ────────── */
.dark body { background: #11151c; }
.dark #content-area { background: #11151c; }

/* ── Mobile Drawer ────────────────────────────────── */
#mobile-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 55;
  display: none;
}
#mobile-drawer-overlay.visible { display: block; }

#mobile-drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 280px;
  background: #0f172a;
  z-index: 56;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  color: white;
}
#mobile-drawer.open { transform: translateX(0); }

#mobile-drawer .drawer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 20px;
  color: #94a3b8;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.1s;
}
#mobile-drawer .drawer-item:hover,
#mobile-drawer .drawer-item.active { background: rgba(255,255,255,0.06); color: #e2e8f0; }
#mobile-drawer .drawer-item.active { color: var(--accent); }
#mobile-drawer .drawer-item i { width: 20px; text-align: center; }

/* ── Responsive ───────────────────────────────────── */
@media (max-width: 768px) {
  #icon-rail { display: none; }
  #folder-pane { display: none; }
  #pane-resize-handle { display: none; }
  #mobile-bottom-nav { display: flex !important; }
  #content-area { padding: 12px; }
  #folder-toggle-btn { display: none !important; }
}
@media (min-width: 769px) {
  #mobile-bottom-nav { display: none !important; }
  #hamburger-btn { display: none !important; }
}

/* ── Global Search Dropdown ───────────────────────── */
#search-dropdown {
  position: absolute; top: 100%; left: 0; right: 0;
  background: white; border: 1px solid #e2e8f0;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 50; display: none;
  max-height: 300px; overflow-y: auto;
}
.dark #search-dropdown { background: #1e293b; border-color: #334155; }
#search-dropdown.visible { display: block; }
#search-dropdown .search-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; cursor: pointer;
  font-size: 13px; color: #475569;
  transition: background 0.1s;
}
.dark #search-dropdown .search-item { color: #cbd5e1; }
#search-dropdown .search-item:hover,
#search-dropdown .search-item.highlighted { background: #f1f5f9; }
.dark #search-dropdown .search-item:hover,
.dark #search-dropdown .search-item.highlighted { background: #334155; }
