/* static/css/cards.css */

/* Basic reset-ish */

:root {
  --thumb-size: 100px; /* master size for both thumbnail types */
  --thumb-radius: 14px;
}


*,
*::before,
*::after {
  box-sizing: border-box;
}

body.dl-body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #1e293b, #020617);
  color: #e5e7eb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* Header */



/* Main layout */
.dl-main {
  padding: 24px;
  max-width: min(1600px, 95vw);
  margin: 0 auto 40px;
}

/* Empty state */
.dl-empty {
  background: rgba(15,23,42,0.85);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 45px rgba(0,0,0,0.65);
}

/* Grid of file cards */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

/* File card */
.file-card {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
  overflow: hidden;
  isolation: isolate;
  transform: translateY(0);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
  background: linear-gradient(-30deg, rgba(30,64,175,0.14), rgba(15,23,42,0.9));
  border: 1px solid rgba(148,163,184,0.45);
  box-shadow:
    0 14px 40px rgba(15,23,42,0.85),
    inset 0 0 0 1px rgba(15,23,42,0.6);
}

.file-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at top left, rgba(248,250,252,0.12), transparent 50%),
    radial-gradient(circle at bottom right, rgba(56,189,248,0.12), transparent 50%);
  opacity: 0.55;
  z-index: -1;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.file-card-inner {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  align-items: center;
}

/* Icon area */
.file-icon {
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: var(--thumb-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, rgba(248,250,252,0.95), rgba(148,163,184,0.3));
  box-shadow:
    0 8px 20px rgba(15,23,42,0.95),
    inset 0 0 0 1px rgba(15,23,42,0.4);
  flex-shrink: 0;
  overflow: hidden;
}


.thumb-img {
  width: var(--thumb-size);
  height: var(--thumb-size);
  object-fit: cover;
  border-radius: var(--thumb-radius);
}

.file-ext {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: #0f172a;
}

/* Info area */
.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: #e5e7eb;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  margin-bottom: 3px;
}

.file-meta {
  font-size: 0.78rem;
  color: #9ca3af;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Hover */
.file-card:hover {

  border-color: rgba(129,140,248,0.9);
  box-shadow:
    0 18px 50px rgba(15,23,42,0.98),
    0 0 0 1px rgba(129,140,248,0.7);
}

.file-card:hover::before {
  opacity: 1;
  transform: scale(1.02);
}

    .nav-links a {
      margin-right: 20px;
      text-decoration: none;
      color: #9ca3af;
      font-size: 0.95rem;
    }
    .nav-links a:hover {
      color: #fff;
    }


  /* =======================================================
     GHOST CARDS (Incomplete uploads)
     ======================================================= */

  .ghost-card {
    position: relative;
    display: block;
    padding: 14px;
    border-radius: 18px;
    background: rgba(15,23,42,0.8);
    backdrop-filter: blur(4px);
    border: 1px dashed rgba(148,163,184,0.6);
    box-shadow:
      0 10px 28px rgba(15,23,42,0.7),
      inset 0 0 0 1px rgba(15,23,42,0.6);
    opacity: 0.8;          /* ghosty */
    pointer-events: auto;  /* clickable */
    margin-bottom: 18px; /* match .file-grid gap */
        isolation: isolate;
    z-index: 1;
  }

  .ghost-card:hover {
    opacity: 1;
    border-color: rgba(129,140,248,0.8);
  }

  .ghost-card-inner {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  /* icon */
  .ghost-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: radial-gradient(circle at top,
                rgba(255,255,255,0.75),
                rgba(148,163,184,0.3));
    color: #0f172a;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow:
      0 8px 20px rgba(15,23,42,0.9),
      inset 0 0 0 1px rgba(15,23,42,0.45);
  }

  /* info */
  .ghost-info {
    flex: 1;
    min-width: 0;
  }

  .ghost-name {
    font-size: 0.95rem;
    font-weight: 500;
    color: #e5e7eb;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .ghost-meta {
    font-size: 0.78rem;
    color: #9ca3af;
    margin-top: 2px;
  }

  /* progress bar */
  .ghost-progress {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: rgba(15,23,42,0.9);
    border: 1px solid rgba(148,163,184,0.55);
    overflow: hidden;
    margin-top: 6px;
  }

  .ghost-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #818cf8, #4f46e5);
    width: 0%;
    transition: width 0.15s linear;
  }

  /* delete button */
  .ghost-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
  }

  .ghost-delete-btn {
    background: #b91c1c;
    color: white;
    font-size: 0.78rem;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.4);
    cursor: pointer;
    transition: 0.15s;
    pointer-events:auto;

  }

  .ghost-delete-btn:hover {
    background: #dc2626;
    border-color: #7f1d1d;
  }


/* --------------------------------------------------------
   Action buttons for file cards
   -------------------------------------------------------- */

/* ----------------------------------------------
   Unified action button styling (SVG buttons)
   ---------------------------------------------- */

.file-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 6px;
  z-index: 30;
}

/* ==========================================================
   DARK THEME ACTION BUTTONS  (Download / Rename / Delete)
   ========================================================== */

.action-btn {
  background: linear-gradient(180deg, rgba(30,41,59,0.9), rgba(15,23,42,0.95));
  border-radius: 4px;
  padding: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0px solid rgba(51,65,85,0.7);
  box-shadow:
      0 4px 12px rgba(0,0,0,0.55),
      inset 0 0 0 1px rgba(148,163,184,0.15);
  cursor: pointer;
  transition: 0.18s ease;
}

