/**
 * ÇOKLU MARKA KARALİSTE SİSTEMİ v4.0
 * Modern Dark Theme CSS
 */

/* ========== VARIABLES ========== */
:root {
  --bg: #0b0b0c;
  --panel: #131316;
  --muted: #9aa0a6;
  --text: #e8eaed;
  --accent: #a9ee16;
  --accent2: #5ef3ff;
  --border: #26272b;
  --danger: #ff3b30;
  --success: #34c759;
  --warning: #ff9500;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 5px;
  transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* ========== BACKGROUND EFFECTS ========== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background: 
    radial-gradient(circle at 15% 30%, rgba(255, 140, 0, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 70%, rgba(169, 238, 22, 0.06) 0%, transparent 40%),
    radial-gradient(circle at 50% 80%, rgba(94, 243, 255, 0.05) 0%, transparent 40%),
    linear-gradient(135deg, #0b0b0c 0%, #0f0f11 50%, #0b0b0c 100%);
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: 
    linear-gradient(rgba(255, 140, 0, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 140, 0, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  opacity: 0.6;
  animation: gridMove 30s linear infinite;
}

@keyframes gridMove {
  0% { background-position: 0 0; }
  100% { background-position: 60px 60px; }
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: 0.12;
  animation: float 20s ease-in-out infinite;
}

.bg-orb-1 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(255, 140, 0, 0.4), transparent);
  top: 10%;
  left: 10%;
}

.bg-orb-2 {
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(169, 238, 22, 0.3), transparent);
  top: 60%;
  right: 15%;
  animation-delay: -7s;
}

.bg-orb-3 {
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(94, 243, 255, 0.25), transparent);
  bottom: 20%;
  left: 50%;
  animation-delay: -14s;
}

@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -30px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* ========== LAYOUT ========== */
.wrap {
  max-width: 1200px;
  margin: 32px auto;
  padding: 0 16px;
  position: relative;
  z-index: 2;
  opacity: 0;
  animation: fadeInPage 0.6s ease forwards 0.1s;
}

@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.user-info {
  color: var(--muted);
  margin-right: 12px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 980px) {
  .grid { grid-template-columns: 1fr 1fr; }
}

.table-scroll {
  overflow-x: auto;
}

/* ========== TYPOGRAPHY ========== */
h1 {
  font-size: 24px;
  margin: 0 0 8px;
  animation: blurIn 0.8s ease forwards;
}

h2 {
  font-size: 16px;
  margin: 24px 0 8px;
  color: var(--muted);
}

h3 {
  font-size: 14px;
  color: var(--text);
}

.sub {
  color: var(--muted);
  margin-bottom: 16px;
}

.help {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

@keyframes blurIn {
  from { opacity: 0; filter: blur(10px); transform: translateY(10px); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); }
}

/* ========== CARDS ========== */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  animation: cardFadeIn 0.5s ease forwards;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  border-color: rgba(169, 238, 22, 0.2);
}

.card.drop-highlight {
  border-color: var(--accent) !important;
  background: rgba(169, 238, 22, 0.05) !important;
}

/* Animation delays for grid cards */
.grid .card:nth-child(1) { animation-delay: 0.1s; }
.grid .card:nth-child(2) { animation-delay: 0.15s; }
.grid .card:nth-child(3) { animation-delay: 0.2s; }
.grid .card:nth-child(4) { animation-delay: 0.25s; }

/* ========== LOGIN CARD ========== */
.login-card {
  position: relative;
  overflow: hidden;
  max-width: 500px;
  margin: 48px auto;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  padding: 2px;
  background: conic-gradient(from 0deg, var(--accent), transparent 50%, var(--accent2));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderSpin 8s linear infinite;
  opacity: 0.35;
}

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

.shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  10%, 90% { transform: translateX(-3px); }
  20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* ========== FORMS ========== */
label.title {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

input[type=file],
input[type=text],
input[type=password],
select {
  display: block;
  width: 100%;
  padding: 12px;
  background: #0d0d10;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  transition: all 0.3s ease;
}

input[type=text]:hover,
input[type=password]:hover,
select:hover {
  border-color: rgba(169, 238, 22, 0.4);
  background: rgba(169, 238, 22, 0.02);
}

input[type=text]:focus,
input[type=password]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(169, 238, 22, 0.1);
}

textarea {
  width: 100%;
  height: 120px;
  background: #0d0d10;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 10px;
  resize: vertical;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.3s ease;
}

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ========== BUTTONS ========== */
.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn.primary {
  background: linear-gradient(135deg, var(--accent), #c5ff41);
  color: #091105;
  box-shadow: 0 4px 15px rgba(169, 238, 22, 0);
}

.btn.primary:hover {
  box-shadow: 0 6px 25px rgba(169, 238, 22, 0.3);
}

.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--accent);
  background: rgba(169, 238, 22, 0.05);
}

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

