@charset "UTF-8";

/* ==========================================================================
   Affiliate SaaS Admin Panel - Main Stylesheet
   BEM Methodology | Light/Dark Mode | Responsive
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties (Light Mode Default)
   -------------------------------------------------------------------------- */
:root {
  /* Accent & Brand */
  --color-accent: #6c5dd3;
  --color-accent-hover: #5a4cb5;
  --color-accent-light: rgba(108, 93, 211, 0.1);

  /* Semantic */
  --color-success: #10b981;
  --color-success-light: rgba(16, 185, 129, 0.1);
  --color-warning: #f59e0b;
  --color-warning-light: rgba(245, 158, 11, 0.1);
  --color-danger: #ef4444;
  --color-danger-light: rgba(239, 68, 68, 0.1);
  --color-info: #3b82f6;
  --color-info-light: rgba(59, 130, 246, 0.1);

  /* Surfaces */
  --bg-body: #f5f6fa;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-sidebar: #1e1e2d;
  --bg-topbar: #ffffff;

  /* Borders */
  --border-color: #e5e7eb;
  --border-color-light: #f0f0f5;

  /* Text */
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;
  --text-sidebar: #9899ac;
  --text-sidebar-active: #ffffff;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;

  /* Typography */
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono", monospace;
}

/* --------------------------------------------------------------------------
   2. Dark Mode
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-body: #151521;
  --bg-card: #1e1e2d;
  --bg-input: #2b2b40;
  --bg-sidebar: #1a1a27;
  --bg-topbar: #1e1e2d;

  --border-color: #2b2b40;
  --border-color-light: #232336;

  --text-primary: #e4e6ef;
  --text-secondary: #9899ac;
  --text-muted: #6d6e82;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* --------------------------------------------------------------------------
   3. Reset / Normalize
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-body);
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-hover);
}

/* Buton linklerde global a:hover'ı ezme */
a.btn:hover { color: inherit; }
a.btn-primary:hover,
a.btn-success:hover,
a.btn-danger:hover,
a.btn-info:hover { color: #ffffff; }
a.btn-outline-primary:hover { color: #ffffff; }

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   4. Typography
   -------------------------------------------------------------------------- */
h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

small {
  font-size: 0.8125rem;
}

.text-sm { font-size: 0.8125rem; }
.text-base { font-size: 0.9375rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* --------------------------------------------------------------------------
   5. Layout: Sidebar
   -------------------------------------------------------------------------- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--bg-sidebar);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition-normal);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  height: var(--topbar-height);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
}

.sidebar-brand-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-sidebar-active);
  letter-spacing: -0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
}

.sidebar-section {
  margin-bottom: 0.5rem;
}

.sidebar-section-title {
  padding: 0.5rem 1.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  color: var(--text-sidebar);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-link:hover {
  color: var(--text-sidebar-active);
  background-color: rgba(255, 255, 255, 0.04);
}

.sidebar-link-active {
  color: var(--text-sidebar-active);
  background-color: rgba(108, 93, 211, 0.15);
}

.sidebar-link-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background-color: var(--color-accent);
  border-radius: 0 3px 3px 0;
}

.sidebar-link-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
}

.sidebar-link-active .sidebar-link-icon {
  opacity: 1;
}

