/* ============================================================================
   BORSA - Site Stilleri
   ============================================================================ */

* { box-sizing: border-box; }

:root {
  --bg:          #f5f7fa;
  --bg-sidebar:  #1e2533;
  --bg-topbar:   #ffffff;
  --bg-card:     #ffffff;
  --text:        #1f2937;
  --text-light:  #6b7280;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;
  --primary:     #2563eb;
  --primary-dark: #1d4ed8;
  --success:     #16a34a;
  --warning:     #ea580c;
  --danger:      #dc2626;
  --border:      #e5e7eb;
  --border-sidebar: #2d3548;
  --shadow:      0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg:   0 4px 12px rgba(0,0,0,0.1);
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

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

/* ============================================================================
   LAYOUT
   ============================================================================ */

.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
  min-height: 100vh;
}

.app-topbar  { grid-area: topbar; }
.app-sidebar { grid-area: sidebar; }
.app-main    { grid-area: main; overflow-y: auto; }

/* ============================================================================
   TOPBAR
   ============================================================================ */

.app-topbar {
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text);
  display: none;  /* mobilde gözükecek */
}
.sidebar-toggle:hover { background: var(--bg); border-radius: 4px; }

.topbar-brand {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
}
.topbar-brand:hover { text-decoration: none; }

.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
}
.badge-admin {
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.4px;
}
.topbar-link {
  color: var(--text-light);
  font-size: 18px;
  padding: 6px 8px;
  border-radius: 4px;
}
.topbar-link:hover { background: var(--bg); color: var(--text); text-decoration: none; }

/* ============================================================================
   SIDEBAR + AKORDIYON MENU
   ============================================================================ */

.app-sidebar {
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  overflow-y: auto;
  border-right: 1px solid var(--border-sidebar);
}

.sidebar-menu {
  padding: 12px 0;
}

.menu-root {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Standalone link (Anasayfa) */
.menu-item-standalone {
  margin: 2px 8px;
}
.menu-item-standalone a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  color: var(--text-sidebar);
  border-radius: 6px;
  font-size: 14px;
  transition: background 0.15s;
}
.menu-item-standalone a:hover {
  background: var(--border-sidebar);
  text-decoration: none;
  color: var(--text-sidebar-active);
}
.menu-item-standalone.active a {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

/* Akordiyon grup */
.menu-group {
  margin: 2px 8px;
}
.menu-group-header {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-sidebar);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: background 0.15s;
}
.menu-group-header:hover {
  background: var(--border-sidebar);
  color: var(--text-sidebar-active);
}
.menu-group-title {
  flex: 1;
}
.menu-chevron {
  font-size: 12px;
  transition: transform 0.2s;
  opacity: 0.7;
}
.menu-group.open .menu-chevron {
  transform: rotate(180deg);
}

/* Alt menü */
.menu-sub {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}
.menu-group.open .menu-sub {
  max-height: 500px;
}

.menu-sub-item a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px 7px 36px;
  color: var(--text-sidebar);
  font-size: 13px;
  border-radius: 4px;
  margin: 1px 4px;
}
.menu-sub-item a:hover {
  background: var(--border-sidebar);
  text-decoration: none;
  color: var(--text-sidebar-active);
}
.menu-sub-item.active a {
  background: var(--primary);
  color: white;
  font-weight: 500;
}

/* ============================================================================
   MAIN CONTENT
   ============================================================================ */

.app-content {
  padding: 24px 32px;
  max-width: 1400px;
}

.page-header {
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 22px;
  margin: 0 0 4px 0;
  font-weight: 600;
}
.page-subtitle {
  color: var(--text-light);
  margin: 0;
  font-size: 14px;
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 12px 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Flash messages */
.flash {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.flash-error,
.flash-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.flash-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}
.btn:hover { background: var(--primary-dark); color: white; text-decoration: none; }
.btn-secondary { background: #6b7280; }
.btn-secondary:hover { background: #4b5563; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Forms */
.form-group {
  margin-bottom: 16px;
}
.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
select.form-control {
  appearance: auto;
}

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table th,
.table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.table th {
  background: #f9fafb;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-light);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #fafbfc; }

/* Status badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-failed  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-muted   { background: #e5e7eb; color: #4b5563; }

/* ============================================================================
   LOGIN PAGE
   ============================================================================ */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #1e2533 100%);
  padding: 20px;
}
.login-card {
  background: white;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-card h1 {
  font-size: 22px;
  margin: 0 0 8px 0;
  text-align: center;
}
.login-card .subtitle {
  text-align: center;
  color: var(--text-light);
  margin: 0 0 24px 0;
  font-size: 13px;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "topbar"
      "main";
  }
  .app-sidebar {
    position: fixed;
    top: 56px;
    left: -260px;
    width: 260px;
    height: calc(100vh - 56px);
    z-index: 40;
    transition: left 0.25s;
  }
  .app-sidebar.open { left: 0; }
  .sidebar-toggle { display: inline-block; }
  .app-content { padding: 16px; }
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.text-muted { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-3 { margin-top: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mono { font-family: 'SF Mono', Monaco, Consolas, monospace; font-size: 12px; }
