/* ============================================================
   ArmoniFM Admin Panel — Stil Dosyası
   Sürüm: 2.0.0
   Mimari: CSS Custom Properties + BEM + Dark Theme
   ============================================================ */

/* ----------------------------------------------------------
   1. Tasarım Token'ları
   ---------------------------------------------------------- */
:root {
  --color-bg: #0b0f19;
  --color-bg-secondary: #111827;
  --color-bg-tertiary: #1a2235;
  --color-bg-hover: #1f2a40;
  --color-surface: #151d2e;
  --color-border: rgba(255, 255, 255, 0.06);
  --color-border-focus: rgba(99, 102, 241, 0.4);

  --color-text: #e5e7eb;
  --color-text-secondary: #9ca3af;
  --color-text-muted: #6b7280;
  --color-text-inverse: #0b0f19;

  --color-primary: #6366f1;
  --color-primary-hover: #818cf8;
  --color-primary-active: #4f46e5;
  --color-primary-bg: rgba(99, 102, 241, 0.1);

  --color-success: #22c55e;
  --color-success-bg: rgba(34, 197, 94, 0.1);
  --color-error: #ef4444;
  --color-error-bg: rgba(239, 68, 68, 0.1);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-info: #06b6d4;
  --color-info-bg: rgba(6, 182, 212, 0.1);

  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.8125rem;
  --font-size-base: 0.875rem;
  --font-size-lg: 1rem;
  --font-size-xl: 1.125rem;
  --font-size-2xl: 1.25rem;
  --font-size-3xl: 1.5rem;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.18);

  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  --sidebar-width: 260px;
  --header-height: 60px;
}

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

html { scroll-behavior: smooth; }

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

::selection {
  background: rgba(99, 102, 241, 0.3);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.18); }

/* ----------------------------------------------------------
   3. Giriş Ekranı
   ---------------------------------------------------------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background:
    radial-gradient(800px 500px at 20% 20%, rgba(99, 102, 241, 0.06), transparent 60%),
    radial-gradient(700px 400px at 80% 80%, rgba(59, 130, 246, 0.05), transparent 60%),
    var(--color-bg);
}

.auth-screen.hidden { display: none; }

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-logo {
  margin-bottom: var(--space-6);
}

.auth-logo img {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-glow);
}

.auth-card h1 {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

.auth-subtitle {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
}

.auth-form {
  text-align: left;
}

.auth-form .form-group {
  margin-bottom: var(--space-5);
}

.auth-form label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--space-2);
}

.input-wrapper {
  position: relative;
}

.input-wrapper input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  padding-right: 44px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
}

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

.toggle-password {
  position: absolute;
  right: var(--space-2);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--font-size-lg);
  line-height: 1;
}

.toggle-password:hover {
  color: var(--color-text);
}

.auth-message {
  margin-top: var(--space-4);
  font-size: var(--font-size-sm);
  min-height: 20px;
}

.auth-message:not(:empty) {
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ----------------------------------------------------------
   4. Admin Header
   ---------------------------------------------------------- */
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-6);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
}

.header-left h1 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
}

.header-accent {
  color: var(--color-primary);
  font-weight: 700;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-status {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-status--success { color: var(--color-success); }
.header-status--saving  { color: var(--color-warning); }
.header-status--error   { color: var(--color-error); }

/* ----------------------------------------------------------
   5. Ana İçerik Alanı
   ---------------------------------------------------------- */
.edit-screen {
  min-height: 100vh;
  background: var(--color-bg);
}

.edit-screen.hidden { display: none; }

.admin-main {
  max-width: 900px;
  margin: 0 auto;
  padding: var(--space-6);
  padding-bottom: var(--space-16);
}

/* ----------------------------------------------------------
   6. Sekme (Tab) Navigasyonu
   ---------------------------------------------------------- */
.tab-nav {
  display: flex;
  gap: var(--space-1);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-1);
  margin-bottom: var(--space-6);
}

.tab-btn {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--color-text);
  background: var(--color-bg-hover);
}

.tab-btn.active {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  display: none;
  animation: fadeSlideIn 0.25s ease;
}

.tab-panel.active {
  display: block;
}

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

/* ----------------------------------------------------------
   7. Kart Bileşeni
   ---------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.1);
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border);
}

.card-header h2 {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.card-desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.card-body {
  padding: var(--space-6);
}

/* ----------------------------------------------------------
   8. Form Elemanları
   ---------------------------------------------------------- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
  position: relative;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-group label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.char-count {
  font-size: var(--font-size-xs);
  font-weight: 400;
  color: var(--color-text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-fast);
}

input:hover,
textarea:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-bg);
  background: var(--color-bg-secondary);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.5;
}

input.input--error,
textarea.input--error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 3px var(--color-error-bg);
}

.form-error-msg {
  font-size: var(--font-size-xs);
  color: var(--color-error);
  display: none;
}

.form-error-msg.visible {
  display: block;
}

/* ----------------------------------------------------------
   9. Önizleme (Marquee Preview)
   ---------------------------------------------------------- */
.marquee-preview {
  padding: var(--space-4);
  background: var(--color-bg);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  white-space: nowrap;
}

.marquee-preview span {
  display: inline-block;
  font-weight: 600;
  font-size: var(--font-size-lg);
  color: var(--color-primary);
  animation: marquee 12s linear infinite;
}

@keyframes marquee {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* ----------------------------------------------------------
   10. Butonlar
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-family);
  font-weight: 500;
  font-size: var(--font-size-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-full { width: 100%; }
.btn-lg { padding: var(--space-4) var(--space-8); font-size: var(--font-size-base); }
.btn-sm { padding: var(--space-2) var(--space-4); font-size: var(--font-size-xs); }

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

.btn-outline:hover {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--color-text);
  background: var(--color-bg-hover);
}

/* Spinner */
.btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.btn-spinner.hidden { display: none; }

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

/* ----------------------------------------------------------
   11. Kaydetme Çubuğu
   ---------------------------------------------------------- */
.save-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-6);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-top: var(--space-4);
  position: sticky;
  bottom: var(--space-6);
}

.csrf-token { display: none; }

/* ----------------------------------------------------------
   12. Toast Bildirimleri
   ---------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + var(--space-4));
  right: var(--space-4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 380px;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  cursor: pointer;
}

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

.toast--leaving {
  animation: toastOut 0.2s ease forwards;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(100%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(100%); }
}

/* ----------------------------------------------------------
   13. Responsive
   ---------------------------------------------------------- */
@media (max-width: 767px) {
  .auth-card {
    padding: var(--space-6);
  }

  .admin-main {
    padding: var(--space-4);
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .card-header {
    padding: var(--space-4);
  }

  .card-body {
    padding: var(--space-4);
  }

  .tab-nav {
    flex-direction: column;
    gap: var(--space-1);
  }

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

  .save-bar {
    flex-direction: column;
    padding: var(--space-4);
  }

  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
    max-width: none;
  }
}

@media (max-width: 399px) {
  .header-left h1 {
    font-size: var(--font-size-base);
  }

  .header-logo {
    width: 28px;
    height: 28px;
  }
}

/* ----------------------------------------------------------
   14. Yardımcı Sınıflar
   ---------------------------------------------------------- */
.hidden { display: none !important; }

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