
:root {
  --primary:       #1a56db;
  --primary-dark:  #1341a8;
  --accent:        #f59e0b;
  --bg:            #f8fafd;
  --bg2:           #eef2fb;
  --text:          #1e293b;
  --muted:         #64748b;
  --card-bg:       #ffffff;
  --nav-bg:        #0f172a;
  --radius:        14px;
  --shadow:        0 4px 24px rgba(26,86,219,.10);
  --shadow-hover:  0 8px 36px rgba(26,86,219,.18);
  --font-display:  'Playfair Display', serif;
  --font-body:     'DM Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  margin: 0;
}
.fs-tiny { font-size: .65rem; }

.navbar {
  background: var(--nav-bg) !important;
  border-bottom: 2px solid var(--primary);
  padding: .75rem 0;
  z-index: 1000;
}
.navbar-brand {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: #fff !important;
  letter-spacing: -.5px;
}
.brand-icon { margin-right: 4px; }
.brand-accent { color: var(--accent); }
.nav-link { color: rgba(255,255,255,.75) !important; font-weight: 500; transition: color .2s; }
.nav-link:hover, .nav-link.active { color: #fff !important; }
.navbar-toggler { border-color: rgba(255,255,255,.3); }
.navbar-toggler-icon { filter: invert(1); }

.hero-section {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a6e 60%, #1a56db 100%);
  position: relative;
  overflow: hidden;
  padding: 72px 0 56px;
}
.hero-bg-decor {
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,158,11,.15) 0%, transparent 70%);
  top: -200px; right: -100px;
  pointer-events: none;
}
.hero-eyebrow {
  color: var(--accent);
  font-weight: 600;
  font-size: .95rem;
  letter-spacing: 1px;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  color: #fff;
  line-height: 1.15;
  margin-bottom: 16px;
}
.hero-highlight {
  color: var(--accent);
  font-style: italic;
}
.hero-sub {
  color: rgba(255,255,255,.72);
  font-size: 1.05rem;
  margin-bottom: 32px;
}
.min-vh-40 { min-height: 40vh; }

.hero-search-wrap { max-width: 580px; margin: 0 auto; }
.hero-search .form-control {
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.3);
  color: #fff;
  font-size: 1rem;
  padding: 12px 16px;
  backdrop-filter: blur(8px);
}
.hero-search .form-control::placeholder { color: rgba(255,255,255,.5); }
.hero-search .form-control:focus { background: rgba(255,255,255,.18); box-shadow: none; border-color: var(--accent); color:#fff; }
.hero-search .input-group-text {
  background: rgba(255,255,255,.12);
  border: 1.5px solid rgba(255,255,255,.3);
  color: rgba(255,255,255,.7);
  border-right: none;
}
.btn-search {
  background: var(--accent);
  color: #0f172a;
  font-weight: 700;
  padding: 0 24px;
  border: none;
  border-radius: 0 8px 8px 0;
  transition: background .2s;
}
.btn-search:hover { background: #d97706; color:#0f172a; }

.filter-section { background: var(--bg2); border-bottom: 1px solid #dde4f0; }
.filter-label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing:.5px; margin-bottom: 6px; }
.filter-select {
  border-radius: 8px;
  border: 1.5px solid #c8d4ea;
  font-size: .9rem;
  color: var(--text);
}
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.12); }
.btn-reset {
  background: #fff;
  border: 1.5px solid #c8d4ea;
  color: var(--muted);
  font-weight: 600;
  border-radius: 8px;
  transition: all .2s;
}
.btn-reset:hover { border-color: var(--primary); color: var(--primary); }

.result-count { font-size: .88rem; color: var(--muted); font-weight: 500; }
.btn-view-toggle {
  background: #fff;
  border: 1.5px solid #dde4f0;
  color: var(--muted);
  border-radius: 8px;
  width: 36px; height: 36px;
  padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
}
.btn-view-toggle.active, .btn-view-toggle:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

