/* ===== SIMULTER COMPONENT LIBRARY ===== */
/* Paylaşılmış UI bileşenleri: butonlar, inputlar, kartlar, tablolar, badge, modal */

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
  line-height: 1.4;
}

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

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-xl {
  padding: 16px 32px;
  font-size: 1.1rem;
  border-radius: var(--radius-lg);
}

/* Primary */
.btn-primary {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}
.btn-primary:hover {
  background: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
  box-shadow: 0 4px 16px var(--brand-primary-glow);
}

/* Secondary */
.btn-secondary {
  background: var(--brand-secondary);
  color: #fff;
  border-color: var(--brand-secondary);
}
.btn-secondary:hover {
  background: var(--brand-secondary-hover);
  border-color: var(--brand-secondary-hover);
}

/* Accent */
.btn-accent {
  background: var(--brand-accent);
  color: #fff;
  border-color: var(--brand-accent);
}
.btn-accent:hover {
  background: var(--brand-accent-hover);
  border-color: var(--brand-accent-hover);
}

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

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-primary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
}

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--brand-primary);
  border-color: var(--brand-primary);
}
.btn-outline:hover {
  background: var(--brand-primary);
  color: #fff;
}

/* Icon button */
.btn-icon {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Full width */
.btn-block {
  width: 100%;
}

/* Loading state */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ===== INPUTS ===== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
  padding: 10px 14px;
  font-family: var(--font-family);
  font-size: 0.9rem;
  color: var(--input-text);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  outline: none;
  width: 100%;
}

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

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

.form-input-sm {
  padding: 7px 10px;
  font-size: 0.8rem;
}

.form-input-lg {
  padding: 14px 18px;
  font-size: 1rem;
}

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

.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 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Input with icon */
.input-wrapper {
  position: relative;
}

.input-wrapper .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  font-size: 1rem;
  pointer-events: none;
}

.input-wrapper .form-input {
  padding-left: 40px;
}

/* Password toggle */
.input-wrapper .input-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
}
.input-wrapper .input-toggle:hover {
  color: var(--text-primary);
}

/* Checkbox & Radio */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

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

.form-check-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  user-select: none;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--brand-primary);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Form error */
.form-error {
  font-size: 0.8rem;
  color: var(--brand-danger);
  margin-top: 4px;
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* Password strength */
.password-strength {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.password-strength-bar {
  height: 4px;
  flex: 1;
  background: var(--bg-tertiary);
  border-radius: 2px;
  transition: background var(--transition-fast);
}

.password-strength-bar.active.weak { background: var(--brand-danger); }
.password-strength-bar.active.medium { background: var(--brand-warning); }
.password-strength-bar.active.strong { background: var(--brand-secondary); }

/* ===== CARDS ===== */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-fast);
}

.card-hover:hover {
  background: var(--surface-card-hover);
  border-color: var(--border-active);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-secondary);
}

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

.card-body {
  color: var(--text-secondary);
}

.card-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-secondary);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* Stat Card */
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.stat-card-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.stat-card-info {
  flex: 1;
  min-width: 0;
}

.stat-card-label {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-card-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-top: 4px;
}

.stat-card-change {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 4px;
}

.stat-card-change.positive { color: var(--brand-secondary); }
.stat-card-change.negative { color: var(--brand-danger); }

/* ===== TABLES ===== */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
}

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

.table th,
.table td {
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
}

.table th {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-primary);
}

.table td {
  border-bottom: 1px solid var(--border-secondary);
  color: var(--text-secondary);
}

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

.table tr:hover td {
  background: var(--bg-hover);
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  white-space: nowrap;
}

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

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

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

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

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

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-secondary);
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color var(--transition-fast);
}
.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-secondary);
}

/* ===== AVATAR ===== */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  background: var(--brand-primary);
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-sm { width: 32px; height: 32px; font-size: 0.75rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.avatar-xl { width: 80px; height: 80px; font-size: 1.6rem; }

/* ===== DROPDOWN ===== */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: all var(--transition-fast);
}

.dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-family);
}

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-item.danger {
  color: var(--brand-danger);
}

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

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-primary);
}

.tab-item {
  padding: 10px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-tertiary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
  margin-bottom: -1px;
}

.tab-item:hover {
  color: var(--text-secondary);
}

.tab-item.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-family);
}

.page-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-active);
}

.page-btn.active {
  background: var(--brand-primary);
  color: #fff;
  border-color: var(--brand-primary);
}

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

/* ===== PROGRESS BAR ===== */
.progress {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--brand-primary);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.progress-bar.success { background: var(--brand-secondary); }
.progress-bar.warning { background: var(--brand-warning); }
.progress-bar.danger { background: var(--brand-danger); }

/* ===== TOAST / ALERT ===== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  border: 1px solid;
}

.alert-success {
  background: var(--badge-success-bg);
  color: var(--badge-success-text);
  border-color: rgba(16, 185, 129, 0.2);
}

.alert-warning {
  background: var(--badge-warning-bg);
  color: var(--badge-warning-text);
  border-color: rgba(245, 158, 11, 0.2);
}

.alert-danger {
  background: var(--badge-danger-bg);
  color: var(--badge-danger-text);
  border-color: rgba(239, 68, 68, 0.2);
}

.alert-info {
  background: var(--badge-info-bg);
  color: var(--badge-info-text);
  border-color: rgba(37, 99, 235, 0.2);
}

/* Toast container */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  color: var(--text-primary);
  animation: toast-in 0.3s ease-out;
  min-width: 280px;
}

.toast.toast-out {
  animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* ===== DIVIDER ===== */
.divider {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-tertiary);
  font-size: 0.8rem;
  margin: 20px 0;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-primary);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state-text {
  font-size: 0.9rem;
  color: var(--text-tertiary);
  max-width: 360px;
  margin-bottom: 24px;
}

/* ===== SKELETON LOADING ===== */
.skeleton {
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  animation: skeleton-pulse 1.5s infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-circle {
  border-radius: 50%;
}

/* ===== TOOLTIP ===== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  background: #18181b;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--transition-fast);
  z-index: 1001;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* ===== ACCORDION ===== */
.accordion-item {
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion-item + .accordion-item {
  margin-top: 8px;
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 16px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--surface-card);
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  text-align: left;
  transition: background var(--transition-fast);
}

.accordion-header:hover {
  background: var(--surface-card-hover);
}

.accordion-arrow {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  transition: transform var(--transition-fast);
}

.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base);
}

.accordion-item.open .accordion-body {
  max-height: 500px;
}

.accordion-content {
  padding: 16px 20px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  border-top: 1px solid var(--border-secondary);
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-tertiary { color: var(--text-tertiary) !important; }
.text-brand { color: var(--brand-primary) !important; }
.text-success { color: var(--brand-secondary) !important; }
.text-danger { color: var(--brand-danger) !important; }
.text-warning { color: var(--brand-warning) !important; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .card { padding: 16px; }
  .stat-card { padding: 16px; }
  .stat-card-value { font-size: 1.4rem; }
  .modal { margin: 12px; }
  .table th, .table td { padding: 10px 12px; font-size: 0.8rem; }
  .hide-mobile { display: none !important; }
}

@media (max-width: 480px) {
  .btn { padding: 8px 16px; font-size: 0.85rem; }
  .btn-lg { padding: 12px 22px; }
  .tabs { overflow-x: auto; }
  .tab-item { padding: 8px 12px; font-size: 0.8rem; }
}
