/* ============================================================
   BORSA - Tasarım Sistemi
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  /* Renkler */
  --brand: #635bff;
  --brand-hover: #4f46e5;
  --success: #10b981;
  --danger: #dc2626;
  --warning: #f59e0b;
  --info: #3b82f6;

  /* Gri ölçek */
  --gray-50:  #fafbfc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* Plan renkleri */
  --plan-gray:   #64748b;
  --plan-blue:   #3b82f6;
  --plan-purple: #8b5cf6;
  --plan-amber:  #f59e0b;

  /* Layout */
  --sidebar-w: 240px;
  --topbar-h: 56px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-800);
  background: var(--gray-50);
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   AUTH (LOGIN) SAYFASI
   ============================================================ */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf3 100%);
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.08);
  padding: 32px;
}
.auth-header { text-align: center; margin-bottom: 24px; }
.auth-logo {
  width: 56px;
  height: 56px;
  background: var(--brand);
  color: #fff;
  border-radius: 12px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
}
.auth-header h1 { margin: 0; font-size: 20px; font-weight: 600; }
.auth-footer {
  text-align: center;
  margin-top: 18px;
  font-size: 12px;
}

/* ============================================================
   LAYOUT
   ============================================================ */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
  z-index: 40;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}
.brand-logo {
  width: 32px;
  height: 32px;
  background: var(--brand);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.brand-name { font-weight: 600; font-size: 15px; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}
.nav-group {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  font-weight: 600;
  padding: 14px 12px 6px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--gray-700);
  font-size: 13.5px;
  margin-bottom: 1px;
  transition: background 0.15s;
}
.nav-link:hover {
  background: var(--gray-100);
  text-decoration: none;
}
.nav-link.active {
  background: var(--brand);
  color: #fff;
}
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-label { flex: 1; }

.sidebar-foot {
  border-top: 1px solid var(--gray-200);
  padding: 12px;
}
.plan-badge {
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--gray-100);
  border-left: 3px solid var(--gray-400);
}
.plan-badge.plan-blue   { background: #eff6ff; border-color: var(--plan-blue); }
.plan-badge.plan-purple { background: #f5f3ff; border-color: var(--plan-purple); }
.plan-badge.plan-amber  { background: #fffbeb; border-color: var(--plan-amber); }
.plan-name { font-weight: 600; font-size: 12.5px; }
.plan-meta { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: var(--gray-500);
}
.logout-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 14px;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
}
.menu-toggle {
  display: none;
  background: none;
  border: 0;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
}
.page-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
.content {
  flex: 1;
  padding: 24px;
  max-width: 1280px;
  width: 100%;
}

/* Mobile */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .menu-toggle { display: block; }
  .content { padding: 16px; }
}

/* ============================================================
   FORMLAR
   ============================================================ */
label {
  display: block;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-600);
  margin-top: 14px;
  margin-bottom: 4px;
}
input[type=text],
input[type=email],
input[type=password],
input[type=tel],
input[type=number],
input[type=date],
select,
textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(99,91,255,0.12);
}
input:disabled {
  background: var(--gray-100);
  color: var(--gray-500);
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
}
.btn-primary:hover { background: var(--brand-hover); }

.btn {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--gray-200); }

/* ============================================================
   ALERT / CARD
   ============================================================ */
.alert {
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 13.5px;
  border-left: 3px solid;
}
.alert-error,
.alert-danger { background: #fef2f2; border-color: var(--danger); color: #991b1b; }
.alert-success { background: #f0fdf4; border-color: var(--success); color: #166534; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }
.alert-info    { background: #eff6ff; border-color: var(--info);    color: #1e40af; }

.welcome { margin-bottom: 24px; }
.welcome h2 { margin: 0 0 4px; font-size: 22px; }
.welcome p { margin: 0; }

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
}
.card-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-icon { font-size: 20px; }
.card-body { padding: 16px 18px; }

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
}

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

.quick-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.quick-links li {
  margin: 6px 0;
}
.quick-links a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
}
.quick-links a:hover {
  background: var(--gray-100);
  text-decoration: none;
}

/* Tablo (admin için) */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th {
  text-align: left;
  padding: 10px 12px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  color: var(--gray-600);
}
table.data td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
}
table.data tr:hover td { background: var(--gray-50); }

/* ============================================================
   AKORDEON MENU - Sidebar nav-group icin
   ============================================================ */
.nav-group-wrap {
  margin: 0;
  padding: 0;
  border: 0;
}

.nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 10px 12px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
  font-weight: 600;
  user-select: none;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}
.nav-group-toggle::-webkit-details-marker { display: none; }
.nav-group-toggle::marker { display: none; }

.nav-group-toggle:hover {
  color: var(--gray-600);
}

.nav-group-arrow {
  font-size: 10px;
  transition: transform 0.18s ease;
  color: var(--gray-400);
}
.nav-group-wrap[open] .nav-group-arrow {
  transform: rotate(180deg);
}

.nav-group-items {
  display: flex;
  flex-direction: column;
}

/* ============================================================
   TOPBAR USER DROPDOWN
   Sag ust kullanici menusu
   ============================================================ */

.topbar {
  justify-content: space-between;
}

.page-title {
  flex: 0 1 auto;
  margin-right: auto;
}

.topbar-user {
  position: relative;
  margin-left: auto;
}

.topbar-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 10px 6px 6px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.topbar-user-btn:hover {
  background: var(--gray-50);
  border-color: var(--gray-200);
}

.topbar-avatar {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #6d28d9, #4338ca);
  color: #fff;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.topbar-user-info {
  text-align: left;
  line-height: 1.3;
}
.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}
.topbar-user-plan {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.topbar-plan-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.topbar-user-arrow {
  font-size: 11px;
  color: var(--gray-400);
  transition: transform 0.15s;
}
.topbar-user-dropdown.open ~ .topbar-user-arrow,
.topbar-user-btn:has(+ .topbar-user-dropdown.open) .topbar-user-arrow {
  transform: rotate(180deg);
}

/* Mobilde plan bilgisini gizle */
@media (max-width: 600px) {
  .topbar-user-info { display: none; }
  .topbar-user-arrow { display: none; }
  .topbar-user-btn { padding: 4px; }
}

/* Dropdown */
.topbar-user-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  padding: 6px;
  display: none;
  z-index: 1000;
}
.topbar-user-dropdown.open {
  display: block;
  animation: dropdownIn 0.15s ease-out;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}
.dropdown-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #6d28d9, #4338ca);
  color: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.dropdown-username {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 2px;
}
.dropdown-email {
  font-size: 11.5px;
  color: var(--gray-500);
  word-break: break-all;
}

.dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

.dropdown-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--gray-700);
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.1s;
}
.dropdown-link:hover {
  background: var(--gray-50);
  color: var(--gray-900);
  text-decoration: none;
}
.dropdown-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
}
.dropdown-link.dropdown-danger {
  color: #dc2626;
}
.dropdown-link.dropdown-danger:hover {
  background: #fef2f2;
  color: #991b1b;
}

/* Sidebar foot kaldirildigi icin nav alta tasar */
.sidebar-nav {
  flex: 1;
  padding-bottom: 20px;
}
