/* ============================================================
   DHRUV AWS PROJECT — favourite.css
   Dark theme matching the platform style
   ============================================================ */

/* ── Page Wrapper ── */
.favourite-page {
  background: var(--bg-primary);
  border-radius: 20px;
  padding: 32px 36px;
  min-height: 70vh;
  animation: favFadeIn 0.35s ease;
}

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

/* ── Search Bar ── */
.fav-search-wrap {
  position: relative;
  max-width: 520px;
  margin-bottom: 28px;
}

.fav-search-wrap i {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 16px;
  pointer-events: none;
}

#favouriteSearch {
  width: 100%;
  padding: 14px 18px 14px 48px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  font-family: inherit;
  font-size: 15px;
  color: var(--text-white);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#favouriteSearch::placeholder {
  color: var(--text-dim);
}

#favouriteSearch:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-dim), 0 4px 12px rgba(0,0,0,0.2);
}

/* ── Heading ── */
.fav-heading {
  font-family: 'Orbitron', monospace;
  font-size: 24px;
  font-weight: 900;
  color: var(--text-white);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.fav-heading i { color: var(--cyan); }

.fav-sub {
  font-size: 13px;
  color: var(--text-gray);
  margin: 0 0 28px;
  font-weight: 400;
}

/* ── Folder Cards Grid ── */
.fav-folders-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 40px;
}

.folder-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 20px 22px;
  text-align: center;
  cursor: pointer;
  position: relative;
  transition: all 0.25s ease;
}

.folder-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0,229,255,0.3);
  box-shadow: 0 12px 28px rgba(0,229,255,0.08), 0 4px 12px rgba(0,0,0,0.2);
}

.folder-star {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 14px;
  color: #F59E0B;
}

.folder-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  background: var(--cyan-dim);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--cyan);
  transition: transform 0.25s ease, background 0.25s ease;
}

.folder-card:hover .folder-icon {
  transform: scale(1.08);
  background: rgba(0,229,255,0.18);
}

.folder-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-white);
  margin: 0 0 6px;
}

.folder-count {
  font-size: 13px;
  color: var(--text-gray);
  font-weight: 400;
}

/* ── Files Section ── */
.fav-files-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.fav-files-header h2 {
  font-family: 'Orbitron', monospace;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-white);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fav-files-header h2 i { color: var(--cyan); }

.fav-show-all-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--cyan);
  cursor: pointer;
  transition: all 0.2s ease;
}

.fav-show-all-btn:hover {
  border-color: var(--cyan-mid);
  background: var(--cyan-dim);
}

/* ── File Cards Grid ── */
.fav-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.fav-file-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.25s ease;
  cursor: pointer;
  position: relative;
}

.fav-file-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0,229,255,0.25);
  box-shadow: 0 10px 24px rgba(0,229,255,0.06), 0 4px 8px rgba(0,0,0,0.15);
}

.fav-file-card.selected {
  border-color: var(--cyan);
  background: rgba(0,229,255,0.08);
  box-shadow: 0 0 0 2px rgba(0,229,255,0.15), 0 0 20px rgba(0,229,255,0.08);
  animation: favSelectedPulse 2.5s ease-in-out infinite;
  position: relative;
}

.fav-file-card.selected:hover {
  border-color: var(--cyan);
  background: rgba(0,229,255,0.12);
  box-shadow: 0 0 0 2px rgba(0,229,255,0.2), 0 0 28px rgba(0,229,255,0.12);
}

@keyframes favSelectedPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(0,229,255,0.15), 0 0 20px rgba(0,229,255,0.06); }
  50% { box-shadow: 0 0 0 2px rgba(0,229,255,0.2), 0 0 28px rgba(0,229,255,0.1); }
}

.fav-file-thumb {
  width: 100%;
  height: 160px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fav-file-info {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fav-file-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.fav-file-date {
  font-size: 12px;
  color: var(--text-dim);
}

.fav-unfav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #F59E0B;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0;
  z-index: 2;
}

.fav-file-card:hover .fav-unfav-btn {
  opacity: 1;
}

.fav-unfav-btn:hover {
  background: rgba(245,158,11,0.15);
  border-color: #F59E0B;
  transform: scale(1.1);
}

/* ── Three-Dot Menu (removed — replaced by shared ContextMenu) ── */

/* ── Empty State ── */
.fav-files-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.fav-files-empty i {
  font-size: 48px;
  display: block;
  margin-bottom: 14px;
  color: var(--text-dim);
}

.fav-files-empty p {
  font-size: 14px;
  margin: 0;
}

/* ── Viewer Overlay ── */
.fav-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(12px);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: favViewerFadeIn 0.2s ease;
}

@keyframes favViewerFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fav-viewer-modal {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,229,255,0.08);
}