.btn.danger:hover {
  box-shadow: 0 6px 25px rgba(255, 59, 48, 0.3);
}

/* ========== STATS ========== */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.stat {
  background: #0f1013;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  transition: all 0.3s ease;
}

.stat:hover {
  transform: translateY(-2px);
  border-color: rgba(169, 238, 22, 0.2);
}

.stat.updated {
  animation: statPulse 0.6s ease-out;
  border-color: var(--accent);
}

@keyframes statPulse {
  0% { box-shadow: 0 0 0 0 rgba(169, 238, 22, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(169, 238, 22, 0); }
  100% { box-shadow: 0 0 0 0 rgba(169, 238, 22, 0); }
}

.stat .k {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat .v {
  font-size: 20px;
  font-weight: 700;
}

/* ========== BRAND SELECTOR ========== */
.brand-selector {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.brand-btn {
  padding: 12px 24px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.brand-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.brand-btn.active {
  border-color: var(--accent);
  background: rgba(169, 238, 22, 0.1);
}

.brand-btn.active::after {
  content: '✓';
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--accent);
  color: #000;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

.brand-indicator {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: 12px;
  margin-left: 8px;
}

.brand-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.brand-checkbox:hover {
  background: rgba(169, 238, 22, 0.05);
  border-color: var(--accent);
}

.brand-checkbox input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.brand-tag {
  display: inline-block;
  padding: 4px 8px;
  margin: 2px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.brand-tag.matadorbet { background: #ff0000; color: #fff; }
.brand-tag.fixbet { background: #00ff00; color: #000; }
.brand-tag.zbahis { background: #0066ff; color: #fff; }
.brand-tag.email { background: linear-gradient(135deg, #ff6b35, #f7931e); color: #fff; }
.brand-tag.sms { background: linear-gradient(135deg, #4ecdc4, #44a08d); color: #fff; }

/* ========== TABS ========== */
.tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.tab:hover {
  background: rgba(169, 238, 22, 0.05);
  border-color: rgba(169, 238, 22, 0.3);
}

.tab.active {
  background: #0f1013;
  border-color: var(--accent);
  color: var(--accent);
}

/* ========== TABLES ========== */
table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
  background: linear-gradient(135deg, var(--panel), rgba(255, 255, 255, 0.02));
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}

tbody tr {
  background: var(--panel);
  transition: all 0.2s ease;
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
  background: rgba(169, 238, 22, 0.05);
}

td .mini {
  font-size: 12px;
  color: var(--muted);
}

/* ========== STATUS BADGES ========== */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.admin { background: linear-gradient(135deg, var(--accent), #c5ff41); color: #000; }
.status-badge.operator { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; }
.status-badge.success { background: var(--success); color: #fff; }
.status-badge.danger { background: var(--danger); color: #fff; }
.status-badge.warning { background: var(--warning); color: #000; }

/* ========== LOADING ========== */
#loading {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

#loading.show {
  display: flex;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(169, 238, 22, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#loadingMsg {
  color: var(--text);
  margin-top: 16px;
  text-align: center;
  font-size: 14px;
}

/* ========== TOAST ========== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 260px;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  transform: translateX(400px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 9999;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

/* ========== SKELETON LOADING ========== */
.skeleton {
  background: linear-gradient(90deg, #0f1013 0px, #1a1b1f 50px, #0f1013 100px);
  background-size: 200px 100%;
  animation: skeleton 1.2s ease-in-out infinite;
  border-radius: 8px;
}

.skeleton-text {
  display: inline-block;
  height: 16px;
  width: 80px;
  background: linear-gradient(90deg, #0f1013 0px, #1a1b1f 50px, #0f1013 100px);
  background-size: 200px 100%;
  animation: skeleton 1.2s ease-in-out infinite;
  border-radius: 4px;
}

@keyframes skeleton {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

/* ========== MODAL ========== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== UTILITIES ========== */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

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

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

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

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ========== CONFETTI ========== */
@keyframes confettiFall {
  to {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* ========== HUB BUTTON ========== */
.hub-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(240, 147, 251, 0.3);
}

.hub-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(240, 147, 251, 0.4);
}

@media (max-width: 768px) {
  .hub-text {
    display: none;
  }
}

/* ========== SMS BUTTON ========== */
.sms-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.sms-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(78, 205, 196, 0.4);
}

@media (max-width: 768px) {
  .sms-text {
    display: none;
  }
}

/* ========== EMAIL BUILDER BUTTON ========== */
.builder-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.builder-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.builder-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
}

.builder-btn:hover::before {
  left: 100%;
}

.builder-icon {
  font-size: 16px;
  animation: float 2s ease-in-out infinite;
}

@media (max-width: 768px) {
  .builder-text {
    display: none;
  }
  
  .builder-btn {
    padding: 8px 10px;
  }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  .header-row {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .brand-selector {
    justify-content: flex-start;
  }
  
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 8px;
  }
  
  .tab {
    white-space: nowrap;
  }
}
