/* ==========================================================================
   BeSpokeHQ - Dashboard Styles (Strict Role Dashboards: Admin, Talent, Client)
   ========================================================================== */

.dashboard-layout {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg-primary);
}

/* --- Sidebar --- */
.dashboard-sidebar {
  width: 280px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 50;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 1.75rem 1.5rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-brand .brand-logo-img,
.sidebar-brand img {
  width: 36px !important;
  height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border-gold);
  box-shadow: 0 2px 8px rgba(26, 18, 12, 0.16);
  flex-shrink: 0 !important;
  display: inline-block;
  vertical-align: middle;
}

.sidebar-role-indicator {
  margin-top: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
}

.indicator-admin {
  background-color: var(--accent-gold-soft);
  color: var(--accent-gold);
  border: 1px solid var(--accent-gold-border);
}

.indicator-talent {
  background-color: var(--accent-sage-soft);
  color: var(--accent-sage);
  border: 1px solid rgba(74, 88, 68, 0.2);
}

.indicator-client {
  background-color: #E8EDF5;
  color: #2F455C;
  border: 1px solid rgba(47, 69, 92, 0.2);
}

.sidebar-nav {
  padding: 1.5rem 1rem;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 0 0.75rem;
  margin-bottom: 0.6rem;
  font-weight: 700;
}

.sidebar-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1.75rem;
}

.sidebar-menu-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-smooth);
}

.sidebar-menu-btn:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.sidebar-menu-btn.active {
  background-color: var(--text-primary);
  color: var(--bg-primary);
  font-weight: 600;
}

.sidebar-menu-btn .nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.sidebar-menu-btn.active .nav-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #FFF;
}

.sidebar-user {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-medium);
}

.sidebar-user-info {
  flex-grow: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 0.74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  transition: var(--transition-smooth);
}

.btn-logout:hover {
  color: #A63A3A;
  background: rgba(166, 58, 58, 0.08);
}

/* --- Main Content Area --- */
.dashboard-main {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.dashboard-topbar {
  height: 74px;
  padding: 0 2.5rem;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-title {
  font-size: 1.45rem;
  margin: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dashboard-content {
  padding: 2.25rem 2.5rem;
  flex-grow: 1;
  min-height: 0;
  overflow-y: auto;
}

.dashboard-content.chat-view-active {
  padding: 1.25rem 2rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: calc(100vh - 74px);
}

/* --- Metrics Widgets --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.metric-value {
  font-family: var(--font-editorial);
  font-size: 2.3rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.metric-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Tabs & Filter Bars --- */
.filter-tabs-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.filter-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-smooth);
}

.filter-pill:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.filter-pill.active {
  background: var(--text-primary);
  color: var(--bg-primary);
  border-color: var(--text-primary);
  font-weight: 600;
}

/* --- Admin Talent Table --- */
.talent-admin-table-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow-x: auto;
}

.talent-admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.talent-admin-table th {
  padding: 1rem 1.25rem;
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
}

.talent-admin-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.88rem;
  vertical-align: middle;
}

.talent-admin-cell-name {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.talent-admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.role-select-dropdown {
  padding: 0.35rem 0.65rem;
  font-size: 0.82rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

/* --- Portfolio Showcase (Talent Dashboard) --- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.portfolio-item-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.portfolio-img-box {
  height: 180px;
  overflow: hidden;
  background: #EAE6DF;
}

.portfolio-img-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.portfolio-card-info {
  padding: 1.25rem;
}

.portfolio-card-title {
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.portfolio-card-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* --- Appointments Cards --- */
.appointment-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.appointment-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
}

.apt-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.apt-client-name {
  font-size: 1.25rem;
  margin-bottom: 0.2rem;
}

.apt-service-tag {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-gold);
}

.apt-date-badge {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
}

.apt-notes-box {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  background: var(--bg-primary);
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

/* --- Reusable Responsive Grid Utilities --- */
.dashboard-two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.avatar-customizer-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
  padding: 1.25rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.avatar-preview-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  flex-shrink: 0;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent-gold);
  box-shadow: var(--shadow-subtle);
}