.docs-section { padding-top: 20px; }

.doc-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: transform .25s, box-shadow .25s;
  border: 1px solid #e8eef8;
  animation: fadeInUp .4s ease both;
}
.doc-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }

@keyframes fadeInUp {
  from { opacity:0; transform: translateY(20px); }
  to   { opacity:1; transform: translateY(0); }
}

.user-doc-thumbnail-wrap {
  position: relative;
  width: 100%;
  height: 160px;
  overflow: hidden;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.user-doc-blur-bg {
  position: absolute;
  top: -10%; left: -10%;
  width: 120%; height: 120%;
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #10b981 100%);
  filter: blur(14px);
  opacity: 0.45;
  z-index: 1;
}

.user-doc-preview-card {
  position: relative;
  z-index: 2;
  width: 80%;
  height: 80%;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.2);
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255,255,255,0.6);
  transform: perspective(500px) rotateX(5deg);
}

.user-doc-preview-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.user-doc-preview-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed #cbd5e1;
  padding-top: 6px;
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 600;
}

.user-doc-watermark {
  position: absolute;
  bottom: 15px; right: -15px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent);
  font-size: 0.55rem;
  font-weight: 900;
  padding: 2px 15px;
  transform: rotate(-25deg);
  text-transform: uppercase;
  letter-spacing: 1px;
  pointer-events: none;
}

