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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #eff6ff;
  color: #1e293b;
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: #2563eb;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 0;
}

/* DK Logo image */
.header-logo {
  height: 54px;
  width: auto;
  border-radius: 10px;
  display: block;
  flex-shrink: 0;
}

nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav-btn {
  background: rgba(255,255,255,.12);
  border: none;
  color: rgba(255,255,255,.85);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.18s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.nav-btn:hover  { background: rgba(255,255,255,.22); color: #fff; }
.nav-btn.active { background: rgba(255,255,255,.28); color: #fff; font-weight: 600; }

/* ── Views ── */
.view { max-width: 1400px; margin: 0 auto; padding: 20px 16px 32px; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}
.toolbar h2 { font-size: 1.3rem; color: #1e293b; font-weight: 700; }
.toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ── Filter bar ── */
.filter-bar { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 20px; }
.filter-btn {
  background: #fff;
  border: 1.5px solid #dde3f0;
  color: #64748b;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.18s;
  white-space: nowrap;
}
.filter-btn:hover  { border-color: #2563eb; color: #2563eb; background: #eff6ff; }
.filter-btn.active { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ── Buttons ── */
.btn-back {
  background: #eff6ff; border: 1.5px solid #dbeafe; color: #2563eb;
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 0.88rem; font-weight: 500;
  transition: all .18s;
}
.btn-back:hover { background: #dbeafe; }

.btn-primary {
  background: #2563eb; color: #fff; border: none;
  padding: 9px 18px; border-radius: 8px; cursor: pointer; font-size: 0.88rem; font-weight: 600;
  box-shadow: 0 2px 6px rgba(37,99,235,.28); transition: all .18s;
}
.btn-primary:hover { background: #1d4ed8; box-shadow: 0 3px 10px rgba(37,99,235,.35); }

.btn-secondary {
  background: #f1f5f9; color: #475569; border: 1.5px solid #e2e8f0;
  padding: 9px 18px; border-radius: 8px; cursor: pointer; font-size: 0.88rem; font-weight: 500;
  transition: all .18s;
}
.btn-secondary:hover { background: #e2e8f0; color: #1e293b; }

.btn-danger {
  background: #fee2e2; color: #dc2626; border: 1.5px solid #fecaca;
  padding: 9px 18px; border-radius: 8px; cursor: pointer; font-size: 0.88rem; font-weight: 600;
  transition: all .18s;
}
.btn-danger:hover { background: #fecaca; }

.btn-danger-sm {
  background: #fee2e2; color: #dc2626; border: 1.5px solid #fecaca;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 0.8rem; font-weight: 600;
  transition: all .18s;
}
.btn-danger-sm:hover { background: #fecaca; }

.btn-download {
  background: #eff6ff; color: #2563eb; border: 1.5px solid #dbeafe;
  padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 0.8rem; font-weight: 500;
  text-decoration: none; display: inline-block; transition: all .18s;
}
.btn-download:hover { background: #dbeafe; }

/* ── Albums grid ── */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.album-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.album-card:hover {
  transform: translateY(-3px);
  border-color: #2563eb;
  box-shadow: 0 6px 20px rgba(37,99,235,.15);
}
.album-thumb { width: 100%; height: 140px; object-fit: cover; display: block; }
.album-thumb-placeholder {
  width: 100%; height: 140px;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
}
.album-info { padding: 12px 14px; }
.album-info h3 {
  font-size: 0.95rem; color: #1e293b; font-weight: 600;
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.album-info p { font-size: 0.78rem; color: #64748b; }

/* ── Files grid ── */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.file-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 1;
  cursor: pointer;
  background: #fff;
  border: 1.5px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.file-card:hover { transform: scale(1.03); border-color: #93c5fd; box-shadow: 0 4px 16px rgba(37,99,235,.14); }
.file-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Card overlay */
.card-overlay {
  position: absolute; inset: 0;
  background: rgba(37,99,235,.42); opacity: 0;
  transition: opacity 0.2s;
  display: flex; align-items: flex-end; padding: 10px;
}
.file-card:hover .card-overlay { opacity: 1; }
.card-name {
  font-size: 0.73rem; color: #fff; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%;
}

/* Download button on card */
.card-dl {
  position: absolute; top: 7px; right: 7px;
  width: 30px; height: 30px;
  background: rgba(255,255,255,.88); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #2563eb; font-size: 14px; text-decoration: none;
  opacity: 0; transition: opacity .2s, background .15s; z-index: 5;
  box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.file-card:hover .card-dl { opacity: 1; }
.card-dl:hover { background: #2563eb !important; color: #fff !important; }
.file-card.doc-type .card-dl { opacity: 1; background: rgba(255,255,255,.9); }

/* Video play button */
.video-play-btn {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 42px; height: 42px;
  background: rgba(37,99,235,.7); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; color: #fff; pointer-events: none;
}
.file-card.video-type video { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-card.image-type img  { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Doc card */
.file-card.doc-type {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 14px 10px; gap: 5px;
  background: linear-gradient(135deg, #f8faff, #eff6ff);
}
.file-card.doc-type:hover { background: linear-gradient(135deg, #eff6ff, #dbeafe); }
.doc-icon  { font-size: 2.6rem; line-height: 1; }
.doc-label { font-size: 0.66rem; color: var(--accent,#2563eb); font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.doc-name  { font-size: 0.7rem; color: #475569; text-align: center; word-break: break-word; max-height: 2.4em; overflow: hidden; width: 100%; }
.doc-size  { font-size: 0.66rem; color: #94a3b8; }

/* ── Modals ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 16px;
  padding: 28px;
  width: 100%; max-width: 480px;
  box-shadow: 0 20px 60px rgba(37,99,235,.18);
}
.modal-wide { max-width: 560px; }
.modal h3 { font-size: 1.15rem; color: #1e293b; font-weight: 700; margin-bottom: 20px; }
.modal label { display: block; font-size: 0.83rem; color: #64748b; font-weight: 500; margin-bottom: 5px; margin-top: 14px; }
.modal input[type="text"] {
  width: 100%; background: #f8faff;
  border: 1.5px solid #dde3f0; border-radius: 9px;
  color: #1e293b; padding: 10px 14px; font-size: 0.93rem; outline: none; transition: .18s;
}
.modal input[type="text"]:focus { border-color: #2563eb; box-shadow: 0 0 0 3px #2563eb18; background: #fff; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ── Drop zone ── */
.drop-zone {
  border: 2px dashed #bfdbfe; border-radius: 12px;
  padding: 28px; text-align: center; cursor: pointer;
  position: relative; margin-top: 14px; background: #f8fbff;
  transition: border-color 0.18s, background 0.18s;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: #2563eb; background: #eff6ff; }
.drop-icon { font-size: 2rem; margin-bottom: 8px; }
.drop-zone p { color: #64748b; font-size: 0.88rem; }
.drop-zone small { color: #94a3b8; font-size: 0.76rem; display: block; margin-top: 4px; }
.drop-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

/* ── Upload preview ── */
.upload-preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; max-height: 140px; overflow-y: auto; }
.preview-item { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; }
.preview-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1.5px solid #dde3f0; }
.preview-icon { font-size: 2rem; line-height: 1; }
.preview-name { font-size: 0.58rem; color: #64748b; text-align: center; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.progress-bar { background: #dbeafe; border-radius: 6px; height: 7px; margin-top: 16px; overflow: hidden; }
#progress-fill { height: 100%; background: #2563eb; width: 0%; transition: width 0.3s; }
#progress-text { font-size: 0.83rem; color: #64748b; margin-top: 6px; text-align: center; }

/* ── Viewer ── */
.viewer-overlay { flex-direction: column; background: rgba(2,6,23,.93); }
#viewer-content img   { max-width: 90vw; max-height: 80vh; border-radius: 10px; object-fit: contain; }
#viewer-content video { border-radius: 10px; }
.viewer-img  { max-width: 90vw; max-height: 80vh; border-radius: 10px; object-fit: contain; display: block; }
.viewer-video{ max-width: 90vw; max-height: 80vh; border-radius: 10px; display: block; }
.viewer-pdf  { width: 85vw; height: 80vh; border: none; border-radius: 10px; background: #fff; }
.viewer-doc-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 48px 40px; background: #fff; border-radius: 16px;
  border: 1.5px solid #e2e8f0; text-align: center;
}
.lightbox-close {
  position: fixed; top: 14px; right: 18px;
  background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 38px; height: 38px; border-radius: 50%;
  cursor: pointer; font-size: 1rem; z-index: 10; transition: background .18s;
}
.lightbox-close:hover { background: rgba(255,255,255,.28); }
.lightbox-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.12); border: none; color: #fff;
  font-size: 2.4rem; padding: 10px 16px; cursor: pointer;
  border-radius: 10px; transition: background 0.18s; z-index: 10;
}
.lightbox-nav:hover { background: rgba(255,255,255,.22); }
.lightbox-nav.left  { left: 14px; }
.lightbox-nav.right { right: 14px; }
.lightbox-info {
  display: flex; align-items: center; gap: 12px;
  margin-top: 14px; flex-wrap: wrap; justify-content: center;
  color: #cbd5e1; font-size: 0.83rem; max-width: 90vw;
}

/* ── Empty state ── */
.empty-state { text-align: center; padding: 64px 20px; color: #94a3b8; font-size: 0.93rem; }
.empty-icon  { font-size: 3rem; margin-bottom: 10px; opacity: .6; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #bfdbfe; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #93c5fd; }

/* ════════════════════════════════════
   MOBILE  (≤ 640px)
   ════════════════════════════════════ */
@media (max-width: 640px) {
  header { padding: 0 12px; }
  .header-inner { padding: 6px 0; gap: 6px; min-height: 52px; }
  .header-logo  { height: 42px; border-radius: 7px; }
  .nav-btn      { padding: 6px 9px; font-size: 0.76rem; }

  .view { padding: 12px 10px 24px; }
  .toolbar { margin-bottom: 10px; }
  .toolbar h2 { font-size: 1.1rem; }
  .toolbar-right { gap: 6px; }
  .btn-primary, .btn-danger, .btn-secondary, .btn-back { padding: 8px 12px; font-size: 0.82rem; }

  .filter-bar { gap: 5px; margin-bottom: 12px; }
  .filter-btn { padding: 5px 10px; font-size: 0.76rem; }

  .albums-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .album-thumb, .album-thumb-placeholder { height: 100px; }
  .album-info { padding: 8px 10px; }
  .album-info h3 { font-size: 0.82rem; }
  .album-info p  { font-size: 0.72rem; }

  .files-grid { grid-template-columns: repeat(3, 1fr); gap: 7px; }

  .modal { padding: 18px 14px; border-radius: 14px; }
  .modal h3 { font-size: 1rem; margin-bottom: 12px; }
  .modal-actions { gap: 8px; }
  .modal-actions button { flex: 1; }

  .drop-zone { padding: 18px 12px; }
  .lightbox-nav { display: none; }
  .lightbox-info { gap: 8px; font-size: 0.76rem; }
  .viewer-doc-card { padding: 32px 20px; }
}

/* ════════════════════════════════════
   TABLET  (641px – 1024px)
   ════════════════════════════════════ */
@media (min-width: 641px) and (max-width: 1024px) {
  .albums-grid { grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); }
  .files-grid  { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .view { padding: 16px 14px 28px; }
}
