/* ================================================================
   Client Portal — Frontend Dashboard CSS  v2
   Minimal, kart tabanlı, responsive. İnline style yok.
   ================================================================ */

/* ── Reset & base ─────────────────────────────────────────────── */
.cp-wrap *,
.cp-wrap *::before,
.cp-wrap *::after { box-sizing: border-box; margin: 0; padding: 0; }

.cp-wrap {
  display: flex;
  gap: 24px;
  max-width: 1160px;
  margin: 32px auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #1e293b;
  align-items: flex-start;
}

/* ── Sidebar ──────────────────────────────────────────────────── */
.cp-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px 14px;
  position: sticky;
  top: 24px;
  box-shadow: 0 1px 8px rgba(0,0,0,.05);
}

.cp-sidebar__avatar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}
.cp-avatar { border-radius: 50%; flex-shrink: 0; }

.cp-sidebar__info strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
  word-break: break-word;
}
.cp-sidebar__info span {
  font-size: 11px;
  color: #94a3b8;
  word-break: break-all;
}

/* ── Nav ──────────────────────────────────────────────────────── */
.cp-nav { display: flex; flex-direction: column; gap: 2px; }

.cp-nav__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 10px;
  color: #64748b;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
}
.cp-nav__item:hover { background: #f8fafc; color: #0f172a; }
.cp-nav__item--active { background: #ff6b35; color: #fff !important; }

.cp-nav__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #ff6b35;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
}
.cp-nav__item--active .cp-nav__badge { background: rgba(255,255,255,.25); color: #fff; }

/* ── Main area ────────────────────────────────────────────────── */
.cp-main { flex: 1; min-width: 0; }

/* ── Page header ──────────────────────────────────────────────── */
.cp-page-header { margin-bottom: 20px; }
.cp-page-title { font-size: 20px; font-weight: 700; color: #0f172a; margin-bottom: 4px; }
.cp-page-sub { color: #64748b; font-size: 13px; }

/* ── 4'lü İstatistik Kartları ─────────────────────────────────── */
.cp-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.cp-stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.cp-stat-card--alert { border-color: #fca5a5; background: #fff7f7; }

.cp-stat-number {
  font-size: 28px;
  font-weight: 700;
  color: #ff6b35;
  line-height: 1;
}
.cp-stat-card--alert .cp-stat-number { color: #ef4444; }

.cp-stat-label { font-size: 12px; color: #64748b; font-weight: 500; }

/* ── İki kolon düzen ──────────────────────────────────────────── */
.cp-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* ── Kart ─────────────────────────────────────────────────────── */
.cp-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,.04);
}
.cp-card:last-child { margin-bottom: 0; }

.cp-card__head {
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}
.cp-section-title { font-size: 14px; font-weight: 600; color: #0f172a; }

/* ── Son Dokümanlar Listesi ───────────────────────────────────── */
.cp-doc-list { list-style: none; }

.cp-doc-list__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f8fafc;
}
.cp-doc-list__item:last-child { border-bottom: none; }
.cp-doc-icon { font-size: 18px; flex-shrink: 0; }

.cp-doc-info { flex: 1; min-width: 0; }
.cp-doc-name { display: block; font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-doc-meta { display: block; font-size: 11px; color: #94a3b8; margin-top: 2px; }

/* ── Aktivite Listesi ─────────────────────────────────────────── */
.cp-activity-list { list-style: none; }

.cp-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f8fafc;
}
.cp-activity-item:last-child { border-bottom: none; }

.cp-activity-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.cp-activity-body { flex: 1; min-width: 0; }
.cp-activity-label { display: block; font-size: 13px; font-weight: 500; color: #1e293b; }
.cp-activity-desc { display: block; font-size: 11px; color: #64748b; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-activity-time { font-size: 11px; color: #94a3b8; white-space: nowrap; flex-shrink: 0; }

/* ── Hizmet Kartları ──────────────────────────────────────────── */
.cp-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.cp-service-card { margin-bottom: 0; }

.cp-service-card__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 10px;
}
.cp-service-name { font-size: 15px; font-weight: 600; color: #0f172a; }

.cp-badges { display: flex; gap: 5px; flex-wrap: wrap; }

.cp-service-desc { font-size: 13px; color: #64748b; line-height: 1.5; margin-bottom: 12px; }

/* Hizmet meta grid */
.cp-service-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
  margin-bottom: 12px;
}
.cp-service-meta-grid dt { color: #94a3b8; font-weight: 500; }
.cp-service-meta-grid dd { color: #1e293b; font-weight: 600; }

/* Hizmet dosyalar details */
.cp-service-files {
  margin-top: 10px;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
  font-size: 13px;
}
.cp-service-files summary {
  cursor: pointer;
  color: #64748b;
  font-size: 12px;
  list-style: none;
}
.cp-service-files summary::-webkit-details-marker { display: none; }
.cp-service-files ul { list-style: none; margin-top: 8px; }
.cp-service-files li { margin-bottom: 4px; }
.cp-file-link { color: #ff6b35; text-decoration: none; font-size: 12px; }
.cp-file-link:hover { text-decoration: underline; }

/* ── Tablo ────────────────────────────────────────────────────── */
.cp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cp-table th {
  text-align: left;
  padding: 9px 12px;
  font-weight: 600;
  color: #64748b;
  border-bottom: 2px solid #f1f5f9;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.cp-table td { padding: 10px 12px; border-bottom: 1px solid #f8fafc; vertical-align: middle; }
.cp-table tbody tr:hover { background: #fafafa; }

/* ── Badge'ler ────────────────────────────────────────────────── */
.cp-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.cp-badge--pending    { background: #fef9c3; color: #854d0e; }
.cp-badge--progress   { background: #dbeafe; color: #1d4ed8; }
.cp-badge--done       { background: #dcfce7; color: #166534; }
.cp-badge--unpaid     { background: #fee2e2; color: #991b1b; }
.cp-badge--paid       { background: #dcfce7; color: #166534; }
.cp-badge--refunded   { background: #ede9fe; color: #5b21b6; }
.cp-badge--admin      { background: #f1f5f9; color: #475569; }
.cp-badge--client     { background: #fff7ed; color: #c2410c; }

/* ── Butonlar ─────────────────────────────────────────────────── */
.cp-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity .15s, background .15s;
  background: #f1f5f9;
  color: #334155;
  white-space: nowrap;
}
.cp-btn:hover { opacity: .82; }
.cp-btn--primary { background: #ff6b35; color: #fff; }
.cp-btn--sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

/* ── Upload formu ─────────────────────────────────────────────── */
.cp-upload-form { display: flex; flex-direction: column; gap: 12px; }
.cp-form-row { display: flex; flex-direction: column; gap: 5px; }
.cp-form-row label { font-size: 12px; font-weight: 500; color: #475569; }
.cp-form-row input[type="text"],
.cp-form-row input[type="file"],
.cp-form-row textarea {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  width: 100%;
  outline: none;
  transition: border .15s;
  font-family: inherit;
}
.cp-form-row input:focus, .cp-form-row textarea:focus { border-color: #ff6b35; }

/* ── Mesajlaşma ───────────────────────────────────────────────── */
.cp-msg-card { padding: 0; overflow: hidden; }

.cp-msg-list {
  min-height: 200px;
  max-height: 480px;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.cp-msg-row { display: flex; flex-direction: column; max-width: 80%; }
.cp-msg-row--own { align-self: flex-end; align-items: flex-end; }
.cp-msg-row--other { align-self: flex-start; align-items: flex-start; }

.cp-msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-word;
}
.cp-msg-row--own .cp-msg-bubble {
  background: #ff6b35;
  color: #fff;
  border-bottom-right-radius: 4px;
}
.cp-msg-row--other .cp-msg-bubble {
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}

.cp-msg-text { margin: 0; }
.cp-msg-text p { margin: 0; }

.cp-msg-file {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: rgba(255,255,255,.85);
  text-decoration: none;
}
.cp-msg-row--other .cp-msg-file { color: #ff6b35; }
.cp-msg-file:hover { text-decoration: underline; }

.cp-msg-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: #94a3b8;
  margin-top: 3px;
}

.cp-msg-pagination {
  padding: 12px 20px;
  border-top: 1px solid #f1f5f9;
  text-align: center;
}

/* Mesaj compose */
.cp-msg-compose { display: flex; flex-direction: column; gap: 12px; }
.cp-msg-compose__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cp-msg-file-wrap { display: flex; align-items: center; gap: 8px; }

/* ── Notices ──────────────────────────────────────────────────── */
.cp-notice {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 12px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
.cp-notice--error { background: #fee2e2 !important; color: #991b1b !important; border-color: #fecaca !important; }

/* ── Yardımcılar ─────────────────────────────────────────────── */
.cp-empty { text-align: center; color: #94a3b8; padding: 24px 0; font-size: 13px; }
.cp-empty--msg { padding: 40px 0; }
.cp-muted { color: #94a3b8; font-size: 11px; }
.cp-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* ── Responsive ──────────────────────────────────────────────── */
@media ( max-width: 900px ) {
  .cp-wrap { flex-direction: column; margin: 16px; gap: 14px; }
  .cp-sidebar { width: 100%; position: static; }
  .cp-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .cp-two-col { grid-template-columns: 1fr; }
  .cp-cards-grid { grid-template-columns: 1fr; }
}

@media ( max-width: 520px ) {
  .cp-stats-grid { grid-template-columns: 1fr 1fr; }
  .cp-table { font-size: 12px; }
  .cp-table th, .cp-table td { padding: 8px; }
  .cp-msg-row { max-width: 95%; }
}