.doc-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.doc-card-subject {
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 6px;
}
.doc-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-card-desc {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: 12px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: 12px;
}
.doc-card-footer {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.btn-detail {
  flex: 1;
  background: var(--bg2);
  border: none;
  border-radius: 8px;
  color: var(--primary);
  font-weight: 600;
  font-size: .82rem;
  padding: 7px;
  transition: all .2s;
}
.btn-detail:hover { background: var(--primary); color: #fff; }
.btn-download {
  flex: 1;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-weight: 600;
  font-size: .82rem;
  padding: 7px;
  text-align: center;
  text-decoration: none;
  transition: background .2s;
  display: flex; align-items:center; justify-content:center; gap:4px;
}
.btn-download:hover { background: var(--primary-dark); color:#fff; }

.btn-fav {
  background: none;
  border: none;
  color: #ccc;
  font-size: 1.1rem;
  padding: 0;
  cursor: pointer;
  transition: color .2s, transform .15s;
}
.btn-fav.active { color: #ef4444; }
.btn-fav:hover { transform: scale(1.2); color: #ef4444; }

.badge-approved { background: #dcfce7; color: #166534; font-size:.7rem; border-radius:6px; padding: 2px 8px; }
.badge-pending  { background: #fef9c3; color: #854d0e; font-size:.7rem; border-radius:6px; padding: 2px 8px; }

.list-view .doc-card { 
  flex-direction: row; 
  height: auto; 
  align-items: stretch;
}
.list-view .user-doc-thumbnail-wrap { 
  width: 180px; 
  height: 100%; 
  min-height: 150px; 
  flex-shrink: 0; 
  border-bottom: none;
  border-right: 1px solid #e2e8f0;
}
.list-view .user-doc-preview-card {
  width: 90%;
  height: 90%;
  padding: 8px;
}
.list-view .doc-card-body { 
  padding: 16px 20px; 
}

.skeleton-card {
  background: linear-gradient(90deg, #e8eef8 25%, #d4ddf2 50%, #e8eef8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
  height: 320px;
}
.skeleton-row {
  background: linear-gradient(90deg, #e8eef8 25%, #d4ddf2 50%, #e8eef8 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--muted);
}
.empty-icon { font-size: 3.5rem; margin-bottom: 16px; }

.detail-modal {
  border-radius: var(--radius) !important;
  border: none;
  box-shadow: 0 20px 60px rgba(26,86,219,.15);
}

.modal-detail-thumbnail-container {
  width: 100%;
  height: 200px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin-bottom: 20px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-detail-thumbnail-container .user-doc-preview-card {
  width: 50%;
  height: 85%;
}

.modal-subject-tag {
  display: inline-block;
  background: var(--bg2);
  color: var(--primary);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  padding: 3px 10px;
  border-radius: 6px;
  margin-bottom: 10px;
}
.modal-doc-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 8px;
}
.modal-meta { color: var(--muted); font-size: .85rem; margin-bottom: 16px; }
.modal-desc { color: var(--text); line-height: 1.7; margin-bottom: 24px; }
.btn-modal-dl {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 28px;
  font-weight: 700;
  font-size: 1rem;
  display: inline-flex; align-items:center; gap:8px;
  text-decoration: none;
  transition: background .2s;
}
.btn-modal-dl:hover { background: var(--primary-dark); color:#fff; }

.admin-body { background: #f1f5fb; }

.admin-sidebar {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid #e8eef8;
}
.sidebar-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg2);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  text-align: center;
}
.stat-num { font-size: 1.8rem; font-weight: 700; font-family: var(--font-display); }
.stat-label { font-size: .72rem; color: var(--muted); font-weight: 500; }

.admin-page-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.admin-search {
  width: 220px;
  border-radius: 8px;
  border: 1.5px solid #c8d4ea;
  font-size: .88rem;
}
.admin-table-wrap {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid #e8eef8;
  overflow: hidden;
  padding: 20px;
}
.admin-table thead th {
  background: var(--bg2);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  font-weight: 700;
  border: none;
  padding: 12px 14px;
}
.admin-table tbody tr { border-bottom: 1px solid #f0f4fb; transition: background .15s; }
.admin-table tbody tr:hover { background: #f7f9ff; }
.admin-table td { font-size: .88rem; padding: 12px 14px; }

.btn-icon {
  background: none;
  border: 1.5px solid #dde4f0;
  border-radius: 8px;
  width: 32px; height: 32px;
  padding: 0;
  display: inline-flex; align-items:center; justify-content:center;
  font-size: .85rem;
  cursor: pointer;
  transition: all .18s;
}
.btn-icon-edit   { color: var(--primary); }
.btn-icon-edit:hover   { background: var(--primary); color:#fff; border-color: var(--primary); }
.btn-icon-del    { color: #ef4444; }
.btn-icon-del:hover    { background: #ef4444; color:#fff; border-color:#ef4444; }
.btn-icon-approve { color: #16a34a; }
.btn-icon-approve:hover { background: #16a34a; color:#fff; border-color:#16a34a; }


.pagination .page-link { border-radius: 8px !important; margin: 0 2px; font-size: .82rem; color: var(--primary); }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }

.toast { background: #1e293b; color:#fff; border-radius: 12px !important; }
.toast.success { background: #166534; }
.toast.error   { background: #991b1b; }

.site-footer {
  background: var(--nav-bg);
  color: rgba(255,255,255,.6);
  padding: 24px 0;
  margin-top: 40px;
  font-size: .85rem;
}
.site-footer strong { color: rgba(255,255,255,.9); }

@media (max-width: 575px) {
  .hero-section { padding: 48px 0 40px; }
  .hero-search .btn-search { padding: 0 14px; }
  .admin-table { font-size: .78rem; }
  .admin-table td:nth-child(3),
  .admin-table td:nth-child(4) { display: none; }
  .admin-table th:nth-child(3),
  .admin-table th:nth-child(4) { display: none; }
  
  .list-view .doc-card { flex-direction: column; }
  .list-view .user-doc-thumbnail-wrap { width: 100%; border-right: none; border-bottom: 1px solid #e2e8f0; }
}
@media (max-width: 767px) {
  .admin-sidebar { display: flex; flex-wrap: wrap; gap: 10px; }
  .sidebar-title { width: 100%; }
  .stat-card { flex: 1; min-width: 100px; }
}