.fav-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.fav-viewer-filename {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.fav-viewer-close {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-gray);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.fav-viewer-close:hover {
  background: rgba(239,68,68,0.12);
  border-color: rgba(239,68,68,0.3);
  color: var(--red);
}

.fav-viewer-body {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  max-height: 65vh;
}

.fav-viewer-meta {
  padding: 10px 20px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
  text-align: center;
}

/* ── Viewer Nav Arrows ── */
.fav-viewer-nav-arrows {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}

.fav-viewer-arrow {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  background: rgba(15,23,42,0.8);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-white);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0;
}

.fav-viewer-modal:hover .fav-viewer-arrow {
  opacity: 1;
}

.fav-viewer-arrow:hover {
  background: var(--cyan-dim);
  border-color: var(--cyan-mid);
  color: var(--cyan);
}

.fav-viewer-arrow:disabled {
  opacity: 0 !important;
  cursor: default;
  pointer-events: none;
}

/* ── Viewer Counter ── */
.fav-viewer-counter {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  color: var(--text-gray);
  white-space: nowrap;
  pointer-events: none;
}

/* ── Viewer Content ── */
.fav-viewer-preview {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.fav-viewer-preview img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 8px;
  object-fit: contain;
}

.fav-viewer-preview video {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 8px;
}

.fav-viewer-preview iframe {
  width: 100%;
  height: 60vh;
  border: none;
  border-radius: 8px;
}

.fav-viewer-preview audio {
  width: 100%;
  max-width: 400px;
}

/* ── Responsive ── */
@media (max-width: 1400px) {
  .fav-folders-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1200px) {
  .fav-folders-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .fav-files-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
  .favourite-page { padding: 28px 28px; }
}

@media (max-width: 1024px) {
  .fav-folders-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .favourite-page { padding: 24px; }
  .fav-files-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
  .fav-file-thumb { height: 140px; }
}

@media (max-width: 900px) {
  .fav-files-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

@media (max-width: 768px) {
  .fav-folders-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .folder-card { padding: 22px 14px 18px; }
  .folder-icon { width: 48px; height: 48px; font-size: 20px; }
  .folder-title { font-size: 14px; }
  .folder-count { font-size: 12px; }
  .fav-files-grid { grid-template-columns: 1fr; gap: 12px; }
  .favourite-page { padding: 20px 16px; border-radius: 12px; min-height: auto; }
  .fav-heading { font-size: 20px; }
  .fav-sub { font-size: 12px; margin-bottom: 20px; }
  .fav-viewer-modal { max-width: 98vw; max-height: 90vh; }
  .fav-file-thumb { height: 180px; }
  .fav-file-info { padding: 10px 14px; }
  .fav-file-name { font-size: 13px; }
  .fav-file-date { font-size: 11px; }
  #favouriteSearch { font-size: 14px; padding: 12px 14px 12px 42px; }
  .fav-files-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .fav-viewer-modal { max-width: 100vw; border-radius: 0; border: none; max-height: 100vh; }
  .fav-viewer-header { padding: 12px 14px; }
  .fav-viewer-filename { font-size: 13px; max-width: 60%; }
  .fav-viewer-body { max-height: 55vh; }
  .fav-viewer-arrow { width: 36px; height: 36px; font-size: 15px; opacity: 1; }
  
  /* Bulk bar */
  #favBulkBar { flex-wrap: wrap; }
  #favBulkBar .dm-btn { font-size: 10px; padding: 5px 8px; }
}

@media (max-width: 600px) {
  .favourite-page { padding: 14px 10px; }
  .fav-heading { font-size: 18px; gap: 8px; }
  .fav-folders-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .folder-card { padding: 16px 10px 14px; }
  .folder-icon { width: 44px; height: 44px; font-size: 18px; margin-bottom: 10px; }
  .folder-title { font-size: 13px; }
  .fav-file-thumb { height: 160px; }
  .fav-files-grid { gap: 10px; }
  .fav-file-info { padding: 8px 12px; gap: 2px; }
  .fav-file-name { font-size: 12px; }
  .fav-file-date { font-size: 10px; }
  .fav-search-wrap { margin-bottom: 18px; }
  #favouriteSearch { font-size: 13px; padding: 10px 12px 10px 38px; }
  .fav-search-wrap i { left: 14px; font-size: 14px; }
  .fav-unfav-btn { opacity: 1; width: 30px; height: 30px; font-size: 12px; }
  .fav-viewer-preview img { max-height: 50vh; }
  .fav-viewer-preview video { max-height: 50vh; }
  .fav-viewer-preview iframe { height: 50vh; }
}

@media (max-width: 400px) {
  .favourite-page { padding: 10px 6px; }
  .fav-heading { font-size: 16px; }
  .fav-folders-grid { grid-template-columns: 1fr; gap: 8px; }
  .fav-search-wrap { max-width: 100%; }
  .fav-file-thumb { height: 140px; }
  .fav-file-name { font-size: 11px; }
  .fav-file-date { font-size: 10px; }
}