.sidebar-link-badge {
  margin-left: auto;
  background-color: var(--color-accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.sidebar-overlay-visible {
  display: block;
  opacity: 1;
}

/* --------------------------------------------------------------------------
   6. Layout: Topbar
   -------------------------------------------------------------------------- */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background-color: var(--bg-topbar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 900;
  transition: left var(--transition-normal);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: background-color var(--transition-fast);
}

.topbar-menu-btn:hover {
  background-color: var(--color-accent-light);
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.topbar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background-color: var(--color-accent-light);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: box-shadow var(--transition-fast);
}

.topbar-avatar:hover {
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

/* --------------------------------------------------------------------------
   7. Layout: Main Content
   -------------------------------------------------------------------------- */
.main {
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
}

.main-content {
  padding: 1.5rem;
  max-width: 1400px;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
}

.content-wrapper {
  padding: 1.5rem;
  margin-top: var(--topbar-height);
}

/* --------------------------------------------------------------------------
   8. Card Component
   -------------------------------------------------------------------------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: 1.25rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* --------------------------------------------------------------------------
   9. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-sm {
  padding: 0.3rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.65rem 1.75rem;
  font-size: 1rem;
}

/* Primary */
.btn-primary {
  background-color: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
}

.btn-primary:hover {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* Success */
.btn-success {
  background-color: var(--color-success);
  color: #ffffff;
  border-color: var(--color-success);
}

.btn-success:hover {
  background-color: #0ea472;
  border-color: #0ea472;
}

/* Danger */
.btn-danger {
  background-color: var(--color-danger);
  color: #ffffff;
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background-color: #dc2626;
  border-color: #dc2626;
}

/* Outline Primary */
.btn-outline-primary {
  background-color: transparent;
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.btn-outline-primary:hover {
  background-color: var(--color-accent);
  color: #ffffff;
}

/* Outline Success */
.btn-outline-success {
  background-color: transparent;
  color: var(--color-success);
  border-color: var(--color-success);
}

.btn-outline-success:hover {
  background-color: var(--color-success);
  color: #ffffff;
}

/* Outline Danger */
.btn-outline-danger {
  background: transparent;
  color: var(--color-danger);
  border: 1px solid var(--color-danger);
}

.btn-outline-danger:hover {
  background: var(--color-danger);
  color: #fff;
}

.btn-block { width: 100%; display: flex; }

/* Ghost / Subtle */
.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   10. Form Controls
   -------------------------------------------------------------------------- */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
}

.form-label-required::after {
  content: " *";
  color: var(--color-danger);
}

.form-input,
.form-select,
.form-textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
  font-family: var(--font-family);
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input-error {
  border-color: var(--color-danger);
}

.form-input-error:focus {
  box-shadow: 0 0 0 3px var(--color-danger-light);
}

/* Form ekstra bilesenler */
.form-row { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.form-row-between { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.25rem; }

.form-checkbox {
  display: flex; align-items: center; gap: 0.5rem; cursor: pointer;
  font-size: 0.875rem; color: var(--text-secondary);
}
.form-checkbox input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--color-accent);
}

.form-link {
  font-size: 0.875rem; color: var(--color-accent); text-decoration: none;
}
.form-link:hover { text-decoration: underline; }

/* Alert */
.alert {
  padding: 0.75rem 1rem; border-radius: var(--radius-md); margin-bottom: 1rem;
  font-size: 0.875rem; display: flex; align-items: center; gap: 0.5rem;
}
.alert-danger {
  background: var(--color-danger-light); color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.alert-success {
  background: var(--color-success-light); color: var(--color-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}
.alert-warning {
  background: var(--color-warning-light); color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-hint {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.form-error {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--color-danger);
}

.form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   11. Tables
   -------------------------------------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
}

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

.table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background-color: var(--bg-body);
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  vertical-align: middle;
}

.table tbody tr {
  transition: background-color var(--transition-fast);
}

.table tbody tr:hover {
  background-color: var(--color-accent-light);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-striped tbody tr:nth-child(even) {
  background-color: var(--bg-body);
}

.table-striped tbody tr:nth-child(even):hover {
  background-color: var(--color-accent-light);
}

/* --------------------------------------------------------------------------
   12. Badges / Tags
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  border-radius: 20px;
  white-space: nowrap;
}

.badge-primary {
  background-color: var(--color-accent-light);
  color: var(--color-accent);
}

.badge-success {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.badge-warning {
  background-color: var(--color-warning-light);
  color: var(--color-warning);
}

.badge-danger {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

.badge-info {
  background-color: var(--color-info-light);
  color: var(--color-info);
}

.badge-neutral {
  background-color: var(--border-color);
  color: var(--text-secondary);
}

.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

/* --------------------------------------------------------------------------
   13. Toast Notifications
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: calc(var(--topbar-height) + 1rem);
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  min-width: 320px;
  max-width: 420px;
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  pointer-events: all;
  animation: toast-slide-in 0.3s ease forwards;
}

.toast-removing {
  animation: toast-slide-out 0.25s ease forwards;
}

.toast-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

.toast-success { border-left: 3px solid var(--color-success); }
.toast-danger  { border-left: 3px solid var(--color-danger); }
.toast-warning { border-left: 3px solid var(--color-warning); }
.toast-info    { border-left: 3px solid var(--color-info); }

@keyframes toast-slide-in {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toast-slide-out {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* --------------------------------------------------------------------------
   14. Spinner / Loading
   -------------------------------------------------------------------------- */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 4px;
}

.spinner-white {
  border-color: rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: inherit;
  z-index: 10;
}

[data-theme="dark"] .loading-overlay {
  background-color: rgba(30, 30, 45, 0.7);
}

/* --------------------------------------------------------------------------
   15. Utility Classes
   -------------------------------------------------------------------------- */

/* Text colors */
.text-success { color: var(--color-success) !important; }
.text-danger  { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-info    { color: var(--color-info) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-accent  { color: var(--color-accent) !important; }
.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }

/* Text alignment */
.text-left   { text-align: left !important; }
.text-center { text-align: center !important; }
.text-right  { text-align: right !important; }

/* Margins - top */
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

/* Margins - bottom */
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }

/* Margins - left / right */
.ml-auto { margin-left: auto !important; }
.mr-auto { margin-right: auto !important; }

/* Padding */
.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }

/* Display */
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }
.d-block { display: block !important; }
.d-inline-block { display: inline-block !important; }
.d-none { display: none !important; }

/* Flex helpers */
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.justify-center { justify-content: center !important; }
.justify-end { justify-content: flex-end !important; }
.flex-wrap { flex-wrap: wrap !important; }
.gap-1 { gap: 0.5rem !important; }
.gap-2 { gap: 0.75rem !important; }
.gap-3 { gap: 1rem !important; }

/* Misc */
.w-100 { width: 100% !important; }
.rounded { border-radius: var(--radius-md) !important; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.relative { position: relative !important; }

/* --------------------------------------------------------------------------
   16. Responsive: Mobile (<768px) - Sidebar Overlay
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar-open {
    transform: translateX(0);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .topbar {
    left: 0;
  }

  .topbar-menu-btn {
    display: flex;
  }

  .main {
    margin-left: 0;
  }

  .main-content {
    margin-left: 0;
    padding: 1rem;
  }

  .toast-container {
    right: 1rem;
    left: 1rem;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }

  .detail-grid { grid-template-columns: 1fr; }
  .filter-row { flex-direction: column; }
  .search-form-row { flex-direction: column; }
  .filter-card-row { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   17. Scrollbar Styling
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   18. Modal (base)
   -------------------------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-backdrop-visible {
  opacity: 1;
  visibility: visible;
}

.modal {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-backdrop-visible .modal {
  transform: translateY(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.0625rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   19. Pagination
   -------------------------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  margin-top: 1rem;
  padding: 0.75rem 0;
}

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  transition: all var(--transition-fast);
}

.pagination-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.pagination-btn-active {
  background-color: var(--color-accent);
  border-color: var(--color-accent);
  color: #ffffff;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pagination-info { font-size: 0.8125rem; color: var(--text-muted); }
.pagination-links { display: flex; gap: 0.5rem; }
.pagination-link {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
}
.pagination-link:hover { background: var(--color-accent-light); color: var(--color-accent); border-color: var(--color-accent); }

/* --------------------------------------------------------------------------
   20. Empty State
   -------------------------------------------------------------------------- */
.empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.empty-state i, .empty-state svg {
  width: 40px;
  height: 40px;
  margin-bottom: 0.75rem;
  opacity: 0.4;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  color: var(--text-muted);
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
}

.empty-state-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 360px;
  margin: 0 auto;
}

.empty-state p {
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   21. Topbar Button & Dropdown
   -------------------------------------------------------------------------- */
.topbar-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
}
.topbar-btn:hover {
  background-color: var(--color-accent-light);
  color: var(--color-accent);
}

/* Dropdown */
.dropdown { position: relative; }
.dropdown-toggle { cursor: pointer; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 1100;
  display: none;
  padding: 0.375rem 0;
  margin-top: 0.375rem;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: block;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  text-decoration: none;
  transition: background var(--transition-fast);
}
.dropdown-item:hover { background: var(--color-accent-light); }
.dropdown-item.active { color: var(--color-accent); font-weight: 600; }

/* --------------------------------------------------------------------------
   Filter Tabs
   -------------------------------------------------------------------------- */
.filter-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 0;
}
.filter-tabs-item {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.filter-tabs-item:hover {
  color: var(--text-primary);
}
.filter-tabs-item-active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   Data Table
   -------------------------------------------------------------------------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table-th {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  text-align: left;
  white-space: nowrap;
}
.data-table-th-check { width: 40px; text-align: center; }
.data-table-td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.data-table-td-check { width: 40px; text-align: center; }
.data-table-row { transition: background var(--transition-fast); }
.data-table-row:hover { background: var(--color-accent-light); }
.data-table-link { color: var(--color-accent); text-decoration: none; font-weight: 500; }
.data-table-link:hover { text-decoration: underline; }
.data-table-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Page Header
   -------------------------------------------------------------------------- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-header-left { flex: 1; min-width: 0; }
.page-header-right { display: flex; gap: 0.5rem; align-items: center; }
.page-header-title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   Detail Card (show pages)
   -------------------------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
.detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.detail-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.detail-card-title { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); }
.detail-card-body { padding: 1.25rem; }
.detail-card-warning { border-color: var(--color-warning); }
.detail-list { display: flex; flex-direction: column; gap: 0; }
.detail-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border-color);
}
.detail-list-item:last-child { border-bottom: none; }
.detail-list-label { font-size: 0.8125rem; color: var(--text-muted); }
.detail-list-value { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.detail-row { display: flex; justify-content: space-between; padding: 0.5rem 0; }
.detail-row-label { color: var(--text-muted); font-size: 0.8125rem; }
.detail-row-value { font-weight: 500; }
.detail-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.detail-actions-form { display: inline; }

/* --------------------------------------------------------------------------
   Search Form
   -------------------------------------------------------------------------- */
.search-form { margin-bottom: 1.25rem; }
.search-form-row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end; }
.search-form-input-wrapper { flex: 1; min-width: 200px; position: relative; }
.search-form-input {
  width: 100%;
  padding: 0.5rem 1rem 0.5rem 2.25rem;
  font-size: 0.875rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--text-primary);
}
.search-form-input:focus { border-color: var(--color-accent); outline: none; }
.search-form-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

