/* ============================================================
   Design Portal – Main Stylesheet
   Bootstrap 5 companion styles for admin panel + client view
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────── */
:root {
  --sidebar-width: 260px;
  --sidebar-bg: #1e293b;
  --sidebar-text: rgba(255, 255, 255, 0.85);
  --sidebar-hover-bg: rgba(255, 255, 255, 0.08);
  --sidebar-active-bg: rgba(99, 102, 241, 0.25);
  --sidebar-active-text: #818cf8;
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-green: #22c55e;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --body-bg: #f8fafc;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
  --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ── Admin Layout ──────────────────────────────────────── */
.admin-body {
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
  background: var(--body-bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.sidebar-brand-text {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  list-style: none;
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1.25rem;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.18s, color 0.18s;
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}

.sidebar-link:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.sidebar-link i {
  font-size: 1.05rem;
  width: 1.2rem;
  flex-shrink: 0;
}

.sidebar-section-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
  padding: 0.75rem 1.25rem 0.25rem;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-indigo);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-username {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Main Content ──────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--body-bg);
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Topbar ────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-badge {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* Sidebar toggle button (mobile) */
.sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: #475569;
  cursor: pointer;
  padding: 0.25rem;
}

/* ── Stat Cards ────────────────────────────────────────── */
.stat-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-left: 5px solid transparent;
  transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.stat-card.stat-total     { border-left-color: var(--accent-blue); }
.stat-card.stat-ongoing   { border-left-color: var(--accent-indigo); }
.stat-card.stat-completed { border-left-color: var(--accent-green); }
.stat-card.stat-pending   { border-left-color: var(--accent-amber); }

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-total   .stat-icon { background: #eff6ff; color: var(--accent-blue); }
.stat-ongoing .stat-icon { background: #eef2ff; color: var(--accent-indigo); }
.stat-completed .stat-icon { background: #f0fdf4; color: var(--accent-green); }
.stat-pending .stat-icon { background: #fffbeb; color: var(--accent-amber); }

.stat-number {
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  color: #1e293b;
}

.stat-label {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 0.2rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Status Badges ─────────────────────────────────────── */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28em 0.75em;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 20px;
}

.badge-status-pending {
  background: #fef3c7;
  color: #92400e;
}

.badge-status-ongoing {
  background: #dbeafe;
  color: #1e40af;
}

.badge-status-completed {
  background: #dcfce7;
  color: #166534;
}

/* ── Table ─────────────────────────────────────────────── */
.table-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
}

.table-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sortable:hover {
  background: #f8fafc;
}

.sort-icon {
  font-size: 0.7rem;
  opacity: 0.4;
  margin-left: 0.25rem;
  vertical-align: middle;
}

.sort-icon.active {
  opacity: 1;
  color: var(--accent-indigo);
}

/* Row with less than 3 remaining days (non-completed) */
.row-urgent {
  background-color: #fff1f2 !important;
}

.row-urgent:hover {
  background-color: #ffe4e6 !important;
}

.days-urgent {
  color: var(--accent-red);
  font-weight: 700;
}

.days-overdue {
  color: #9f1239;
  font-weight: 700;
}

/* ── Pagination ────────────────────────────────────────── */
.pagination-info {
  font-size: 0.82rem;
  color: #64748b;
}

/* ── Sidebar collapsed (mobile overlay) ───────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1039;
}

/* ── Login Page ────────────────────────────────────────── */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 1rem;
}

/* ── Toast Container ───────────────────────────────────── */
#toastContainer {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Modal enhancements ────────────────────────────────── */
.modal-header {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.designer-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.designer-row .form-control {
  flex: 1;
}

/* ── Content padding ───────────────────────────────────── */
.content-area {
  padding: 1.5rem;
  flex: 1;
}

/* ── Client View ───────────────────────────────────────── */
.client-header {
  background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #1e40af 100%);
  color: #fff;
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
}

.client-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.4rem;
  letter-spacing: -0.02em;
}

.client-header p {
  opacity: 0.75;
  font-size: 1rem;
  margin: 0;
}

.client-navbar {
  background: #1e293b;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.client-navbar-brand {
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
}

.client-table-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.client-table-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .sidebar-overlay.visible {
    display: block;
  }

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-number {
    font-size: 1.5rem;
  }

  .topbar {
    padding: 0.6rem 1rem;
  }

  .content-area {
    padding: 1rem;
  }

  .table-responsive {
    font-size: 0.85rem;
  }
}

@media (max-width: 480px) {
  .client-header h1 {
    font-size: 1.6rem;
  }
}