.avatar-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.avatar-preview-wrap:hover img {
  filter: brightness(0.75);
  transform: scale(1.05);
}

.avatar-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(7, 7, 9, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  opacity: 0;
  transition: opacity 0.2s ease;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  gap: 2px;
  pointer-events: none;
}

.avatar-preview-wrap:hover .avatar-preview-overlay {
  opacity: 1;
}

.avatar-upload-btn-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
  margin-bottom: 0.6rem;
}

.avatar-upload-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  background: var(--bg-surface);
  border: 1px solid var(--border-gold);
  color: var(--text-primary);
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.avatar-upload-label:hover {
  background: var(--accent-gold-soft);
  border-color: var(--accent-gold);
  color: var(--accent-gold-dark);
}

.avatar-upload-feedback {
  font-size: 0.76rem;
  color: var(--text-muted);
}


.mobile-menu-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.35rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.35rem;
  border-radius: var(--radius-sm);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 18, 12, 0.6);
  backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

/* --- Responsive Layout (Tablets & Mobile <= 850px) --- */
@media (max-width: 850px) {
  .dashboard-layout {
    position: relative;
    overflow-x: hidden;
    max-width: 100vw;
  }

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

  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Off-canvas mobile drawer with complete information */
  .dashboard-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    max-width: 85vw;
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    overflow-y: auto;
  }

  .dashboard-layout.sidebar-open .dashboard-sidebar {
    transform: translateX(0);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
  }

  .sidebar-backdrop {
    display: block;
  }

  .dashboard-layout.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  /* Keep all labels & text visible inside the drawer on mobile */
  .dashboard-sidebar .brand-text,
  .dashboard-sidebar .sidebar-role-indicator,
  .dashboard-sidebar .nav-section-title,
  .dashboard-sidebar .sidebar-menu-btn span:not(.ph),
  .dashboard-sidebar .sidebar-user-info,
  .dashboard-sidebar .nav-badge {
    display: block !important;
  }

  .dashboard-sidebar .sidebar-menu-btn {
    justify-content: flex-start !important;
    padding: 0.75rem 0.85rem !important;
  }

  .dashboard-sidebar .sidebar-socials {
    flex-direction: row !important;
    justify-content: space-around !important;
  }

  /* Main Workspace occupies full 100% width on mobile */
  .dashboard-main {
    width: 100% !important;
    min-width: 0 !important;
  }

  .dashboard-topbar {
    height: 62px;
    padding: 0 1rem;
  }

  .topbar-left {
    gap: 0.65rem;
    min-width: 0;
    flex-grow: 1;
  }

  .topbar-title {
    font-size: 1.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .dashboard-content {
    padding: 1.25rem 1rem;
  }

  .dashboard-content.chat-view-active {
    height: calc(100vh - 62px);
    padding: 0.5rem;
  }

  .dashboard-two-col-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  .clean-sheet-wrapper {
    padding: 1.25rem 1rem !important;
  }

  .clean-sheet-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1rem;
  }

  .clean-sheet-toolbar > div {
    max-width: 100% !important;
  }

  .metrics-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 1.75rem;
  }

  .metric-card {
    padding: 1rem;
  }

  .metric-value {
    font-size: 1.6rem;
  }

  .appointment-cards-grid {
    grid-template-columns: 1fr;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .filter-tabs-bar {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
    padding-bottom: 0.4rem;
  }

  .filter-tabs-bar::-webkit-scrollbar {
    display: none;
  }

  .filter-tabs-bar .filter-pill {
    white-space: nowrap;
    flex-shrink: 0;
  }

  .talent-admin-table-wrap,
  .clean-sheet-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .form-input, .form-select, .form-textarea {
    font-size: 16px !important;
  }
}

@media (max-width: 540px) {
  .avatar-customizer-row {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center;
    gap: 1rem !important;
    padding: 1rem !important;
  }

  .avatar-customizer-row > div {
    width: 100%;
  }

  .avatar-customizer-row .form-label {
    text-align: left;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-content {
    padding: 1rem 0.75rem;
  }
}