/* --------------------------------------------------------------------------
   User Cell (table avatar + name)
   -------------------------------------------------------------------------- */
.user-cell { display: flex; align-items: center; gap: 0.625rem; }
.user-cell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent-light);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  flex-shrink: 0;
}
.user-cell-name { font-weight: 500; }

/* --------------------------------------------------------------------------
   Profile Header (affiliate show)
   -------------------------------------------------------------------------- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
}
.profile-header-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-accent-light);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  flex-shrink: 0;
}
.profile-header-info { flex: 1; }
.profile-header-name { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); }
.profile-header-meta { display: flex; gap: 1rem; margin-top: 0.25rem; flex-wrap: wrap; }
.profile-header-date { font-size: 0.8125rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Table Card wrapper
   -------------------------------------------------------------------------- */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.table-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.table-card-title { font-size: 1rem; font-weight: 600; }
.table-card-desc { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.125rem; }
.table-responsive { overflow-x: auto; }
.table-actions { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.25rem; border-top: 1px solid var(--border-color); }
.table-actions-count { font-size: 0.8125rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Timeline
   -------------------------------------------------------------------------- */
.timeline { padding: 1rem 0; }
.timeline-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg); margin-bottom: 1.25rem; }
.timeline-card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--border-color); }
.timeline-card-title { font-size: 0.9375rem; font-weight: 600; }
.timeline-card-body { padding: 1.25rem; }
.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  position: relative;
}
.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-color);
  flex-shrink: 0;
  margin-top: 0.25rem;
}
.timeline-item-completed .timeline-dot { background: var(--color-success); }
.timeline-item-pending .timeline-dot { background: var(--color-warning); }
.timeline-item-rejected .timeline-dot { background: var(--color-danger); }
.timeline-content { flex: 1; }
.timeline-title { font-size: 0.875rem; font-weight: 500; }
.timeline-date { font-size: 0.75rem; color: var(--text-muted); }

