/* ══════════════════════════════════════════════════════
   dashboard.css
   Innovicloud — Dashboard Layout · Sidebar · Topbar
   ══════════════════════════════════════════════════════ */

/* ── LAYOUT ──────────────────────────────────────────── */
body { background: var(--bg-2); overflow-x: hidden; }

.dash-wrap { display: flex; min-height: 100vh; }

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
  width: 240px; flex-shrink: 0;
  background: var(--ink);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 200; transition: width .25s ease; overflow: hidden;
}
.sidebar.collapsed { width: 64px; }

/* Logo */
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0; overflow: hidden; white-space: nowrap;
}
.sidebar-logo-icon {
  width: 34px; height: 34px; background: var(--teal);
  border-radius: 9px; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,153,204,.4);
}
.sidebar-logo-icon svg { width: 18px; height: 18px; fill: #fff; }
.sidebar-logo-text {
  font-family: var(--font-head); font-size: 17px; font-weight: 800;
  color: #fff; transition: opacity .2s;
}
.sidebar-logo-text span { color: var(--teal); }
.sidebar.collapsed .sidebar-logo-text { opacity: 0; pointer-events: none; }

/* Nav */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.nav-section-label {
  font-family: var(--font-head); font-size: 10px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255,255,255,.3); padding: 14px 12px 6px;
  white-space: nowrap; overflow: hidden; transition: opacity .2s;
}
.sidebar.collapsed .nav-section-label { opacity: 0; }

.nav-item { list-style: none; }
.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.6); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .18s; white-space: nowrap;
  overflow: hidden; text-decoration: none; position: relative;
}
.nav-link i {
  font-size: 15px; flex-shrink: 0; width: 20px;
  text-align: center; transition: color .18s;
}
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link.active { background: var(--teal); color: #fff; box-shadow: 0 2px 12px rgba(0,153,204,.4); }
.nav-link-text { transition: opacity .2s; }
.sidebar.collapsed .nav-link-text { opacity: 0; pointer-events: none; }

/* Submenu */
.submenu-toggle .submenu-arrow {
  margin-left: auto; font-size: 10px;
  transition: transform .2s; flex-shrink: 0;
}
.sidebar.collapsed .submenu-arrow { opacity: 0; }
.nav-item.open > .submenu-toggle .submenu-arrow { transform: rotate(90deg); }
.submenu {
  max-height: 0; overflow: hidden;
  transition: max-height .3s ease; list-style: none; padding-left: 8px;
}
.nav-item.open > .submenu { max-height: 300px; }
.sidebar.collapsed .submenu { max-height: 0 !important; }
.submenu .nav-link {
  font-size: 13.5px; padding: 8px 12px; color: rgba(255,255,255,.5);
}
.submenu .nav-link:hover { color: #fff; background: rgba(255,255,255,.06); }
.submenu .nav-link i { font-size: 13px; color: rgba(255,255,255,.4); }

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 8px; border-top: 1px solid rgba(255,255,255,.08); flex-shrink: 0;
}
.sidebar-collapse-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: none; background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.5); font-family: var(--font-body);
  font-size: 13px; cursor: pointer; transition: all .18s;
  white-space: nowrap; overflow: hidden;
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-collapse-btn i { flex-shrink: 0; font-size: 14px; }
.sidebar-collapse-btn span { transition: opacity .2s; }
.sidebar.collapsed .sidebar-collapse-btn span { opacity: 0; }

/* Tooltip on collapse */
.sidebar.collapsed .nav-link { position: relative; }
.sidebar.collapsed .nav-link::after {
  content: attr(data-tooltip);
  position: absolute; left: 72px; top: 50%; transform: translateY(-50%);
  background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 600; font-family: var(--font-head);
  padding: 5px 10px; border-radius: 6px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s; box-shadow: var(--shadow-md);
}
.sidebar.collapsed .nav-link:hover::after { opacity: 1; }

/* ── TOPBAR ──────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; right: 0;
  left: 240px; height: var(--nav-h); z-index: 100;
  background: rgba(255,255,255,.95); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; transition: left .25s ease; box-shadow: var(--shadow-sm);
}
.topbar-menu-btn {
  width: 34px; height: 34px; border: none; background: var(--bg-2);
  border-radius: 8px; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  color: var(--ink-2); font-size: 15px; transition: all .18s;
}
.topbar-menu-btn:hover { background: var(--teal-lt); color: var(--teal); }
.topbar-page-title {
  font-family: var(--font-head); font-size: 16px; font-weight: 700; color: var(--ink);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.credit-badge {
  display: flex; align-items: center; gap: 7px;
  background: var(--teal-lt); border: 1px solid rgba(0,153,204,.2);
  border-radius: 100px; padding: 6px 14px;
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  color: var(--teal-dk);
}
.credit-badge i { font-size: 12px; }

.topbar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 100px;
  background: var(--bg-2); border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  cursor: pointer; transition: all .18s; text-decoration: none;
}
.topbar-user:hover { border-color: rgba(255,107,53,.3); color: #C94A1D; background: #FFF3EF; }

/* ── MAIN CONTENT ────────────────────────────────────── */
.dash-main {
  flex: 1; margin-left: 240px;
  transition: margin-left .25s ease; min-height: 100vh;
}
.sidebar.collapsed ~ .dash-main { margin-left: 64px; }
.main-content { padding: calc(var(--nav-h) + 32px) 32px 48px; }

/* ── MOBILE OVERLAY ──────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(11,30,61,.5); z-index: 199; backdrop-filter: blur(2px);
}
.sidebar-overlay.show { display: block; }

/* ── RESPONSIVE ──────────────────────────────────────── */
@media (min-width: 769px) {
  .topbar-menu-btn { display: none; }
}
@media (max-width: 768px) {
  .sidebar-footer { display: none; }
  .sidebar {
    width: 240px !important;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .dash-main { margin-left: 0 !important; }
  .topbar { left: 0 !important; }
  .main-content { padding: calc(var(--nav-h) + 20px) 16px 40px; }
}
