/* ══════════════════════════════════════════════════════════════
   App Layout — Sidebar + Content + Focus Bar
   ══════════════════════════════════════════════════════════════ */

/* ── App Shell ───────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) var(--focus-bar-height);
  height: 100vh;
  width: 100vw;
  max-width: 100vw;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.sidebar-brand-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.theme-toggle-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}
.theme-toggle-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: scale(1.05);
}

/* ── Sidebar Nav ─────────────────────────────────────────────── */
.sidebar-nav {
  flex: 1;
  padding: var(--space-3) var(--space-2);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: var(--space-3) var(--space-3) var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

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

.nav-item.active {
  background: rgba(99,102,241,0.12);
  color: var(--accent-hover);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-item-icon,
.nav-item:hover .nav-item-icon { opacity: 1; }

.nav-item-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

/* ── Sidebar Footer ──────────────────────────────────────────── */
.sidebar-footer {
  padding: var(--space-3) var(--space-2);
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.sidebar-user:hover { background: var(--bg-elevated); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── User Popup Menu ─────────────────────────────────────────── */
.user-popup-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 8px;
  right: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 200;
  animation: popupFadeIn 150ms ease;
}
.user-popup-menu.active {
  display: flex;
}

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

.user-popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
}
.user-popup-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.user-popup-details {
  overflow: hidden;
}
.user-popup-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-popup-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-popup-role {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 1px 6px;
  border-radius: 999px;
  margin-top: 2px;
}

.user-popup-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.user-popup-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all var(--transition-fast);
}
.user-popup-item:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.user-popup-item-danger {
  color: #ef4444;
}
.user-popup-item-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* ── Main Content ────────────────────────────────────────────── */
.main-content {
  grid-column: 2;
  grid-row: 1;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  background: var(--bg-base);
}

.page-container {
  padding: var(--space-6);
  max-width: 100%;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  box-sizing: border-box;
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-base);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  /* Yapışkan header'ın tam kenarlara oturması için container padding kompanzasyonu */
  margin: calc(-1 * var(--space-6)) calc(-1 * var(--space-6)) 0 calc(-1 * var(--space-6));
  padding: var(--space-6) var(--space-6) var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.page-title {
  font-size: var(--font-size-2xl);
  font-weight: 700;
}

/* ── Bento Grid ──────────────────────────────────────────────── */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.bento-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

.bento-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.bento-span-2 {
  grid-column: span 2;
}

/* ── Focus Bar (Global Odak Çubuğu — PRD §2) ────────────────── */
.focus-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  height: var(--focus-bar-height);
  z-index: 200;
}

.focus-bar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  min-width: 0;
}

.focus-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
  flex-shrink: 0;
}

.focus-indicator.paused { background: var(--warn-yellow); animation: none; }
.focus-indicator.idle   { background: var(--text-muted);   animation: none; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(99,102,241,0); }
}

.focus-label {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 600;
  flex-shrink: 0;
}

.focus-task-name {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.focus-timer {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--text-accent);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 64px;
}

/* ── Focus Bar Dropdown ──────────────────────────────────────── */
.focus-switcher {
  position: relative;
}

.focus-switcher-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: var(--space-1) var(--space-3);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.focus-switcher-btn:hover {
  background: var(--bg-card);
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.focus-dropdown {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  min-width: 260px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  z-index: 300;
}

.focus-dropdown.open { display: block; animation: fadeIn 150ms ease; }

.focus-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-size: var(--font-size-sm);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  color: var(--text-secondary);
}
.focus-dropdown-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.focus-dropdown-item.current { color: var(--text-accent); background: rgba(99,102,241,0.08); }

/* ── Focus Bar Idle State ────────────────────────────────────── */
.focus-idle-text {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-style: italic;
}

/* ── Focus Bar Right Actions ─────────────────────────────────── */
.focus-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.focus-action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.focus-action-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-strong);
}
.focus-action-btn.pause-btn:hover {
  color: var(--warn-yellow);
  border-color: rgba(245,158,11,0.4);
  background: rgba(245,158,11,0.08);
}
