/* ============================================================
   dashboard.css — Freelancer Dashboard  |  Blue × Indigo
   ============================================================ */

body { overflow-x: hidden; }

/* ── Layout ── */
.dash-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 66px);
}

/* ── Sidebar ── */
.dash-sidebar {
  border-radius: 0 !important;
  border-right: 1px solid var(--border) !important;
  border-top: none !important;
  border-left: none !important;
  border-bottom: none !important;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 66px;
  height: calc(100vh - 66px);
  overflow-y: auto;
  transition: background 0.3s ease;
}

/* Sidebar user */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.sidebar-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue-h), var(--indigo-h));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 900;
  font-size: 1rem;
  flex: 0 0 auto;
}

.sidebar-name { font-weight: 800; font-size: 0.9rem; color: var(--text); }
.sidebar-role { font-size: 0.72rem; color: var(--blue); font-weight: 600; }

/* Sidebar nav */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}

.sidebar-link:hover {
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.sidebar-link.active {
  background: var(--blue-dim);
  color: var(--blue);
  border: 1px solid var(--blue-border);
}

.sidebar-icon { font-size: 1rem; flex: 0 0 auto; }

.sidebar-badge {
  margin-left: auto;
  background: var(--blue);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 900;
  padding: 2px 7px;
  border-radius: 999px;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

/* ── Main ── */
.dash-main {
  padding: 32px 28px 60px;
  min-width: 0;
  background: var(--bg);
  transition: background 0.3s ease;
}

/* Header */
.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.dash-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.dash-sub { margin: 0; }

/* ── Stats cards ── */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--border) !important;
  transition: background 0.3s ease;
}

.stat-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 1.2rem;
  flex: 0 0 auto;
}

.stat-card-info { flex: 1; min-width: 0; }

.stat-card-val {
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-card-lbl {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.stat-card-trend {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.stat-card-trend.positive {
  color: #22c55e;
  background: rgba(34,197,94,.12);
}

/* ── Dash cards ── */
.dash-card {
  padding: 22px;
  border: 1px solid var(--border) !important;
  margin-bottom: 20px;
  transition: background 0.3s ease;
}

.dash-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.dash-card-title {
  font-size: 1rem;
  font-weight: 900;
  color: var(--text);
  margin: 0;
}

.dash-view-all {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--blue);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
  text-decoration: none;
}

.dash-view-all:hover { background: var(--blue-dim); }

/* ── Orders ── */
.orders-list { display: flex; flex-direction: column; gap: 10px; }

.order-row {
  display: grid;
  grid-template-columns: 90px 1fr 100px 60px 100px 80px;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  transition: border-color 0.2s, background 0.3s ease;
}

.order-row:hover { border-color: var(--border-2); }

.order-row-gig { font-weight: 700; color: var(--text); }

.order-status-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Order filters */
.order-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.order-filter {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.order-filter:hover  { border-color: var(--border-2); color: var(--text); }
.order-filter.active { background: var(--blue-dim); border-color: var(--blue-border); color: var(--blue); }

/* ── Gigs grid ── */
.dash-gigs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.dash-gig-card {
  border: 1px solid var(--border) !important;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.3s ease;
}

.dash-gig-card:hover {
  border-color: var(--blue-border) !important;
  box-shadow: var(--shadow-blue) !important;
}

.dash-gig-img {
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-3);
  position: relative;
}

.dash-gig-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

.dash-gig-status-dot {
  position: absolute;
  bottom: 8px; left: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: #22c55e;
  background: rgba(0,0,0,.6);
  padding: 3px 9px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.dash-gig-body { padding: 14px; }

.dash-gig-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dash-gig-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.dash-gig-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.dash-gig-price { font-size: 0.85rem; color: var(--text-2); }

.dash-gig-actions { display: flex; gap: 6px; }

.dash-action-btn {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.dash-action-btn:hover {
  background: var(--blue-dim);
  border-color: var(--blue-border);
  color: var(--blue);
  text-decoration: none;
}

/* ── New gig form ── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.checkout-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0; }

.checkout-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.checkout-input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  padding: 11px 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}

.checkout-input:focus {
  border-color: var(--blue-border);
  box-shadow: 0 0 0 3px var(--blue-dim);
}

.checkout-textarea { resize: vertical; min-height: 100px; }

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.dash-cancel-btn {
  background: none;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.dash-cancel-btn:hover { background: var(--surface); color: var(--text); }

.dash-msg {
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 12px;
}

.dash-msg--success { background: var(--blue-dim);  border: 1px solid var(--blue-border);  color: var(--blue); }
.dash-msg--error   { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #f87171; }
.dash-msg--warning { background: var(--gold-dim);  border: 1px solid var(--gold-border);  color: var(--gold); }

/* ── Earnings ── */
.earnings-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.earnings-card {
  padding: 22px;
  border: 1px solid var(--border) !important;
  transition: background 0.3s ease;
}

.earnings-label { font-size: 0.8rem; margin-bottom: 8px; }

.earnings-val {
  font-size: 2rem;
  font-weight: 900;
  color: var(--blue);
  letter-spacing: -0.02em;
}

.earnings-table { display: flex; flex-direction: column; gap: 0; }

.earnings-row {
  display: grid;
  grid-template-columns: 90px 1fr 100px 80px;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  align-items: center;
}

.earnings-row:last-child { border-bottom: none; }

/* Nav extras */
.btn-ghost-nav {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.87rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-ghost-nav:hover { background: var(--surface); color: var(--text); }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .order-row  { grid-template-columns: 80px 1fr 80px 50px 90px; }
  .order-row .order-row-date { display: none; }
}

@media (max-width: 860px) {
  .dash-layout { grid-template-columns: 1fr; }
  .dash-sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
  }
  .sidebar-user    { display: none; }
  .sidebar-nav     { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .sidebar-footer  { flex-direction: row; padding-top: 0; border-top: none; margin-top: 0; padding-left: 8px; border-left: 1px solid var(--border); }
  .earnings-cards  { grid-template-columns: 1fr; }
  .form-grid       { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .dash-stats      { grid-template-columns: 1fr 1fr; }
  .dash-main       { padding: 20px 16px 40px; }
  .order-row       { grid-template-columns: 1fr 60px 90px; }
  .order-row-id, .order-row-buyer, .order-row-date { display: none; }
}