/* ============ Tasarım Jetonları ============ */
:root {
  --navy-950: #0a1730;
  --navy-900: #0f2148;
  --navy-800: #16305f;
  --navy-700: #1d3f7a;
  --navy-600: #2a52a0;
  --navy-100: #e8edf9;

  --yellow-300: #ffe08a;
  --yellow-400: #ffd23f;
  --yellow-500: #ffc107;
  --yellow-600: #e6a800;

  --bg: #f2f4f9;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --border: #e6e9f2;
  --border-strong: #d3d9e6;

  --text: #10182c;
  --muted: #667085;
  --danger: #d92d20;
  --danger-bg: #fdeceb;
  --success: #0f9d58;
  --success-bg: #e7f7ee;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 44, 0.05);
  --shadow-md: 0 2px 8px rgba(16, 24, 44, 0.07);
  --shadow-lg: 0 16px 48px rgba(10, 23, 48, 0.18);

  --sidebar-w: 248px;
}

/* Montserrat - yerelden servis edilir (bkz. public/fonts). Degisken font,
   100-900 arasi tum agirliklari tek dosyadan karsilar. */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/public/fonts/Montserrat-Variable.ttf?v=1') format('truetype');
}

* { box-sizing: border-box; }

html, body { height: 100%; }

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

h1, h2, h3 { letter-spacing: -0.015em; font-weight: 700; color: var(--navy-950); }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 2rem 0 0.85rem; color: var(--navy-900); }
p { margin: 0 0 0.75rem; }
a { color: var(--navy-700); }

::selection { background: var(--yellow-300); }

/* ============ Merkezi sayfalar (login, 404, 410, hata) ============ */

.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(255, 210, 63, 0.18), transparent 60%),
    linear-gradient(160deg, var(--navy-950) 0%, var(--navy-800) 55%, var(--navy-600) 100%);
  padding: 1.5rem;
}

.auth-box, .notice-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--yellow-400), var(--yellow-600));
  font-size: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-md);
}

.auth-box h1, .notice-box h1 { font-size: 1.35rem; }
.auth-box form { text-align: left; margin-top: 1.5rem; }

.muted { color: var(--muted); }

/* ============ Form elemanları ============ */

label { display: block; margin-top: 1rem; font-size: 0.82rem; font-weight: 600; color: var(--navy-800); }

input, select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  margin-top: 0.4rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--navy-600);
  box-shadow: 0 0 0 4px var(--navy-100);
}

input[type="file"] { border: 1.5px dashed var(--border-strong); background: var(--surface-2); padding: 0.9rem; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  white-space: nowrap;
  gap: 0.4rem;
  margin-top: 1.25rem;
  padding: 0.68rem 1.4rem;
  background: var(--navy-950);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}

button:hover, .button:hover { background: var(--navy-800); box-shadow: var(--shadow-md); }
button:active, .button:active { transform: translateY(1px); }

button.accent, .button.accent, .auth-box button[type="submit"] {
  background: var(--yellow-500);
  color: var(--navy-950);
}
button.accent:hover, .button.accent:hover, .auth-box button[type="submit"]:hover { background: var(--yellow-400); }

button.secondary, .button.secondary {
  background: var(--surface);
  color: var(--navy-900);
  border: 1.5px solid var(--border-strong);
  box-shadow: none;
}
button.secondary:hover, .button.secondary:hover { background: var(--surface-2); }

.link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: var(--navy-700);
  cursor: pointer;
  padding: 0;
  margin: 0;
  font-size: 0.87rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
}
.link-button:hover { text-decoration: underline; }
.link-button.icon-only:hover { text-decoration: none; }
.link-button.danger { color: var(--danger); }

.form-error {
  color: var(--danger);
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.8rem;
  min-height: 1.2em;
  font-size: 0.85rem;
  font-weight: 600;
}
.form-error:empty { background: none; padding: 0; min-height: 0; }

/* ============ Uygulama iskeleti: sidebar + içerik ============ */

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--navy-950);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.4rem 1.4rem 1.1rem;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.sidebar-brand .mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--yellow-400), var(--yellow-600));
  font-size: 1.05rem;
}

.sidebar-nav { flex: 1; padding: 0.5rem 0.9rem; overflow-y: auto; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.62rem 0.85rem;
  margin-bottom: 0.2rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.68);
  text-decoration: none;
  font-size: 0.89rem;
  font-weight: 600;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.06); color: #fff; }
