/* Google Fonts - Inter Fontu */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap");

/* --- 1. DEĞİŞKENLER VE TEMALAR --- */
:root {
  /* Aydınlık Tema Renkleri */
  --bg-color: #f0f2f5;
  --text-color: #333333;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --primary-color: #007bff;
  --hover-color: rgba(0, 123, 255, 0.1);
}

body.dark-theme {
  /* Karanlık Tema Renkleri */
  --bg-color: #121212;
  --text-color: #e0e0e0;
  --glass-bg: rgba(30, 30, 30, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
  --primary-color: #4da3ff;
  --hover-color: rgba(77, 163, 255, 0.15);
}

/* --- 2. TEMEL SIFIRLAMALAR (RESET) --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
  /* Hafif bir arka plan deseni/degrade */
  background-image: linear-gradient(
    135deg,
    var(--bg-color) 0%,
    rgba(0, 123, 255, 0.05) 100%
  );
  min-height: 100vh;
}

/* --- 3. ORTAK SINIFLAR (UTILITIES) --- */
/* Glassmorphism Sınıfı */
.glass-effect {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.app-container {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* --- 4. SOL MENÜ (SIDEBAR) --- */
.sidebar {
  width: 250px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--glass-border);
  z-index: 50;
}

.logo {
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
  color: var(--primary-color);
}

/* Yan Menü Yükleme Butonu */
.upload-btn {
  background: white;
  color: #333;
  border: none;
  padding: 12px 20px;
  border-radius: 25px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 30px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.dark-theme .upload-btn {
  background: var(--primary-color);
  color: white;
}

.upload-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.nav-links {
  list-style: none;
}

.nav-links li {
  margin-bottom: 5px;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-color);
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 15px;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-weight: 500;
}

.nav-links li.active a,
.nav-links a:hover {
  background: var(--hover-color);
  color: var(--primary-color);
}

/* --- 5. ANA İÇERİK ALANI --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

/* Üst Başlık & Arama */
.top-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 30px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.search-bar {
  display: flex;
  align-items: center;
  background: var(--glass-bg);
  padding: 10px 15px;
  border-radius: 20px;
  width: 50%;
  border: 1px solid var(--glass-border);
}

.search-bar input {
  border: none;
  background: transparent;
  outline: none;
  margin-left: 10px;
  width: 100%;
  color: var(--text-color);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-color);
  cursor: pointer;
  transition: color 0.2s;
}

.icon-btn:hover {
  color: var(--primary-color);
}

.profile-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

/* Dosya & Klasör Listeleme Alanı */
.content-area {
  padding: 30px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 20px;
  margin-top: 30px;
}

h2:first-child {
  margin-top: 0;
}

.quick-access-grid,
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.card {
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s;
}

.card:hover {
  transform: translateY(-5px);
}

.file-icon {
  font-size: 40px;
  margin-bottom: 15px;
}

/* Dosya Tipi Renkleri */
.pdf-color {
  color: #e2574c;
}
.img-color {
  color: #f4b400;
}
.doc-color {
  color: #4285f4;
}

.file-name {
  font-size: 14px;
  font-weight: 500;
  /* 2 Satırda Kesme (Line Clamp) Özellikleri */
  display: -webkit-box;
  -webkit-line-clamp: 2; /* Kaç satırda kesileceğini belirler */
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis; /* Sonuna ... koyar */
  word-break: break-word; /* Çok uzun kelimeleri alt satıra atar */
  line-height: 1.4; /* Satır aralığını biraz açarak okunabilirliği artırır */
  max-height: 2.8em; /* line-height * 2 satır */
}

.folder-card {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
/* Klasör kartlarının içindeki metinler için de aynı özellikler */
.folder-card span {
  flex: 1; /* İkonu ezmemesi için kalan alanı kaplamasını sağlar */

  /* 2 Satırda Kesme (Line Clamp) Özellikleri */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  line-height: 1.4;
  max-height: 2.8em;
}

.folder-card:hover {
  background: var(--hover-color);
}

.folder-icon {
  color: #8f8f8f;
  font-size: 24px;
}

/* --- 6. YÜKLEME BİLDİRİMİ (TOAST) --- */
.upload-toast {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  width: 320px;
  padding: 15px;
  border-radius: 12px;
  transition: bottom 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1000;
}

.upload-toast.show {
  bottom: 20px;
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 15px;
}

.toast-content i {
  font-size: 24px;
  color: var(--primary-color);
}

.status-info {
  flex: 1;
  overflow: hidden;
}

#upload-filename {
  font-size: 13px;
  display: block;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.dark-theme .progress-bar {
  background: rgba(255, 255, 255, 0.1);
}

#progress-fill {
  width: 0%;
  height: 100%;
  background: var(--primary-color);
  transition:
    width 0.3s ease,
    background-color 0.3s ease;
}

/* --- 7. YÜKLEME ÖNCESİ DÜZENLEME MODALI --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(3px);
  display: none; /* JS ile .active eklendiğinde açılır */
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  border-radius: 20px;
  padding: 25px;
  animation: slideUp 0.3s ease-out;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.file-list {
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-right: 5px;
}

/* Scrollbar Düzenlemesi */
.file-list::-webkit-scrollbar {
  width: 6px;
}
.file-list::-webkit-scrollbar-track {
  background: transparent;
}
.file-list::-webkit-scrollbar-thumb {
  background: rgba(150, 150, 150, 0.3);
  border-radius: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px;
  border-bottom: 1px solid var(--glass-border);
  animation: fadeIn 0.2s ease-in;
}

