/* ===================================================================
   A9 VENTURES - DASHBOARD & WORKSPACE STYLES
   Full Light & Dark Theme Support + Native Mobile App Responsiveness
   Includes Off-Canvas Mobile Drawer & Bottom Navigation App Dock
=================================================================== */

.app-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-main);
  transition: background-color var(--transition-normal);
  position: relative;
  overflow-x: hidden;
  max-width: 100vw;
}

/* ===================================================================
   SIDEBAR & OFF-CANVAS MOBILE DRAWER (LINEAR / RAYCAST PRO GRADE)
=================================================================== */
.sidebar {
  width: 260px;
  background-color: #07090e;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all var(--transition-normal);
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="light"] .sidebar {
  background-color: #ffffff;
  border-right: 1px solid #e2e8f0;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.02);
}

.sidebar-header {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .sidebar-header {
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.sidebar-brand-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo-icon {
  width: 34px;
  height: 34px;
  background: var(--primary-gradient);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 0 16px rgba(225, 29, 72, 0.4);
}

.sidebar-brand-name {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

[data-theme="light"] .sidebar-brand-name {
  color: #0f172a;
}

.sidebar-brand-sub {
  font-size: 0.65rem;
  color: #fda4af;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 750;
  font-family: var(--font-mono);
}

[data-theme="light"] .sidebar-brand-sub {
  color: var(--primary);
}

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 1.35rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

[data-theme="light"] .sidebar-close-btn {
  background: #f1f5f9;
  color: #0f172a;
}

.sidebar-nav {
  padding: 14px 10px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-category {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 12px 10px 4px;
}

[data-theme="light"] .nav-category {
  color: #64748b;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: #94a3b8;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

[data-theme="light"] .nav-item {
  color: #475569;
}

.nav-item i {
  font-size: 0.95rem;
  width: 20px;
  text-align: center;
  color: #64748b;
  transition: color 0.2s ease;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  transform: translateX(2px);
}

[data-theme="light"] .nav-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.nav-item:hover i {
  color: var(--primary);
}

.nav-item.active {
  background: rgba(225, 29, 72, 0.15);
  color: #fda4af;
  border-left: 3px solid var(--primary);
  font-weight: 700;
}

[data-theme="light"] .nav-item.active {
  background: #fff1f2;
  color: #be123c;
  border-left: 3px solid var(--primary);
}

.nav-item.active i {
  color: var(--primary);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.25);
}

[data-theme="light"] .sidebar-footer {
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--primary-gradient);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.825rem;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

[data-theme="light"] .user-name {
  color: #0f172a;
}

.user-role-tag {
  font-size: 0.675rem;
  color: #fda4af;
  font-family: var(--font-mono);
}

[data-theme="light"] .user-role-tag {
  color: var(--primary);
}

.logout-btn {
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  color: var(--danger);
  background: rgba(225, 29, 72, 0.15);
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* ===================================================================
   MAIN CONTENT AREA & TOP HEADER
================================================================== */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100%;
}

.top-header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  padding: 10px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition: background-color var(--transition-normal);
  gap: 12px;
}

.mobile-menu-toggle-btn {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-dark);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.mobile-menu-toggle-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.header-search {
  position: relative;
  width: 320px;
}

.header-search i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.header-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-dark);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition-fast);
}

.header-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-clock-badge {
  background: var(--bg-subtle);
  color: var(--primary);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.775rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===================================================================
   PAGE CONTENT & METRICS
=================================================================== */
.content-body {
  padding: 28px;
  flex: 1;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.5px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 2px;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--card-gradient);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  backface-visibility: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary-gradient);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.metric-card:hover {
  transform: translate3d(0, -3px, 0);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-label {
  font-size: 0.775rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-dark);
  font-family: var(--font-heading);
  line-height: 1.2;
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 6px;
}

.metric-trend.positive { color: var(--success); }
.metric-trend.negative { color: var(--danger); }
.metric-trend.neutral  { color: var(--info); }

