:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e5e7eb;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --danger: #dc2626;
  --danger-bg: #fee2e2;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --info-bg: #dbeafe;
  --info-text: #1e40af;
  --sidebar-bg: var(--surface);
  --sidebar-text: var(--text-muted);
  --sidebar-border: var(--border);
  --radius: 12px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 12px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Simple (public / user) topbar layout ---------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand .brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--primary);
  display: inline-block;
}

nav.user-nav a {
  margin-left: 18px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

nav.user-nav a:hover { color: var(--primary); }
nav.user-nav a.active { color: var(--primary-dark); }

.nav-profile-menu {
  position: relative;
  display: inline-block;
  margin-left: 18px;
}

.nav-profile-menu summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 600;
  list-style: none;
}

.nav-profile-menu summary::-webkit-details-marker { display: none; }
.nav-profile-menu summary::after { content: " \25BE"; font-size: 0.75em; }
.nav-profile-menu summary:hover { color: var(--primary); }
.nav-profile-menu summary.active { color: var(--primary-dark); }
.nav-profile-menu[open] summary { color: var(--primary-dark); }

.nav-profile-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  padding: 6px;
  z-index: 50;
}

.nav-profile-dropdown-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
}

.nav-profile-dropdown-head strong {
  font-size: 0.92rem;
  color: var(--text);
}

.nav-profile-dropdown-head span {
  font-size: 0.78rem;
  color: var(--text-muted);
  word-break: break-all;
}

.nav-profile-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

.nav-profile-dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 0;
  padding: 9px 12px;
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.nav-profile-dropdown a svg { flex-shrink: 0; opacity: 0.8; }
.nav-profile-dropdown a:hover { background: var(--surface-muted); color: var(--text); }
.nav-profile-dropdown a.logout-link { color: var(--danger); }
.nav-profile-dropdown a.logout-link:hover { background: var(--danger-bg); }

.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--success);
  background: var(--success-bg);
  padding: 6px 12px;
  border-radius: 999px;
  margin-left: 18px;
}

.coin-anim {
  display: inline-block;
  font-size: 1rem;
  animation: coin-bounce 1.6s ease-in-out infinite;
}

@keyframes coin-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-3px) rotate(-8deg); }
  50% { transform: translateY(0) rotate(0deg); }
  75% { transform: translateY(-2px) rotate(8deg); }
}

@media (prefers-reduced-motion: reduce) {
  .coin-anim { animation: none; }
}

.page-main { padding: 32px 20px 60px; }

/* ---------- Admin shell: sidebar + content ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  padding: 8px 10px 22px;
  text-decoration: none;
}

.sidebar-brand .brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: var(--primary);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.sidebar-nav a svg { flex-shrink: 0; opacity: 0.85; }

.sidebar-nav a:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.sidebar-nav a.active {
  background: var(--primary);
  color: #fff;
}

.sidebar-foot {
  border-top: 1px solid var(--sidebar-border);
  padding-top: 12px;
  margin-top: 12px;
}

.sidebar-foot a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.sidebar-foot a:hover { background: var(--danger-bg); color: var(--danger); }

.app-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.content-topbar .who {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.content-topbar .who strong { color: var(--text); }

.content-main {
  padding: 28px;
  max-width: 1600px;
  width: 100%;
}

/* Form içeren kartların çok geniş ekranlarda aşırı uzamasını önle */
.card.form-card {
  max-width: 720px;
}

/* ---------- Typography ---------- */

h1 {
  font-size: 1.55rem;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 28px 0 12px;
  letter-spacing: -0.01em;
}

.page-sub {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 20px;
}

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}

.card + .card { margin-top: 0; }

.task-desc { white-space: pre-wrap; margin: 10px 0; }

.task-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.fee {
  color: var(--primary-dark);
  font-weight: 700;
  background: var(--primary-light);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
}

/* ---------- Task offer header/fee (reused on list tiles + detail page) ---------- */

.task-offer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.task-offer-fee {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.task-offer-fee small {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-cta {
  background: var(--primary);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
  font-weight: 700;
}

.btn-cta:hover { background: var(--primary-dark); }

/* ---------- Task grid (görev listesi - index.php) ---------- */

.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.task-tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.task-tile::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #818cf8);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.task-tile:hover {
  box-shadow: 0 10px 26px rgba(79, 70, 229, 0.14);
  transform: translateY(-3px);
  border-color: #c7d2fe;
}

.task-tile:hover::before { opacity: 1; }

.task-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.task-tile-title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.task-tile-teaser {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-tile-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 14px;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--primary);
  transition: gap 0.15s ease;
}

.task-tile:hover .task-tile-cta { gap: 8px; }

/* ---------- Acil (urgent) görev vurgusu ---------- */

.task-tile-corner-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  background: radial-gradient(circle at 30% 30%, #fb923c, #dc2626 75%);
  animation: urgent-corner-pulse 1.8s ease-in-out infinite;
  z-index: 2;
}

.task-tile-urgent .task-tile-top {
  padding-right: 40px;
}

.task-tile-urgent {
  border-color: #fca5a5;
  animation: urgent-glow 1.8s ease-in-out infinite;
}

.task-tile-urgent::before {
  background: linear-gradient(90deg, #dc2626, #f97316);
  opacity: 1;
}

@keyframes urgent-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.25), 0 4px 14px rgba(220, 38, 38, 0.15); }
  50% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.18), 0 4px 22px rgba(220, 38, 38, 0.35); }
}