.file-item:last-child {
  border-bottom: none;
}

.file-item-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  overflow: hidden;
}

.file-item-info i {
  font-size: 20px;
  color: var(--primary-color);
}

.file-item-info span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-info small {
  color: #888;
  margin-left: 5px;
}

.remove-file {
  color: #e2574c;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s;
}

.remove-file:hover {
  transform: scale(1.2);
}

.modal-footer {
  display: flex;
  gap: 10px;
}

.start-upload-btn {
  flex: 2;
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.start-upload-btn:hover {
  background: #0062cc;
}

.add-more-btn {
  flex: 1;
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
  padding: 12px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.add-more-btn:hover {
  background: var(--hover-color);
}

/* Animasyonlar */
@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* --- 8. MOBİL YÜZEN BUTON (FAB) --- */
.fab-upload {
  display: none;
  position: fixed;
  bottom: 85px; /* Alt barın üstünde durması için */
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  font-size: 24px;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 101;
  cursor: pointer;
}

/* --- 9. MOBİL UYUMLULUK (RESPONSIVE) --- */
@media (max-width: 768px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;
    padding: 10px;
    order: 2; /* Menüyü alta alır */
    position: fixed;
    bottom: 0;
    border-right: none;
    border-top: 1px solid var(--glass-border);
  }

  .logo,
  .sidebar .upload-btn {
    display: none; /* Mobilde logoyu ve büyük yükle butonunu gizle */
  }

  .nav-links {
    display: flex;
    width: 100%;
    justify-content: space-around;
  }

  .nav-links li {
    margin-bottom: 0;
  }

  .nav-links a {
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    font-size: 12px;
    border-radius: 12px;
  }

  .main-content {
    order: 1;
    padding-bottom: 70px; /* Alt menü için boşluk bırak */
  }

  .top-header {
    padding: 15px;
  }

  .search-bar {
    width: 65%;
  }

  .fab-upload {
    display: flex; /* Mobilde yüzen butonu göster */
  }

  .upload-toast.show {
    bottom: 80px; /* Mobilde alt menünün üstünde çıksın */
  }
}
/* --- 10. SÜRÜKLE-BIRAK (DRAG & DROP) KATMANI --- */
.drag-drop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(
    var(--primary-color-rgb, 0, 123, 255),
    0.2
  ); /* Temaya uygun hafif renk */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none; /* Tıklamaları engellememesi için */
  transition: opacity 0.3s ease;
}

.drag-drop-overlay.active {
  opacity: 1;
}

.drag-content {
  text-align: center;
  color: var(--primary-color);
  background: var(--glass-bg);
  padding: 40px 60px;
  border-radius: 20px;
  border: 2px dashed var(--primary-color);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.drag-drop-overlay.active .drag-content {
  transform: scale(1);
  animation: pulseBorder 2s infinite;
}

.drag-content i {
  font-size: 60px;
  margin-bottom: 20px;
}

.drag-content h2 {
  font-size: 24px;
  margin: 0 0 10px 0;
  color: var(--text-color);
}

.drag-content p {
  color: #666;
  font-size: 14px;
}

.dark-theme .drag-content p {
  color: #aaa;
}

@keyframes pulseBorder {
  0% {
    border-color: rgba(var(--primary-color-rgb, 0, 123, 255), 1);
  }
  50% {
    border-color: rgba(var(--primary-color-rgb, 0, 123, 255), 0.4);
  }
  100% {
    border-color: rgba(var(--primary-color-rgb, 0, 123, 255), 1);
  }
}

/* --- 11. DOSYA ÖNİZLEME (PREVIEW) KATMANI --- */
.preview-content-wrapper {
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
  background: var(--bg-color);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
}

.preview-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
  font-size: 15px;
}

.preview-actions {
  display: flex;
  gap: 15px;
}

.preview-body {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #111; /* Medya içeriklerinin patlaması için siyah zemin */
  padding: 20px;
  overflow: hidden;
  min-height: 300px;
  max-height: calc(90vh - 65px);
}

.preview-body img,
.preview-body video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.preview-body audio {
  width: 100%;
  max-width: 400px;
  outline: none;
}

.preview-unsupported {
  color: #ccc;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.preview-unsupported i {
  font-size: 60px;
  color: #555;
}

.preview-unsupported h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
}

.preview-unsupported p {
  font-size: 14px;
  max-width: 300px;
  line-height: 1.5;
}
/* --- 12. LİSTE GÖRÜNÜMÜ (LIST VIEW) --- */
.list-view-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-bottom: 25px;
}

/* Sütun Başlıkları */
.list-header-row {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) 1fr 100px;
  padding: 10px 20px;
  font-weight: 600;
  color: var(--text-color);
  opacity: 0.7;
  font-size: 13px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 5px;
  gap: 15px;
}

/* Liste Satırları */
.list-row {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) 1fr 100px;
  align-items: center;
  padding: 12px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  gap: 15px;
}

.list-row:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  background: rgba(var(--primary-color-rgb, 0, 123, 255), 0.05);
}

.list-row .file-name-col {
  display: flex;
  align-items: center;
  gap: 15px;
  overflow: hidden;
}

.list-row .file-name-col i {
  font-size: 20px;
  width: 24px;
  text-align: center;
}

.list-row .file-name {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  font-size: 14px;
  display: block; /* Izgaradaki (Grid) 2 satır kısıtlamasını iptal eder */
}

.list-row .file-meta {
  font-size: 13px;
  color: var(--text-color);
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
