/* =========================================
   Modern Minimalist Dark Theme
   Kartun Audio Indonesia WEB-DL Files
   ========================================= */

:root {
  --bg-base: #0f141a;
  --bg-surface: #1b2230;
  --bg-hover: #212a3a;
  --accent: #60a5f5;
  --accent-hover: #8ec7ff;
  --text-primary: #e6edf3;
  --text-secondary: #9ca3af;
  --border: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.03);
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ========== HEADER ========== */

.header {
  background: linear-gradient(135deg, #0f141a 0%, #1a2130 100%);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.header-title {
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.header-title-link {
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition);
  display: block;
}

.header-title-link:hover {
  color: var(--accent);
}

.header-subtitle {
  font-size: 0.825rem;
  color: var(--text-secondary);
  font-weight: 400;
  letter-spacing: 0.3px;
  margin-top: 0.25rem;
}

.header-controls {
  flex: 1;
  max-width: 340px;
}

.search-box {
  display: flex;
  gap: 0.5rem;
}

.search-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.625rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.1);
}

.search-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.625rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* ========== BREADCRUMB ========== */

.breadcrumb {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 0;
}

.breadcrumb-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.breadcrumb ol {
  display: flex;
  list-style: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
}

.breadcrumb-item::after {
  content: "/";
  margin-left: 0.5rem;
  color: var(--text-secondary);
}

.breadcrumb-item:last-child::after {
  display: none;
}

.breadcrumb-item a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

.breadcrumb-item a:hover {
  color: var(--accent-hover);
}

.breadcrumb-item.active {
  color: var(--text-secondary);
}

/* ========== MAIN CONTENT ========== */

.main {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

/* ========== FILE LIST TABLE ========== */

.file-list {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.2);
  animation: fadeIn 300ms ease-out;
  max-width: 1400px;
  margin: 0 auto;
}

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

.file-list-header {
  display: grid;
  grid-template-columns: 1fr 180px 120px 80px;
  gap: 1rem;
  background: rgba(20, 24, 41, 0.8);
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

.file-list-body {
  display: flex;
  flex-direction: column;
}

.file-item {
  display: grid;
  grid-template-columns: 1fr 180px 120px 80px;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
  transition: background var(--transition);
  animation: slideIn 280ms ease-out both;
}

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

.file-item:hover {
  background: var(--bg-hover);
  border-left: 3px solid var(--accent);
  padding-left: calc(1.5rem - 3px);
}

.file-item:last-child {
  border-bottom: none;
}

.file-name {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.file-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.875rem;
}

.icon-folder {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
}

.icon-file {
  background: rgba(100, 181, 246, 0.12);
  color: var(--accent);
}

.file-name-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
  transition: color var(--transition);
}

.file-item:hover .file-name-text {
  color: var(--accent);
}

.folder-link {
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition);
}

.folder-link:hover {
  color: var(--accent);
}

.file-date, .file-size {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.file-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.file-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
  font-size: 0.875rem;
}

.file-btn:hover {
  background: rgba(100, 181, 246, 0.12);
  color: var(--accent);
  transform: translateY(-2px);
}

.file-btn-download:hover {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
}

.file-btn-copy:hover {
  background: rgba(100, 181, 246, 0.12);
  color: var(--accent);
}

.file-btn-preview:hover {
  background: rgba(139, 92, 246, 0.12);
  color: #c084fc;
}

/* ========== TOAST ========== */

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #10b981;
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transform: translateY(200px);
  opacity: 0;
  transition: all var(--transition);
  z-index: 1000;
  pointer-events: none;
}

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

.toast-error {
  background: #ef4444;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.toast i {
  flex-shrink: 0;
  font-size: 1rem;
}

/* ========== Preview Modal ========== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1rem;
}

.modal-content-custom {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 90vw;
  max-height: 90vh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  z-index: 10;
}

.modal-close:hover {
  color: var(--text-primary);
  transform: scale(1.1);
}

.modal-body-custom {
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  flex: 1;
}

.modal-body-custom img {
  max-width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  display: block;
}

.modal-body-custom video {
  width: 100%;
  max-height: 70vh;
  border-radius: 8px;
  outline: none;
}

.modal-footer-custom {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  text-align: right;
}

.modal-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}

.modal-download-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* ========== LOADING ========== */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  text-align: center;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.loading p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ========== ERROR ========== */

.error {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  color: #fca5a5;
  margin-bottom: 1.5rem;
}

.error i {
  flex-shrink: 0;
  font-size: 1.25rem;
}

.error p {
  margin: 0;
}

/* ========== EMPTY STATE ========== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1.5rem;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state p {
  margin: 0;
}

/* ========== PAGINATION ========== */

.pagination {
  display: flex;
  justify-content: center;
  padding: 2rem 1.5rem;
}

.load-more-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.load-more-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(100, 181, 246, 0.3);
}

/* ========== FOOTER ========== */

.footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

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

@media (max-width: 1024px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .header-controls {
    max-width: 100%;
  }

  .file-list-header, .file-item {
    grid-template-columns: 1.5fr 140px 100px 60px;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .file-list-header {
    font-size: 0.7rem;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 1rem 0;
  }

  .header-content {
    padding: 0 1rem;
    gap: 0.75rem;
  }

  .header-title {
    font-size: 1.125rem;
  }

  .search-box {
    flex-direction: row;
  }

  .search-input {
    min-width: 0;
    flex: 1;
  }

  .search-btn {
    flex-shrink: 0;
  }

  .file-list-header {
    display: none;
  }

  .file-item {
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    align-items: center;
  }

  .file-date, .file-size {
    display: none;
  }

  .file-actions {
    justify-content: flex-end;
  }

  .main {
    padding: 1rem;
  }

  .file-list {
    border-radius: 8px;
  }
}
