/* MediaShare — Main CSS */
:root {
  --bg: #0f0f1a;
  --bg2: #1a1a2e;
  --bg3: #242438;
  --border: #2e2e50;
  --text: #e0e0f0;
  --text2: #8888aa;
  --accent: #a855f7;
  --accent2: #ec4899;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 10px;
  --font: 'Segoe UI', system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { opacity: .85; }

/* ── Header ── */
.site-header {
  background: rgba(15,15,26,.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.site-logo {
  font-size: 20px; font-weight: 800; color: var(--text);
  background: linear-gradient(90deg,var(--accent),var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  white-space: nowrap;
}
.header-nav { display: flex; align-items: center; gap: 8px; }
.nav-link {
  padding: 7px 14px; border-radius: 7px; color: var(--text2);
  font-size: 14px; font-weight: 500; transition: .15s;
}
.nav-link:hover, .nav-link.active { background: var(--bg3); color: var(--text); }

/* Tombol upload di nav (dropdown) */
.nav-upload {
  padding: 7px 16px !important; border-radius: 7px !important; font-size: 14px; font-weight: 600;
  background: linear-gradient(135deg,var(--accent),var(--accent2)) !important;
  color: #fff !important; border: none !important; transition: opacity .15s;
}
.nav-upload:hover { opacity: .88; }

/* User dropdown */
.user-menu { position: relative; }
.user-btn {
  background: var(--bg3); border: 1px solid var(--border); color: var(--text);
  padding: 7px 14px; border-radius: 7px; font-size: 14px; cursor: pointer;
}
.user-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 140px; overflow: hidden; z-index: 200;
}
.user-menu.open .user-dropdown { display: block; }
.user-dropdown a { display: block; padding: 11px 16px; color: var(--text); font-size: 14px; }
.user-dropdown a:hover { background: var(--bg3); }

/* ── Container ── */
.container { max-width: 1280px; margin: 0 auto; padding: 24px 20px; }

/* ── Flash messages ── */
.flash { padding: 13px 18px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.flash-ok { background: #14532d; border: 1px solid #22c55e; color: #86efac; }
.flash-error { background: #450a0a; border: 1px solid var(--red); color: #fca5a5; }

/* ── Search bar ── */
.search-bar { margin-bottom: 20px; }
.search-wrap { position: relative; max-width: 540px; }
.search-ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text2); }
.search-input {
  width: 100%; padding: 11px 40px 11px 40px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 50px; color: var(--text); font-size: 14px; outline: none;
}
.search-input:focus { border-color: var(--accent); }
.search-clear { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text2); }

/* ── Tabs ── */
.tabs { display: flex; gap: 8px; margin-bottom: 24px; }
.tab {
  padding: 8px 20px; border-radius: 50px; font-size: 14px; font-weight: 500;
  background: var(--bg2); color: var(--text2); border: 1px solid var(--border);
  transition: .15s;
}
.tab:hover { color: var(--text); border-color: var(--accent); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Media grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.grid-small {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; color: var(--text);
  transition: transform .15s, border-color .15s;
  display: block;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card-thumb {
  position: relative; aspect-ratio: 16/9; overflow: hidden; background: var(--bg3);
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-placeholder { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 48px; }
.badge-video {
  position: absolute; top: 8px; left: 8px;
  background: rgba(0,0,0,.7); color: #fff;
  padding: 3px 8px; border-radius: 4px; font-size: 12px;
}
.badge-photo {
  position: absolute; top: 8px; left: 8px;
  background: rgba(168,85,247,.8); color: #fff;
  padding: 3px 8px; border-radius: 4px; font-size: 11px;
}
.duration {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(0,0,0,.8); color: #fff;
  padding: 2px 7px; border-radius: 4px; font-size: 12px;
}
.card-info { padding: 12px; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 4px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-meta { font-size: 12px; color: var(--text2); }
.card.card-sm .card-title { font-size: 13px; }

/* ── Empty state ── */
.empty { text-align: center; padding: 80px 20px; }
.empty-icon { font-size: 64px; margin-bottom: 16px; }
.empty p { color: var(--text2); font-size: 16px; }

/* ── Pagination ── */
.pagination { display: flex; gap: 6px; margin-top: 32px; justify-content: center; flex-wrap: wrap; }
.page-btn {
  padding: 8px 14px; border-radius: 7px; background: var(--bg2);
  border: 1px solid var(--border); color: var(--text2); font-size: 14px;
}
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:hover:not(.active) { border-color: var(--accent); color: var(--text); }

/* ── Auth pages ── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px; width: 100%; max-width: 420px;
}
.auth-logo { text-align: center; margin-bottom: 28px; }
.logo-icon { font-size: 48px; display: block; margin-bottom: 10px; }
.auth-logo h1 {
  font-size: 26px; font-weight: 800;
  background: linear-gradient(90deg,var(--accent),var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.auth-logo p { color: var(--text2); font-size: 14px; margin-top: 4px; }
.auth-form label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 5px; margin-top: 14px; }
.auth-form input {
  width: 100%; padding: 11px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; outline: none;
}
.auth-form input:focus { border-color: var(--accent); }
.auth-link { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text2); }

/* ── Buttons ── */
.btn-primary {
  display: inline-block; padding: 11px 22px;
  background: linear-gradient(135deg,var(--accent),var(--accent2));
  color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 700;
  cursor: pointer; margin-top: 20px; transition: opacity .15s, transform .15s;
}
.btn-primary:hover { opacity: .9; transform: translateY(-1px); color: #fff; }
.btn-secondary {
  display: inline-block; padding: 11px 22px; margin-top: 20px; margin-left: 8px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text2); border-radius: 8px; font-size: 14px;
}
.btn-sm { padding: 6px 14px; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; cursor: pointer; }
.btn-xs { display: inline-block; padding: 4px 10px; background: var(--bg3); border: 1px solid var(--border); border-radius: 5px; font-size: 12px; color: var(--text); }
.btn-del-xs { border-color: var(--red); color: var(--red); }
.btn-edit { border-color: #f59e0b; color: #f59e0b; }
.btn-del { border-color: var(--red); color: var(--red); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--text2); margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 11px 14px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 14px; outline: none;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group select { appearance: none; }
.req { color: var(--red); }

/* ── Page card ── */
.page-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.page-title { font-size: 22px; font-weight: 800; margin-bottom: 24px; }

/* ── Admin header ── */
.admin-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 12px; }
.admin-header .page-title { margin-bottom: 0; }
.admin-nav { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.anav-item {
  padding: 10px 18px; background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text2); font-size: 14px; font-weight: 500;
}
.anav-item:hover { border-color: var(--accent); color: var(--accent); }

/* ── Stats ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 14px; margin-bottom: 28px; }
.stat-card { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; text-align: center; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--accent); }
.stat-label { font-size: 13px; color: var(--text2); margin-top: 4px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 12px 16px; background: var(--bg3); font-size: 13px; color: var(--text2); text-align: left; }
.data-table td { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 14px; vertical-align: middle; }
.data-table tr:hover td { background: rgba(168,85,247,.04); }
.table-thumb { width: 70px; height: 45px; object-fit: cover; border-radius: 5px; display: block; }
.table-thumb-ph { width: 70px; height: 45px; background: var(--bg3); border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.section-title { font-size: 18px; font-weight: 700; margin: 24px 0 16px; }

/* ── Filter bar ── */
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-form select, .filter-form input { padding: 8px 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 7px; color: var(--text); font-size: 13px; }
.total-info { color: var(--text2); font-size: 13px; }

/* ── Upload page ── */
.drop-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 48px 24px; text-align: center; cursor: pointer; transition: .2s;
  background: var(--bg3);
}
.drop-zone:hover, .drop-zone.drag-over { border-color: var(--accent); background: rgba(168,85,247,.06); }
.drop-icon { font-size: 48px; margin-bottom: 12px; }
.drop-text { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.drop-hint { font-size: 13px; color: var(--text2); }
.preview-img { max-width: 100%; max-height: 360px; border-radius: 8px; display: block; margin: 0 auto; }
.preview-video { width: 100%; border-radius: 8px; }
.file-info { text-align: center; font-size: 13px; color: var(--text2); margin-top: 8px; }

/* Progress bar */
.progress-bar { margin-top: 16px; background: var(--bg3); border-radius: 50px; height: 20px; position: relative; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg,var(--accent),var(--accent2)); transition: width .3s; border-radius: 50px; }
.progress-text { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); font-size: 12px; font-weight: 700; color: #fff; }

/* ── View page ── */
.view-page {}
.view-main { max-width: 900px; margin: 0 auto 40px; }
.media-viewer { border-radius: 12px; overflow: hidden; background: #000; margin-bottom: 20px; }
.video-player { width: 100%; display: block; max-height: 540px; }
.photo-viewer { text-align: center; background: #000; }
.photo-full { max-width: 100%; max-height: 700px; object-fit: contain; display: block; margin: 0 auto; }
.media-title { font-size: 22px; font-weight: 800; margin-bottom: 12px; }
.media-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.media-meta span { font-size: 13px; color: var(--text2); }
.media-desc { font-size: 15px; color: var(--text2); line-height: 1.7; background: var(--bg2); padding: 14px 16px; border-radius: 8px; margin-bottom: 14px; }
.admin-actions { display: flex; gap: 8px; }
.badge { padding: 4px 10px; border-radius: 5px; font-size: 12px; font-weight: 700; }
.badge-v { background: rgba(168,85,247,.2); color: var(--accent); }
.badge-p { background: rgba(236,72,153,.2); color: var(--accent2); }
.related-section { max-width: 900px; margin: 0 auto; }

/* Navigasi panah lightbox-style */
.nav-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff !important;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; z-index: 10; transition: background .15s;
}
.nav-arrow:hover { background: rgba(168,85,247,.85); }
.nav-prev { left: 12px; }
.nav-next { right: 12px; }
@media (max-width: 640px) {
  .nav-arrow { width: 36px; height: 36px; font-size: 20px; }
}

/* ── Status badges ── */
.status-active { color: var(--green); }
.status-inactive { color: var(--red); }

/* ── Info grid ── */
.info-grid { display: flex; flex-direction: column; gap: 8px; }
.info-row { display: flex; justify-content: space-between; font-size: 13px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.info-row span:first-child { color: var(--text2); }

/* ── Footer ── */
.site-footer { text-align: center; padding: 24px; color: var(--text2); font-size: 13px; border-top: 1px solid var(--border); margin-top: 40px; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .header-inner { padding: 10px 14px; }
  .site-logo { font-size: 16px; }
  .tabs { gap: 6px; }
  .tab { padding: 7px 14px; font-size: 13px; }
  .media-title { font-size: 18px; }
  .admin-header { flex-direction: column; align-items: flex-start; }
}