.action-btn svg,
.action-btn img {
  width: 16px;
  height: 16px;
  fill: #78d5e1; /* default icon color */
  pointer-events: none;

}

/* Hover: gentle blue glow */
.action-btn:hover {
  background: linear-gradient(180deg, rgba(40,60,85,0.95), rgba(17,24,39,1));
  border-color: rgba(129,140,248,0.7);
  box-shadow:
      0 6px 16px rgba(0,0,0,0.65),
      0 0 8px rgba(129,140,248,0.4);
}

/* Keep icon same color — no inversion */
.action-btn:hover img,
.action-btn:hover svg {
  fill: #e2e8f0; /* slate-200 */
}

/* Variant accents if you want them */

.action-download:hover {
  border-color: rgba(59,130,246,0.6);  /* blue-500 */
}

.action-rename:hover {
  border-color: rgba(245,158,11,0.6);  /* amber-500 */
}

/* Delete button variant */
.action-delete svg {
  fill: #dc2626; /* red-600 */
}

/* Optional: stronger red on hover */
.action-delete:hover svg {
  fill: #ef4444; /* red-500 */
}

/* Keep border hover stable (indigo or change to red if preferred) */
.action-delete:hover {
  border-color: rgba(239,68,68,0.7); /* make border red on hover */
  box-shadow:
      0 6px 16px rgba(0,0,0,0.65),
      0 0 8px rgba(239,68,68,0.4); /* soft red glow */
}


.file-type-icon {
  width: var(--thumb-size);
  height: var(--thumb-size);
  border-radius: var(--thumb-radius);
  background: linear-gradient(160deg,
                              rgba(255,255,255,0.09),
                              rgba(255,255,255,0.03));
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: calc(var(--thumb-size) * 0.28);
  font-weight:700;
  color:#e5e7eb;
  text-shadow:0 0 12px rgba(0,0,0,0.4);
  user-select:none;
    /* 🔥 Add these */
  padding: 0 8px;            /* ensure text doesn’t touch edge */
  word-break: break-word;    /* allow long text to wrap */
  text-align: center;        /* center wrapped text */
  line-height: 1.05;         /* tighten wrapping */
  overflow: hidden;          /* prevent spill over */
}


.file-card.file-type-folder .file-icon,
.folder-icon {
  background: radial-gradient(circle at top, rgba(254,240,138,0.85), rgba(234,179,8,0.35));
  font-size: 1.4rem !important;
  color: #0f172a;
}

.file-card.folder-drop-target {
    outline: 2px dashed #4f46e5;
    outline-offset: 3px;
    filter: brightness(1.2);
}

#toast-container {
    position: fixed;
    bottom: 22px;
    right: 22px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    min-width: 240px;
    max-width: 340px;
    padding: 14px 18px;
    background: rgba(15, 23, 42, 0.92);
    color: #e5e7eb;
    border: 1px solid rgba(148,163,184,0.4);
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.55);
    font-size: 0.9rem;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

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

.toast-success {
    border-left: 4px solid #22c55e;
}

.toast-error {
    border-left: 4px solid #ef4444;
}


/* ========================
   MOVE MODE
   ======================== */

/* All cards dim slightly */
body.move-mode .file-card {
    opacity: 0.45;
    transition:
        opacity 0.15s ease,
        box-shadow 0.18s ease,
        transform 0.15s ease;
}


/* All cards dim slightly */
body.move-mode .file-card:hover {
    opacity: 1;
    transition: opacity 0.15s, box-shadow 0.2s;
}

/* Selected source files/folders: strong blue glow */
body.move-mode .file-card.file-selected {
    opacity: 1 !important;
    box-shadow:
        0 0 0 2px rgba(59,130,246,0.95),
        0 0 22px rgba(59,130,246,0.85),
        0 18px 50px rgba(15,23,42,0.98);
    transform: translateY(-2px);
}

.folder-card.folder-selectable,
.folder-card.folder-drop-target {
    opacity: 1 !important;
    box-shadow:
        0 0 0 3px rgba(34,197,94,0.9),
        0 0 22px rgba(34,197,94,0.85),
        0 18px 50px rgba(15,23,42,0.98);
    transform: translateY(-2px);
}


/* In move mode, hide per-card action buttons (download / rename / delete) */
body.move-mode .file-actions {
    display: none !important;
}


/* Type-specific accents (you can tune later) */
.file-card.file-type-image .file-type-icon {
  background: radial-gradient(circle at top, rgba(248,250,252,0.98), rgba(59,130,246,0.35));
}

.file-card.file-type-video .file-type-icon {
  background: radial-gradient(circle at top, rgba(248,250,252,0.98), rgba(244,63,94,0.35));
}

.file-card.file-type-audio .file-type-icon {
  background: radial-gradient(circle at top, rgba(248,250,252,0.98), rgba(34,197,94,0.35));
}

.file-card.file-type-pdf .file-type-icon {
  background: radial-gradient(circle at top, rgba(248,250,252,0.98), rgba(239,68,68,0.35));
}

.file-card.file-type-archive .file-type-icon {
  background: radial-gradient(circle at top, rgba(248,250,252,0.98), rgba(249,115,22,0.35));
}
