:root {
  /* Varsayılan (Light) Tema */
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.95);
  --primary: #0a66c2;
  /* LinkedIn Blue */
  --accent: #e11d48;
  /* Ghost Red */
  --success: #10b981;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --border-color: rgba(0, 0, 0, 0.08);
  --shadow-card:
    0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --input-bg: #f9fafb;
  --input-border: #e5e7eb;
  --menu-bg: #ffffff;
  --sidebar-width: 280px;
}

[data-theme="dark"] {
  /* Karanlık Tema */
  --bg-body: #0f172a;
  --bg-card: #1e293b;
  --bg-header: rgba(15, 23, 42, 0.95);
  --primary: #3b82f6;
  --accent: #f43f5e;
  --success: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.05);
  --shadow-card: none;
  --input-bg: rgba(255, 255, 255, 0.05);
  --input-border: rgba(255, 255, 255, 0.1);
  --menu-bg: #1e293b;
}

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: "Outfit", sans-serif;
  padding-bottom: 90px;
  /* Mobile Nav bar için boşluk */
  overflow-x: hidden;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

/* --- LAYOUT WRAPPER (Desktop) --- */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

.main-content-area {
  flex: 1;
  width: 100%;
  max-width: 100%;
  transition: margin-left 0.3s ease;
}

/* --- DESKTOP SIDEBAR --- */
.desktop-sidebar {
  display: none;
  /* Mobilde gizli */
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1020;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

.sidebar-brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 40px;
  text-decoration: none;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 15px;
  border-radius: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
}

.sidebar-link:hover {
  background: var(--input-bg);
  color: var(--text-main);
}

.sidebar-link.active {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.sidebar-link i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

/* --- Header --- */
.app-header {
  background-color: var(--bg-header);
  backdrop-filter: blur(10px);
  padding: 15px 20px;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.logo {
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s;
}

.icon-btn:active {
  transform: scale(0.9);
}

/* --- Search Area --- */
.search-container {
  padding: 20px;
  background: var(--bg-card);
  border-bottom-left-radius: 25px;
  border-bottom-right-radius: 25px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-card);
  transition: background-color 0.3s ease;
}

.search-box {
  position: relative;
  max-width: 800px;
  /* Desktop limit */
  margin: 0 auto;
}

.search-input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 15px;
  padding: 15px 15px 15px 45px;
  color: var(--text-main);
  font-size: 1rem;
  transition: all 0.3s;
}

.search-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.paste-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: white;
  border: none;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* --- Cards --- */
.section-title {
  padding: 0 20px;
  margin-bottom: 15px;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-main);
}

.see-all {
  font-size: 0.8rem;
  color: var(--primary);
  text-decoration: none;
}

.horizontal-scroll {
  display: flex;
  overflow-x: auto;
  gap: 15px;
  padding: 0 20px 20px;
  scrollbar-width: none;
}

.horizontal-scroll::-webkit-scrollbar {
  display: none;
}

.company-card {
  min-width: 160px;
  background: var(--bg-card);
  border-radius: 16px;
  padding: 15px;
  border: 1px solid var(--border-color);
  position: relative;
  box-shadow: var(--shadow-card);
  transition: background-color 0.3s ease;
}

.ghost-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.company-logo {
  width: 40px;
  height: 40px;
  background: var(--input-bg);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: var(--text-main);
}

.company-name {
  font-weight: 600;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.rating {
  color: #fbbf24;
  font-size: 0.8rem;
}

/* --- List Items --- */
.list-container {
  padding: 0 20px;
  max-width: 1200px;
  /* Desktop Max Width */
  margin: 0 auto;
}

.note-item {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  transition: background-color 0.3s ease;
}

.note-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.note-text {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 10px;
  color: var(--text-main);
}

.tags {
  display: flex;
  gap: 8px;
}

.tag {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--input-bg);
}

.tag.ghost {
  background: rgba(244, 63, 94, 0.1);
  color: var(--accent);
}

.tag.interview {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

/* --- Bottom Nav (Mobile) --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  z-index: 1000;
  transition: background-color 0.3s ease;
}

.nav-item {
  color: var(--text-muted);
  text-align: center;
  font-size: 0.75rem;
  text-decoration: none;
  transition: color 0.3s;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 12px;
}

.nav-item:active {
  background-color: var(--input-bg);
}

.nav-item i {
  display: block;
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.nav-item.active {
  color: var(--primary);
}

/* --- Views (SPA) --- */
main.view-section {
  display: none;
  padding-top: 0;
  animation: fadeIn 0.3s ease-in-out;
}

main.view-section.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Detail View Specifics */
.detail-header {
  position: relative;
  text-align: center;
  padding: 20px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border-radius: 0 0 25px 25px;
  box-shadow: var(--shadow-card);
}

.share-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--input-bg);
  border: none;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 8px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  margin: 0 auto 15px;
  color: var(--text-main);
}

.score-circle.bad {
  border-color: var(--accent);
}

/* Leaderboard Items */
.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 15px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}

.rank-num {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-muted);
  opacity: 0.3;
  width: 40px;
}

.rank-1 .rank-num {
  color: #fbbf24;
  opacity: 1;
}

.rank-2 .rank-num {
  color: #94a3b8;
  opacity: 1;
}

.rank-3 .rank-num {
  color: #b45309;
  opacity: 1;
}

/* --- Filter Chips --- */
.filter-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 20px 15px;
  scrollbar-width: none;
}

.filter-chip {
  white-space: nowrap;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-chip.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* --- Profile Menu (Mobile Drawer) --- */
.profile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100%;
  background: var(--menu-bg);
  z-index: 1050;
  box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.profile-menu.open {
  right: 0;
}

.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  display: none;
  backdrop-filter: blur(2px);
}

