/* =========================================
   COMMON.CSS — Tüm Sayfalarda Paylaşılan Stiller
   ========================================= */

/* --- CSS Variables (Tema) --- */
:root {
    --bg-color: #0f172a;
    --bg-base: #020617;
    --bg-bento: rgba(15, 23, 42, 0.4);
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #b0bec5;
    --text-main: #f8fafc;
    --text-muted: #a8b2be;
    --accent-1: #3b82f6;
    --accent-2: #8b5cf6;
    --accent-purple: #8b5cf6;
    --input-bg: rgba(15, 23, 42, 0.6);
    --input-border: rgba(148, 163, 184, 0.2);
    --input-focus: #3b82f6;
    --result-bg: rgba(15, 23, 42, 0.4);
    --bg-panel: #0b0f19;
    --bg-input: #0f172a;
    --bg-dark: #0b0f19;
    --border: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-light: #f8fafc;
    --gradient-prompt: linear-gradient(135deg, #3b82f6, #8b5cf6);
    --gradient-fikir: linear-gradient(135deg, #10b981, #059669);
    --gradient-rad: linear-gradient(135deg, #f59e0b, #d97706);
    --gradient-settings: linear-gradient(135deg, #475569, #334155);
    --shadow-glow: 0 0 30px rgba(139, 92, 246, 0.15);
}

/* --- Reset --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Outfit", sans-serif;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Animations --- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

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

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.5);
    opacity: 0.5;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

/* --- Log Paneli (Terminal) --- */
.log-panel {
  position: fixed;
  top: 2rem;
  left: 2rem;
  width: 420px;
  background: rgba(10, 10, 12, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 1rem;
  height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  z-index: 5;
  font-family: "Consolas", "Courier New", monospace;
}

.log-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: #d1d5db;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.log-header svg {
  color: #9ca3af;
}

.log-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow-y: auto;
  flex: 1;
  padding-right: 0.5rem;
}

.log-content::-webkit-scrollbar {
  width: 4px;
}

.log-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.log-entry {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  line-height: 1.4;
  animation: fadeInTerminal 0.2s ease-out forwards;
  opacity: 0;
  padding: 0.2rem 0;
}

.log-entry.success .log-message {
  color: #4ade80;
}
.log-entry.warning .log-message {
  color: #facc15;
}
.log-entry.process .log-message {
  color: #60a5fa;
}
.log-entry.error .log-message {
  color: #f87171;
}

.log-time {
  color: #6b7280;
  min-width: 65px;
}

.log-message {
  flex: 1;
  word-break: break-word;
}

/* --- Modal Overlay --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(10px);
  z-index: 2000;
  display: none;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

/* --- Spinner --- */
.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(59, 130, 246, 0.3);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* --- Loading Dots --- */
.loading-animation {
  display: none;
  align-items: center;
  gap: 0.5rem;
  margin-right: 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.dot {
  width: 6px;
  height: 6px;
  background-color: var(--accent-1);
  border-radius: 50%;
  animation: pulse 1.5s infinite ease-in-out;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}
.dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* --- Score Badges --- */
.score-high {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.score-medium {
  background: rgba(234, 179, 8, 0.2);
  color: #facc15;
  border: 1px solid rgba(234, 179, 8, 0.3);
}

.score-low {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- Top Navigation Bar --- */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(56px + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(10, 10, 18, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.5rem, env(safe-area-inset-right, 0px));
  z-index: 1000;
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

.nav-brand {
  flex-shrink: 0;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.nav-logo:hover {
  opacity: 0.85;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.12);
}

.nav-link svg {
  flex-shrink: 0;
}

/* Hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 11px;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  -webkit-tap-highlight-color: transparent;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.nav-hamburger.open span:nth-child(1) {
  transform: rotate(45deg) translate(4px, 4px);
}
.nav-hamburger.open span:nth-child(2) {
  opacity: 0;
}
.nav-hamburger.open span:nth-child(3) {
  transform: rotate(-45deg) translate(4px, -4px);
}

/* Body offset for fixed nav */
body {
  padding-top: calc(56px + env(safe-area-inset-top, 0px)) !important;
}

/* --- Toast Notifications --- */
.toast {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toastSlideIn 0.3s ease forwards;
  min-width: 280px;
}

.toast-success { border-left: 3px solid #4ade80; }
.toast-success .toast-icon { color: #4ade80; }

.toast-error { border-left: 3px solid #f87171; }
.toast-error .toast-icon { color: #f87171; }

.toast-warning { border-left: 3px solid #facc15; }
.toast-warning .toast-icon { color: #facc15; }

.toast-info { border-left: 3px solid #60a5fa; }
.toast-info .toast-icon { color: #60a5fa; }

.toast-icon {
  flex-shrink: 0;
  display: flex;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

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

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

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

/* --- Onboarding Banner --- */
.onboarding-banner {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: fadeIn 0.4s ease;
}

.onboarding-banner .banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.onboarding-banner .banner-text {
  flex: 1;
}

.onboarding-banner .banner-text h4 {
  margin: 0 0 0.2rem;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.onboarding-banner .banner-text p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.onboarding-banner .banner-action {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.2s;
}

.onboarding-banner .banner-action:hover {
  transform: scale(1.05);
}

.onboarding-banner .banner-dismiss {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0 4px;
}

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

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(139, 92, 246, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.empty-state h3 {
  color: var(--text-primary);
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.empty-state p {
  font-size: 0.85rem;
  margin: 0;
  line-height: 1.5;
}

/* --- Responsive: Log Panel Gizleme --- */
@media (max-width: 1300px) {
  .log-panel {
    display: none;
  }
}

/* --- Responsive: Tablet --- */
@media (max-width: 900px) {
  .nav-link span {
    display: none;
  }
  .nav-link {
    padding: 0.5rem;
  }
}

/* --- Responsive: Mobil --- */
@media (max-width: 768px) {
  body {
    padding: calc(56px + env(safe-area-inset-top, 0px)) 0.75rem 1rem !important;
    overflow-x: hidden;
  }

  .nav-hamburger {
    display: flex;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: calc(56px + env(safe-area-inset-top, 0px));
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 18, 0.98);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 1.5rem;
    padding-bottom: env(safe-area-inset-bottom, 1rem);
    gap: 0.5rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-link {
    font-size: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav-link span {
    display: inline;
  }

  .nav-link.active {
    background: rgba(139, 92, 246, 0.2);
  }

  /* Page toolbar mobil uyumluluğu */
  .page-toolbar {
    flex-wrap: wrap !important;
    padding: 0.5rem 0.75rem !important;
    gap: 0.5rem !important;
  }

  .page-toolbar .nav-actions,
  .page-toolbar .header-actions {
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
  }

  .page-toolbar .nav-actions button,
  .page-toolbar .nav-actions .btn,
  .page-toolbar .header-actions button {
    font-size: 0.75rem !important;
    padding: 6px 10px !important;
    min-height: 36px;
  }
}

/* --- Language Toggle Flags --- */
.nav-lang-toggle {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  opacity: 0.5;
  padding: 0;
}

.nav-lang-toggle.active {
  opacity: 1;
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.2);
}

.nav-lang-toggle:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
  transform: scale(1.08);
}



/* --- RTL (Arabic) Support --- */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .top-nav {
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-brand {
  order: 3;
}

[dir="rtl"] .nav-links {
  order: 2;
  flex-direction: row-reverse;
}

[dir="rtl"] .nav-actions-right {
  order: 1;
}

[dir="rtl"] .nav-link {
  flex-direction: row-reverse;
}

/* Prevent Latin text reversal */
[dir="rtl"] p,
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4,
[dir="rtl"] span, [dir="rtl"] a, [dir="rtl"] button,
[dir="rtl"] .box-title, [dir="rtl"] .box-desc,
[dir="rtl"] .banner-text, [dir="rtl"] .banner-action,
[dir="rtl"] .nav-link span,
[dir="rtl"] .card-header, [dir="rtl"] label,
[dir="rtl"] td, [dir="rtl"] th {
  unicode-bidi: plaintext;
}

[dir="rtl"] .bento-box {
  text-align: right;
}

[dir="rtl"] .banner-left {
  flex-direction: row-reverse;
}

[dir="rtl"] .box-content {
  text-align: right;
}

[dir="rtl"] .bento-arrow {
  transform: scaleX(-1);
}

[dir="rtl"] .nav-lang-toggle {
  margin-left: 0;
  margin-right: 0.5rem;
}

[dir="rtl"] .onboarding-banner {
  flex-direction: row-reverse;
  text-align: right;
}

[dir="rtl"] .date-chip {
  flex-direction: row-reverse;
}