.metric-icon-box {
  width: 50px;
  height: 50px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.metric-icon-box.rose    { background: var(--primary-light); color: var(--primary); border: 1px solid var(--border-color); }
.metric-icon-box.dark    { background: var(--secondary); color: #fda4af; }
.metric-icon-box.emerald { background: var(--success-light); color: var(--success); border: 1px solid #a7f3d0; }
.metric-icon-box.amber   { background: var(--accent-light); color: var(--accent); border: 1px solid #fde68a; }
.metric-icon-box.cyan    { background: var(--info-light); color: var(--info); border: 1px solid #bae6fd; }

/* Dashboard Grids */
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.dashboard-grid-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 28px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition-fast), background-color var(--transition-normal);
}

.panel-card:hover {
  box-shadow: var(--shadow-md);
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-subtle);
}

.panel-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-body {
  padding: 24px;
}

/* Custom Data Tables */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.custom-table th {
  background: var(--table-th-bg);
  color: var(--table-th-color);
  font-weight: 700;
  font-size: 0.775rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.custom-table td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
  white-space: nowrap;
}

.custom-table td.font-bold {
  font-family: var(--font-mono);
  letter-spacing: -0.2px;
}

.custom-table tbody tr:hover {
  background-color: var(--table-hover-bg);
}

/* Kanban Board */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  align-items: start;
}

.kanban-column {
  background: var(--kanban-col-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 480px;
}

.kanban-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.kanban-col-title {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.task-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.task-tag.dev     { background: var(--primary-light); color: var(--primary); }
.task-tag.design  { background: #fdf2f8; color: #db2777; }
.task-tag.cloud   { background: #f0fdf4; color: #16a34a; }
.task-tag.seo     { background: #fffbeb; color: #d97706; }

.task-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
  line-height: 1.4;
}

.task-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  margin-top: 10px;
}

.task-assignee {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Punch Card Clock Widget for Employee */
.punch-card-widget {
  background: linear-gradient(135deg, #090d16 0%, #1e1b4b 60%, #881337 100%);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 15px 30px rgba(136, 19, 55, 0.3);
  margin-bottom: 26px;
  border: 1px solid rgba(225, 29, 72, 0.3);
}

[data-theme="light"] .punch-card-widget {
  background: linear-gradient(135deg, #ffffff 0%, #fff1f2 60%, #ffe4e6 100%);
  color: #090e17;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 25px rgba(225, 29, 72, 0.08);
}

.punch-timer-display {
  font-size: 2.5rem;
  font-family: var(--font-mono), monospace;
  font-weight: 800;
  color: #fda4af;
  letter-spacing: 3px;
  text-shadow: 0 0 15px rgba(225, 29, 72, 0.6);
}

[data-theme="light"] .punch-timer-display {
  color: #e11d48;
  text-shadow: none;
}

/* Invoice Printable Layout */
.invoice-container {
  padding: 30px;
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

/* ===================================================================
   NATIVE MOBILE BOTTOM APP DOCK (Phones & Tablets)
=================================================================== */
.mobile-bottom-dock {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: var(--bg-header);
  border-top: 1px solid var(--border-color);
  z-index: 900;
  backdrop-filter: blur(20px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  justify-content: space-around;
  align-items: center;
  padding: 0 8px;
}

.dock-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.dock-item i {
  font-size: 1.15rem;
}

.dock-item.active, .dock-item:hover {
  color: var(--primary);
}

/* ===================================================================
   RESPONSIVE BREAKPOINTS (14-inch Laptops, Tablets, & Mobile)
   =================================================================== */
@media (min-width: 993px) and (max-width: 1400px) {
  .sidebar {
    width: 220px;
  }
  .sidebar-header {
    padding: 18px 14px;
  }
  .sidebar-brand-name {
    font-size: 1rem;
  }
  .nav-item {
    padding: 8px 10px;
    font-size: 0.8125rem;
  }
  .content-body {
    padding: 18px;
  }
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
  }
  .metric-card {
    padding: 16px;
  }
  .metric-value {
    font-size: 1.45rem;
  }
  .dashboard-grid-2, .dashboard-grid-equal {
    gap: 16px;
  }
  .panel-body {
    padding: 16px;
  }
}

@media (max-width: 1024px) {
  .dashboard-grid-2 {
    grid-template-columns: 1fr;
  }
  .dashboard-grid-equal {
    grid-template-columns: 1fr;
  }
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 992px) {
  /* Sidebar becomes Off-Canvas Mobile Drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    z-index: 99999;
    transform: translateX(-100%);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.7);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-close-btn {
    display: flex;
  }

  .mobile-menu-toggle-btn {
    display: flex;
  }

  .header-search {
    display: none;
  }

  .mobile-bottom-dock {
    display: flex;
  }

  .content-body {
    padding: 20px 16px 85px; /* Extra padding bottom for dock */
  }

  /* Role quick bar smooth horizontal swipe */
  .role-quick-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    padding: 8px 14px;
  }
  .role-quick-bar .role-chips {
    flex-wrap: nowrap;
  }
}

@media (max-width: 768px) {
  .top-header {
    top: 0 !important;
    padding: 8px 12px;
    height: 52px;
  }
  .live-clock-badge {
    display: none !important;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-title {
    font-size: 1.45rem;
  }
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .metric-card {
    padding: 16px;
  }
  .metric-value {
    font-size: 1.35rem;
  }
  .metric-icon-box {
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
  }
  .kanban-board {
    grid-template-columns: 1fr;
  }
  .punch-card-widget {
    flex-direction: column;
    gap: 16px;
    text-align: center;
    padding: 20px;
  }
  .punch-timer-display {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
  .content-body {
    padding: 16px 12px 85px;
  }
  .top-header {
    padding: 8px 12px;
  }
}