.menu-overlay.open {
  display: block;
}

.menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.menu-list {
  list-style: none;
  padding: 0;
}

.menu-list li {
  margin-bottom: 15px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 15px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 1rem;
  padding: 10px;
  border-radius: 8px;
  transition: background 0.2s;
}

.menu-link:active {
  background: var(--input-bg);
}

.menu-link i {
  width: 20px;
  color: var(--text-muted);
}

/* --- Profile / Secret Key Card --- */
.secret-key-card {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  color: white;
  padding: 20px;
  border-radius: 16px;
  margin-bottom: 25px;
  position: relative;
  overflow: hidden;
}

.secret-key-card::after {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200px;
  height: 200px;
  background: var(--primary);
  filter: blur(80px);
  opacity: 0.3;
}

.key-display {
  background: rgba(255, 255, 255, 0.1);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  padding: 10px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.85rem;
  margin-top: 10px;
  text-align: center;
  letter-spacing: 1px;
  word-break: break-all;
}

.key-edit-area {
  background: rgba(0, 0, 0, 0.3);
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  display: none;
}

.key-edit-area.open {
  display: block;
}

.key-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-family: monospace;
}

/* --- Comment Modal (Bottom Sheet -> Modal on Desktop) --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 2000;
  display: none;
  backdrop-filter: blur(3px);
}

.modal-overlay.open {
  display: block;
}

.bottom-sheet {
  position: fixed;
  bottom: -100%;
  left: 0;
  width: 100%;
  background: var(--bg-card);
  border-radius: 25px 25px 0 0;
  padding: 25px;
  z-index: 2001;
  transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.2);
  max-height: 90vh;
  overflow-y: auto;
}

.bottom-sheet.open {
  bottom: 0;
}

.sheet-handle {
  width: 50px;
  height: 5px;
  background: var(--border-color);
  border-radius: 5px;
  margin: 0 auto 20px;
}

.star-rating {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.star-rating i {
  font-size: 2rem;
  color: #e5e7eb;
  cursor: pointer;
  transition: color 0.2s;
}

.star-rating i.active {
  color: #fbbf24;
}

.chip-group {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.select-chip {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  font-size: 0.9rem;
  background: var(--bg-card);
  color: var(--text-muted);
}

.select-chip.selected {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.select-chip.ghost-selected {
  border-color: var(--accent);
  background: rgba(225, 29, 72, 0.1);
  color: var(--accent);
}

/* --- Toast Notification --- */
.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  pointer-events: none;
}

.toast-msg {
  background: rgba(30, 41, 59, 0.9);
  color: white;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  margin-bottom: 10px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(4px);
}

.toast-msg.show {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================= */
/* DESKTOP RESPONSIVE            */
/* ========================================= */

@media (min-width: 992px) {
  body {
    padding-bottom: 0;
    /* Nav bar yok */
  }

  /* Sidebar'ı Göster */
  .desktop-sidebar {
    display: flex;
  }

  /* İçeriği Sağa Kaydır */
  .main-content-area {
    margin-left: var(--sidebar-width);
  }

  /* Logo'yu Header'dan gizle (Sidebar'da var) */
  .app-header .logo {
    display: none;
  }

  /* Mobildeki Hamburger menüyü gizle */
  .app-header .header-actions button[onclick="toggleMenu()"] {
    display: none;
  }

  /* Alt Navigasyonu Gizle */
  .bottom-nav {
    display: none;
  }

  /* Header'ı tam genişlikten biraz kırp (gerekirse) */
  .app-header {
    /* width: calc(100% - var(--sidebar-width)); */
    /* margin-left: var(--sidebar-width); */
    /* İsteğe bağlı, yukarıdaki main-content içinde olduğu için otomatik oturur */
  }

  /* Search Area - Daha kompakt */
  .search-container {
    border-radius: 25px;
    margin: 20px;
  }

  /* Kartlar ve Liste için Konteyner */
  .list-container {
    padding: 0 40px;
  }

  /* Recent Notes - Left Align on Desktop */
  #recent-notes {
    margin: 0;
    max-width: 100%;
  }

  /* Horizontal Scroll -> Grid */
  .horizontal-scroll {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    overflow: visible;
    padding-bottom: 0;
  }

  .company-card {
    margin-bottom: 20px;
  }

  /* İstatistikler Grid */
  #stats-view .row .col-6 {
    width: 50%;
    /* Bootstrap grid */
  }

  /* Detail Header */
  .detail-header {
    margin: 0 20px 20px;
    border-radius: 25px;
  }

  /* --- MODAL (Desktop Style) --- */
  .bottom-sheet {
    width: 500px;
    left: 50%;
    transform: translateX(-50%);
    bottom: 50%;
    /* Ortala */
    top: 50%;
    height: auto;
    max-height: 85vh;
    border-radius: 20px;
    transition:
      opacity 0.3s ease,
      transform 0.3s ease;
    opacity: 0;
    pointer-events: none;
    /* Bottom sheet animasyonunu ez */
    display: block;
  }

  .bottom-sheet.open {
    bottom: auto;
    transform: translate(-50%, -50%);
    opacity: 1;
    pointer-events: all;
  }

  .sheet-handle {
    display: none;
    /* Handle gerek yok */
  }
}

/* --- Bootstrap Overrides for Theme Support --- */
.text-muted {
  color: var(--text-muted) !important;
}

.text-body {
  color: var(--text-main) !important;
}

/* Ensure headings and other text elements use the main text color by default if not specified */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-main);
}