/* --------------------------------------------------------------------------
   Settings Tabs
   -------------------------------------------------------------------------- */
.settings-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-color);
}
.settings-tabs-btn {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
}
.settings-tabs-btn:hover { color: var(--text-primary); }
.settings-tabs-btn-active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  font-weight: 600;
}
.settings-panel { display: none; }
.settings-panel.active { display: block; }

/* --------------------------------------------------------------------------
   Ref Code / Copy
   -------------------------------------------------------------------------- */
.ref-code {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   Notification Item
   -------------------------------------------------------------------------- */
.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background var(--transition-fast);
}
.notification-item:hover { background: var(--color-accent-light); }
.notification-item-unread { background: rgba(108, 93, 211, 0.04); }
.notification-item-read { opacity: 0.7; }
.notification-item-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--color-accent-light);
  color: var(--color-accent);
}
.notification-item-icon-success { background: var(--color-success-light); color: var(--color-success); }
.notification-item-icon-warning { background: var(--color-warning-light); color: var(--color-warning); }
.notification-item-icon-danger { background: var(--color-danger-light); color: var(--color-danger); }
.notification-item-icon-info { background: var(--color-info-light); color: var(--color-info); }
.notification-item-content { flex: 1; min-width: 0; }
.notification-item-title { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); }
.notification-item-body { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.125rem; }
.notification-item-time { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; margin-top: 0.25rem; }

