/**
 * css/layout.css — App Shell Layout
 * ====================================
 * Sidebar + Header + Main + Right Panel layout.
 * Responsive breakpoints: desktop / tablet / mobile.
 */

/* ══════════════════════════════════════════════════════
   APP SHELL
   ══════════════════════════════════════════════════════ */
#app-root {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  transition: transform var(--transition), width var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
}
.sidebar-logo-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
}
.sidebar-logo-text .app-name    { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); display: block; }
.sidebar-logo-text .app-tagline { font-size: 0.7rem; color: var(--text-muted); display: block; }

/* ── Nav Links ── */
.sidebar-nav { flex: 1; padding: 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 2px;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover   { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active  { background: var(--accent-light); color: var(--accent); }
.nav-item .nav-icon { font-size: 1rem; flex-shrink: 0; width: 20px; text-align: center; }
.nav-item .nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── User Profile (bottom of sidebar) ── */
.sidebar-user {
  padding: 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}
.sidebar-user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--bg-hover);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}
.sidebar-user-card:hover { background: var(--border); }
.sidebar-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.sidebar-user-name { font-weight: 600; font-size: 0.85rem; color: var(--text-primary); }
.sidebar-user-role { font-size: 0.72rem; color: var(--text-muted); }
.sidebar-logout-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; margin-top: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.8rem;
  background: none; border: none;
  transition: all var(--transition);
}
.sidebar-logout-btn:hover { color: var(--danger); background: #ef444415; }

.sidebar-quote {
  padding: 10px 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
  border-top: 1px solid var(--border);
}

/* ── MAIN WRAPPER ── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
}

/* ── HEADER ── */
.app-header {
  height: var(--header-h);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: sticky; top: 0; z-index: 100;
  flex-shrink: 0;
}
.header-title-area { flex: 1; }
.header-main-title {
  font-size: 1.5rem; font-weight: 700;
  color: var(--text-primary);
}
.header-week-label {
  font-size: 0.8rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; margin-top: 2px;
}
.header-actions {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

/* ── CONTENT AREA ── */
.content-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0;
  min-width: 0;
}

/* ── RIGHT PANEL ── */
#right-panel {
  width: var(--right-w);
  border-left: 1px solid var(--border);
  background: var(--bg-secondary);
  overflow-y: auto;
  flex-shrink: 0;
}
.right-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.right-section-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.right-section-header h3 {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.right-section-icon { color: var(--accent); font-size: 0.9rem; }

/* ── WEEK NAVIGATION (in header) ── */
.week-nav {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
}
.week-nav-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none; border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.week-nav-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.week-nav-btn.active { background: var(--accent-light); color: var(--accent); }

/* ── SIDEBAR TOGGLE (tablet) ── */
.sidebar-toggle {
  display: none;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  background: none; border: none;
  font-size: 1.2rem;
}
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — TABLET (< 1024px)
   ══════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --right-w: 240px; }

  .sidebar {
    transform: translateX(-100%);
    z-index: 300;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }
  .sidebar-overlay.visible { display: block; }
  .sidebar-toggle           { display: flex; align-items: center; justify-content: center; }

  .main-wrapper { margin-left: 0; }
  
  .hide-on-mobile { display: none; }
  .week-nav-btn { padding: 4px 8px; font-size: 0.8rem; }
  .header-actions { gap: 4px; }
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE — MOBILE (< 768px)
   ══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root { --header-h: 56px; }

  #right-panel { display: none; }

  .header-main-title { font-size: 1.1rem; }
  .header-week-label { display: none; }

  /* Bottom navigation bar */
  .bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    z-index: 200;
    padding: 4px 0;
  }
  .bottom-nav-item {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px; padding: 6px 4px;
    font-size: 0.62rem;
    color: var(--text-muted);
    background: none; border: none;
    transition: color var(--transition);
  }
  .bottom-nav-item.active { color: var(--accent); }
  .bottom-nav-item .bn-icon { font-size: 1.2rem; }

  #main-content { padding-bottom: 70px; }

  .week-nav { display: flex; padding: 2px; }
  .week-nav-btn { padding: 4px; }

  /* FAB — floating add button on mobile */
  .fab {
    position: fixed; bottom: 76px; right: 16px;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 1.5rem;
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-lg);
    z-index: 201;
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
  }
  .fab:hover { transform: scale(1.1); box-shadow: 0 8px 24px rgba(108,92,231,0.4); }

  /* Mobile drawer για right panel */
  .mobile-drawer {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--bg-modal);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-top: 1px solid var(--border);
    padding: 20px 16px;
    max-height: 85vh;
    overflow-y: auto;
    z-index: 400;
    animation: slideUp 0.25s ease;
  }
  .mobile-drawer.open { display: block; }
  .mobile-drawer-handle {
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 0 auto 16px;
  }
}

/* Desktop: hide mobile-only elements */
@media (min-width: 769px) {
  .bottom-nav  { display: none; }
  .fab         { display: none; }
  .mobile-drawer { display: none !important; }
  .mobile-drawer-overlay { display: none !important; }
}