.sidebar-nav a.active {
  background: rgba(255, 210, 63, 0.12);
  color: var(--yellow-400);
}
.sidebar-nav .icon { font-size: 1rem; width: 1.1rem; text-align: center; }

.sidebar-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 1rem 0.85rem 0.35rem;
  font-weight: 700;
}

.sidebar-user {
  padding: 1rem 1.1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user-email {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-email:hover { color: var(--yellow-400); }
.sidebar-role-badge {
  display: inline-block;
  margin-top: 0.35rem;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.75);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sidebar-user form { margin-top: 0.65rem; }
.sidebar-user .link-button { color: rgba(255,255,255,0.55); }
.sidebar-user .link-button:hover { color: var(--yellow-400); }

.main-area { flex: 1; min-width: 0; }
.content { max-width: 1180px; margin: 0 auto; padding: 2.25rem 2.5rem 4rem; }
.content.narrow { max-width: 480px; }

/* ============ Sayfa başlığı ============ */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.6rem;
}
.page-header h1 { margin: 0; }
.page-header .button { margin-top: 0; }

/* ============ Tablo ============ */

.table-wrap {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  overflow-x: auto;
}

.data-table { width: 100%; border-collapse: collapse; background: var(--surface); }
.data-table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.data-table th, .data-table td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 0.88rem;
  white-space: nowrap;
}
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table .actions { display: flex; gap: 0.4rem; align-items: center; }

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--navy-800);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
}
.icon-action:hover { background: var(--navy-100); border-color: var(--navy-100); }
.icon-action:active { transform: translateY(1px); }
.icon-action.danger { color: var(--danger); }
.icon-action.danger:hover { background: var(--danger-bg); border-color: var(--danger-bg); }
.icon-action.success { color: var(--success); }
.icon-action.success:hover { background: var(--success-bg); border-color: var(--success-bg); }

.sr-only-sprite { display: none; }

.icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
}
.icon-only .icon { width: 15px; height: 15px; }

.status-pill {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}
.status-pill.active { background: var(--success-bg); color: var(--success); }
.status-pill.inactive { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

.short-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Cascadia Code', Consolas, monospace;
  font-size: 0.86rem;
  color: var(--navy-700);
  font-weight: 700;
  background: var(--navy-100);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}
.short-link .link-button { color: var(--navy-700); font-size: 0.85rem; }

.target-url {
  margin-top: 0.3rem;
  max-width: 320px;
  font-size: 0.8rem;
  color: var(--muted);
}

code {
  background: var(--navy-100);
  color: var(--navy-700);
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  font-size: 0.85rem;
}

/* ============ İstatistik kartları ============ */

.stat-cards { display: flex; gap: 1rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.stat-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-top: 3px solid var(--yellow-500);
  min-width: 190px;
  flex: 1;
}
.stat-value { font-size: 1.85rem; font-weight: 800; color: var(--navy-950); }
.stat-label { color: var(--muted); font-size: 0.8rem; margin-top: 0.2rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 1rem; }

/* ============ Hizli kisaltma formu (bkz. panel anasayfasi) ============ */

.shorten-card { margin-bottom: 1.5rem; }
.shorten-form {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: stretch;
}
.shorten-input { flex: 3 1 320px; margin-top: 0; }
.shorten-alias { flex: 1 1 160px; margin-top: 0; }
.shorten-submit { margin-top: 0; padding-left: 1.8rem; padding-right: 1.8rem; white-space: nowrap; }

.inline-form { display: inline; }

/* ============ Yardımcı sınıflar ============ */

.flex-1 { flex: 1; }
.mt-sm { margin-top: 0.5rem; }
.helper-text { font-size: 0.82rem; color: var(--muted); margin-top: 0.3rem; }

.qr-frame {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  text-align: center;
}
.qr-canvas { max-width: 280px; width: 100%; height: auto; border-radius: var(--radius-sm); display: block; margin: 0 auto; }
.qr-download-btn { margin-top: 1.25rem; }

/* Dar ekranlarda sidebar tamamen kaybolmaz - ikon seridine daralir.
   Boylece gezinme (Bagalantilarim, geri donme dahil) her zaman erisilebilir kalir. */
@media (max-width: 860px) {
  :root { --sidebar-w: 64px; }
  .sidebar-nav a { justify-content: center; padding: 0.62rem; }
  .sidebar-brand { justify-content: center; padding: 1.4rem 0 1.1rem; }
  .sidebar-user { display: flex; flex-direction: column; align-items: center; }
  .label { display: none; }
  .content { padding: 1.5rem; }
}