@keyframes urgent-corner-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18), 0 3px 10px rgba(220, 38, 38, 0.45); }
  50% { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0.28), 0 3px 16px rgba(220, 38, 38, 0.65); }
}

@media (prefers-reduced-motion: reduce) {
  .task-tile-urgent,
  .task-tile-corner-badge { animation: none; }
}

/* ---------- Task detail (task_detail.php) ---------- */

.task-detail-hero {
  padding: 26px 26px 24px;
  position: relative;
  overflow: hidden;
}

.task-detail-hero::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #818cf8);
}

.task-detail-hero h1 { margin: 4px 0 12px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.back-link:hover { color: var(--primary); }

/* ---------- Profile page helpers ---------- */

.section-subtitle {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 22px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.money-highlight { color: var(--primary-dark); font-size: 1.1rem; }

/* ---------- Submission review cards (admin/submissions.php) ---------- */

.submission-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.submission-task-link {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.submission-task-link:hover { color: var(--primary); }

.submission-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  color: var(--text-muted);
  font-size: 0.86rem;
  margin-bottom: 14px;
}

.submission-meta-item strong { color: var(--text); }
.submission-meta-item.fee { color: var(--primary-dark); font-weight: 700; }

.submission-quote {
  position: relative;
  background: var(--surface-muted);
  border-left: 3px solid var(--primary);
  border-radius: 0 9px 9px 0;
  padding: 12px 16px;
  margin: 0 0 14px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.95rem;
}

.submission-task-desc {
  margin-bottom: 4px;
}

.submission-task-desc summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.submission-task-desc .task-desc {
  margin-top: 8px;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.action-row form {
  flex: 1 1 140px;
}

.actions-cell details + details {
  margin-top: 8px;
}

/* ---------- Stat grid (dashboard) ---------- */

.stat-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  flex: 1 1 200px;
}

.stat-card .label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.stat-card .value.money { color: var(--primary-dark); }
.stat-card a.stat-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 9px;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn:hover { background: var(--primary-dark); }
.btn:active { transform: translateY(1px); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #64748b; }
.btn-secondary:hover { background: #475569; }
.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--surface-muted); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm {
  padding: 6px 14px;
  font-size: 0.82rem;
  min-width: 96px;
  justify-content: center;
}

form.inline { display: inline; }

/* ---------- Forms ---------- */

label { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 0.86rem; color: var(--text); }
label:first-child { margin-top: 0; }

input[type=text], input[type=email], input[type=password], textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 0.94rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

textarea { min-height: 90px; resize: vertical; }

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.form-field {
  flex: 1 1 220px;
  min-width: 0;
}

.form-field-auto {
  flex: 0 0 auto;
}

.form-field label:first-child { margin-top: 0; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-label input[type=checkbox] {
  width: auto;
  accent-color: var(--danger);
}

.urgent-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--surface-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.urgent-toggle:has(input:checked) {
  border: 1px solid #fca5a5;
  border-style: solid;
  background: var(--danger-bg);
}

.urgent-toggle input[type=checkbox] {
  width: auto;
  flex-shrink: 0;
  accent-color: var(--danger);
}

.urgent-toggle-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.urgent-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.urgent-toggle-text strong { font-size: 0.92rem; }
.urgent-toggle-text small { color: var(--text-muted); font-size: 0.8rem; }

.help-text { color: var(--text-muted); font-size: 0.84rem; margin-top: 5px; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr:hover { background: var(--surface-muted); }
tfoot td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: none; }

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.badge-pending { background: var(--warning-bg); color: var(--warning-text); }
.badge-approved { background: var(--success-bg); color: #166534; }
.badge-rejected { background: var(--danger-bg); color: #991b1b; }
.badge-paid { background: var(--info-bg); color: var(--info-text); }
.badge-active { background: var(--success-bg); color: #166534; }
.badge-passive { background: #f1f5f9; color: var(--text-muted); }
.badge-urgent { background: #dc2626; color: #fff; }

/* ---------- Flash ---------- */

.flash {
  padding: 12px 16px;
  border-radius: 9px;
  margin-bottom: 18px;
  font-size: 0.9rem;
  font-weight: 500;
}

.flash-info { background: var(--info-bg); color: var(--info-text); }
.flash-success { background: var(--success-bg); color: #166534; }
.flash-error { background: var(--danger-bg); color: #991b1b; }

/* ---------- Footer ---------- */

.footer {
  padding: 22px 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
}

/* ---------- Auth screen ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top left, #eef2ff 0%, #f5f6fa 45%);
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.08);
  padding: 36px 32px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.auth-brand .brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  background: var(--primary);
}

.auth-card h1 { margin-top: 18px; }

.credential-box {
  background: var(--surface-muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.9rem;
  margin: 10px 0 4px;
}

.credential-box div { margin-bottom: 4px; }
.credential-box strong { font-family: "Consolas", monospace; }

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 10px 12px;
  }
  .sidebar-brand { padding: 4px 10px; margin-right: 8px; }
  .sidebar-nav { flex-direction: row; }
  .sidebar-foot { border-top: none; border-left: 1px solid var(--sidebar-border); padding: 0 0 0 10px; margin: 0 0 0 10px; }
  .content-main { padding: 20px; }
  .content-topbar { padding: 14px 20px; }
}

/* Not: Panel bilinçli olarak her zaman açık (light) temada gösterilir; işletim
   sistemi/tarayıcı karanlık modda olsa bile otomatik koyulaşmaz. */