/* --------------------------------------------------------------------------
   Rank Badge (reports)
   -------------------------------------------------------------------------- */
.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--color-accent-light);
  color: var(--color-accent);
}
.rank-badge-1 { background: #fef3c7; color: #d97706; }
.rank-badge-2 { background: #e5e7eb; color: #6b7280; }
.rank-badge-3 { background: #fed7aa; color: #c2410c; }

/* --------------------------------------------------------------------------
   Chart Placeholder
   -------------------------------------------------------------------------- */
.chart-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Badge extras
   -------------------------------------------------------------------------- */
.badge-secondary { background: var(--border-color); color: var(--text-secondary); }
.badge-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-secondary); }
.badge-sm { font-size: 0.6875rem; padding: 0.125rem 0.375rem; }

/* --------------------------------------------------------------------------
   Button extras
   -------------------------------------------------------------------------- */
.btn-xs { padding: 0.2rem 0.5rem; font-size: 0.75rem; }
.btn-outline { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-outline:hover { background: var(--color-accent-light); color: var(--color-accent); border-color: var(--color-accent); }
.btn-outline-secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-outline-secondary:hover { background: var(--border-color); }
.btn-outline-warning { background: transparent; color: var(--color-warning); border: 1px solid var(--color-warning); }
.btn-outline-warning:hover { background: var(--color-warning); color: #fff; }
.btn-info { background: var(--color-info); color: #fff; border-color: var(--color-info); }
.btn-group { display: inline-flex; gap: 0.25rem; }
.btn-cancel-edit, .btn-cancel-field-edit { cursor: pointer; }
.btn-edit-group, .btn-edit-field { cursor: pointer; }
.btn-mark-read { cursor: pointer; }

/* --------------------------------------------------------------------------
   Form filter row (orders etc.)
   -------------------------------------------------------------------------- */
.filter-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 1.25rem;
}
.filter-row .form-group { margin-bottom: 0; flex: 1; min-width: 150px; }

/* --------------------------------------------------------------------------
   Filter Card (orders, reports etc.)
   -------------------------------------------------------------------------- */
.filter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.filter-card-form { width: 100%; }
.filter-card-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: flex-end;
}
.filter-card-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.filter-card-field { min-width: 0; }
.filter-card-field-actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  padding-top: 0.25rem;
}

/* Page Actions (button row) */
.page-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

/* Stat card sub text */
.stat-card-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.125rem; }
.stat-card-icon-secondary { background: var(--border-color); color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   Responsive: Tablet & smaller
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .detail-grid { grid-template-columns: 1fr; }
}
