/* ============================================================
   NRRU Video Streaming — Liquid Glass Stylesheet
   ============================================================ */

/* ── Theme variables ─────────────────────────────────────── */
:root {
  --nrru-green:      #1b5e20;
  --nrru-green-mid:  #2e7d32;
  --nrru-green-soft: #388e3c;
  --nrru-gold:       #f9a825;
  --nrru-gold-dark:  #f57f17;
  --nrru-dark:       #1a1a2e;

  /* Liquid Glass tokens */
  --glass-bg:        rgba(255, 255, 255, 0.12);
  --glass-bg-hover:  rgba(255, 255, 255, 0.20);
  --glass-border:    rgba(255, 255, 255, 0.30);
  --glass-shadow:    0 8px 32px rgba(0, 0, 0, 0.25);
  --glass-blur:      blur(20px) saturate(180%);
  --glass-radius:    20px;
  --glass-inner-highlight: rgba(255, 255, 255, 0.55);
}

/* ── Global ──────────────────────────────────────────────── */
body {
  font-family: 'Segoe UI', 'Sarabun', sans-serif;
  background-color: #f0f4f0;
}

a { color: var(--nrru-green-mid); }
a:hover { color: var(--nrru-green); }

/* ── Navbar ──────────────────────────────────────────────── */
.nrru-navbar {
  background: linear-gradient(135deg,
    rgba(27, 94, 32, 0.75) 0%,
    rgba(46, 125, 50, 0.65) 100%);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.20),
              inset 0 1px 0 rgba(255, 255, 255, 0.25);
  min-height: 56px;
}

.nrru-navbar .navbar-brand {
  font-size: 1.15rem;
  letter-spacing: .02em;
}

.nrru-navbar .nav-link {
  color: rgba(255,255,255,.85);
  border-radius: 10px;
  padding: .35rem .65rem;
  transition: background .2s, color .2s;
}

.nrru-navbar .nav-link:hover,
.nrru-navbar .nav-link.active {
  color: #fff;
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}

/* ── Footer ──────────────────────────────────────────────── */
.nrru-footer {
  background: rgba(26, 26, 46, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255,255,255,.10);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn-nrru {
  background: linear-gradient(135deg,
    rgba(46, 125, 50, 0.80) 0%,
    rgba(27, 94, 32, 0.90) 100%);
  border: 1px solid rgba(100, 200, 100, 0.40);
  color: #fff;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(27, 94, 32, 0.35),
              inset 0 1px 0 rgba(255,255,255,.25);
  border-radius: 12px;
  transition: all .25s ease;
}

.btn-nrru:hover, .btn-nrru:focus {
  background: linear-gradient(135deg,
    rgba(56, 142, 60, 0.90) 0%,
    rgba(46, 125, 50, 1) 100%);
  border-color: rgba(150, 230, 150, 0.55);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(27, 94, 32, 0.45),
              inset 0 1px 0 rgba(255,255,255,.35);
}

.text-nrru { color: var(--nrru-green-mid) !important; }
.bg-nrru   { background-color: var(--nrru-green-mid) !important; }

.progress-bar.bg-nrru {
  background-color: var(--nrru-green-mid) !important;
}

/* ── Extra small button ──────────────────────────────────── */
.btn-xs {
  padding: .15rem .4rem;
  font-size: .75rem;
  line-height: 1.4;
  border-radius: 6px;
}

/* ── Cards (global) ──────────────────────────────────────── */
.card {
  background: rgba(255, 255, 255, 0.65) !important;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.55) !important;
  border-radius: 18px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.10),
              inset 0 1px 0 rgba(255,255,255,.80);
  transition: transform .2s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0,0,0,.14),
              inset 0 1px 0 rgba(255,255,255,.90);
}

.card-header {
  background: rgba(255,255,255,.40) !important;
  border-bottom: 1px solid rgba(255,255,255,.50) !important;
  border-left: 3px solid var(--nrru-green-mid);
  border-radius: 17px 17px 0 0 !important;
}

/* ── Login page ──────────────────────────────────────────── */
.login-page {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(27,94,32,0.6) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(26,58,92,0.7) 0%, transparent 55%),
    radial-gradient(ellipse at 60% 80%, rgba(46,125,50,0.4) 0%, transparent 50%),
    linear-gradient(135deg, #0d2b0f 0%, #1a3a5c 100%);
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Animated blobs */
.login-page::before,
.login-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  animation: blobFloat 8s ease-in-out infinite;
  pointer-events: none;
}

.login-page::before {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(46,125,50,0.6), transparent);
  top: -100px; left: -100px;
}

.login-page::after {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(26,58,92,0.7), transparent);
  bottom: -150px; right: -100px;
  animation-delay: -4s;
}

@keyframes blobFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%       { transform: translate(30px, -30px) scale(1.05); }
  66%       { transform: translate(-20px, 20px) scale(0.97); }
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 1rem;
  position: relative;
  z-index: 10;
}

.login-logo {
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.30);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0,0,0,.25),
              inset 0 1px 0 rgba(255,255,255,.40);
}

.login-logo i {
  font-size: 2.5rem;
  color: var(--nrru-gold);
  filter: drop-shadow(0 0 8px rgba(249,168,37,0.6));
}

/* Login card glass */
.login-wrapper .card {
  background: rgba(255, 255, 255, 0.10) !important;
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  border-radius: 24px !important;
  box-shadow: 0 16px 48px rgba(0,0,0,.35),
              inset 0 1px 0 rgba(255,255,255,.30),
              inset 0 -1px 0 rgba(0,0,0,.10);
}

.login-wrapper .card:hover {
  transform: none;
}

.login-wrapper .card-body {
  color: rgba(255,255,255,.90);
}

.login-wrapper .card h2 {
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.3);
}

.login-wrapper .form-label {
  color: rgba(255,255,255,.85);
}

.login-wrapper .form-control {
  background: rgba(255,255,255,.12) !important;
  border: 1px solid rgba(255,255,255,.25) !important;
  border-radius: 12px !important;
  color: #fff !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.login-wrapper .form-control::placeholder {
  color: rgba(255,255,255,.45);
}

.login-wrapper .form-control:focus {
  background: rgba(255,255,255,.20) !important;
  border-color: rgba(100, 220, 100, 0.60) !important;
  box-shadow: 0 0 0 3px rgba(46,125,50,.25),
              inset 0 1px 0 rgba(255,255,255,.20) !important;
  color: #fff !important;
  outline: none;
}

.login-wrapper .input-group .btn-outline-secondary {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.25);
  border-left: none;
  border-radius: 0 12px 12px 0 !important;
  color: rgba(255,255,255,.75);
  backdrop-filter: blur(8px);
  transition: background .2s;
}

.login-wrapper .input-group .btn-outline-secondary:hover {
  background: rgba(255,255,255,.22);
  color: #fff;
}

.login-wrapper .alert-danger {
  background: rgba(220, 53, 69, 0.20);
  border: 1px solid rgba(220, 53, 69, 0.40);
  border-radius: 12px;
  color: #ffb3b8;
  backdrop-filter: blur(8px);
}

.login-wrapper hr {
  border-color: rgba(255,255,255,.15);
}

.login-wrapper .text-muted {
  color: rgba(255,255,255,.55) !important;
}

.login-wrapper a {
  color: rgba(150, 230, 150, 0.90);
}

/* ── Video cards ─────────────────────────────────────────── */
.video-card {
  transition: transform .2s ease, box-shadow .2s ease;
  border-radius: 16px !important;
  overflow: hidden;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,.16) !important;
}

/* Thumbnail container */
.video-thumb {
  background: #222;
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}

.video-card:hover .video-thumb img {
  transform: scale(1.04);
}

/* Play overlay */
.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.3);
  opacity: 0;
  transition: opacity .2s;
  color: #fff;
  font-size: 3rem;
}

.video-card:hover .play-overlay {
  opacity: 1;
}

/* Duration badge */
.duration-badge {
  position: absolute;
  bottom: 6px;
  right: 8px;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 6px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,.15);
}

/* Title clamp (2 lines) */
.video-title-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Upload drop zone ────────────────────────────────────── */
.upload-drop-zone {
  border: 2px dashed rgba(46,125,50,.45);
  border-radius: 16px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: rgba(46,125,50,.04);
  backdrop-filter: blur(8px);
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.upload-drop-zone.dragover,
.upload-drop-zone:hover {
  border-color: var(--nrru-green-mid);
  background: rgba(46,125,50,.08);
  box-shadow: inset 0 0 20px rgba(46,125,50,.06);
}

/* ── Video player wrapper ────────────────────────────────── */
.ratio-video-wrapper {
  background: #000;
  max-height: 540px;
  border-radius: 16px;
  overflow: hidden;
}

.vjs-fluid {
  max-height: 540px;
}

/* Video.js custom skin */
.video-js .vjs-big-play-button {
  background: rgba(46,125,50,.85) !important;
  border: none !important;
  border-radius: 50% !important;
  width: 64px !important;
  height: 64px !important;
  line-height: 64px !important;
  margin-left: -32px !important;
  margin-top: -32px !important;
}
.video-js .vjs-big-play-button:hover {
  background: var(--nrru-green) !important;
}

/* ── Related video hover ─────────────────────────────────── */
.related-item {
  border-radius: 12px;
  padding: 8px;
  transition: background .15s;
}
.related-item:hover {
  background: rgba(46,125,50,.07);
}

/* ── Admin area ──────────────────────────────────────────── */
@media (min-width: 992px) {
  .admin-sidebar { width: 220px; }
}

/* ── Pagination ──────────────────────────────────────────── */
.pagination .page-link {
  color: var(--nrru-green-mid);
  background: rgba(255,255,255,.60);
  backdrop-filter: blur(8px);
  border-color: rgba(255,255,255,.50);
  border-radius: 8px !important;
  margin: 0 2px;
  transition: all .2s;
}
.pagination .page-link:hover {
  background: rgba(46,125,50,.12);
  border-color: rgba(46,125,50,.30);
}
.pagination .page-item.active .page-link {
  background: linear-gradient(135deg, var(--nrru-green-mid), var(--nrru-green));
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(46,125,50,.35);
}

/* ── Badge overrides — ป้องกัน badge หายไปกับ theme ────────── */
.badge.bg-light     { background: #dee2e6 !important; color: #333 !important; }
.badge.bg-info      { background: #0dcaf0 !important; color: #000 !important; }
.badge.bg-primary   { background: #0d6efd !important; color: #fff !important; }
.badge.bg-success   { background: #198754 !important; color: #fff !important; }
.badge.bg-secondary { background: #6c757d !important; color: #fff !important; }
.badge.bg-warning   { background: #ffc107 !important; color: #000 !important; }

/* ── Role badges ─────────────────────────────────────────── */
.role-student  { background-color: #0d6efd !important; }
.role-teacher  { background-color: var(--nrru-green-mid) !important; }
.role-staff    { background-color: var(--nrru-gold) !important; color: #222 !important; }

/* Student notice banner */
.student-notice {
  border-left: 4px solid #0d6efd;
  background: rgba(13,110,253,.08);
  backdrop-filter: blur(6px);
}

/* ── Tables ──────────────────────────────────────────────── */
.table { background: transparent; }
.table thead th { background: rgba(46,125,50,.08); backdrop-filter: blur(8px); }
.table tbody tr:hover td { background: rgba(46,125,50,.04); }

/* ── Form controls (global) ──────────────────────────────── */
.form-control, .form-select {
  border-radius: 10px;
  border-color: rgba(0,0,0,.12);
  transition: border-color .2s, box-shadow .2s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--nrru-green-soft);
  box-shadow: 0 0 0 3px rgba(46,125,50,.15);
}

/* ── Misc ────────────────────────────────────────────────── */
code { color: var(--nrru-green-mid); }
pre  { background: rgba(248,249,250,.80); backdrop-filter: blur(8px); border-radius: 10px; padding: .75rem 1rem; }

.table-responsive { min-height: 200px; }

.cat-pill {
  border-radius: 20px;
  padding: .25rem .75rem;
  font-size: .82rem;
  background: rgba(255,255,255,.60);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,.08);
}

/* ── Scrollbar thin ──────────────────────────────────────── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: rgba(240,240,240,.50); }
::-webkit-scrollbar-thumb  { background: rgba(46,125,50,.35); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(46,125,50,.60); }

/* ── Modals glass ────────────────────────────────────────── */
.modal-content {
  background: rgba(255,255,255,.75) !important;
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255,255,255,.55) !important;
  border-radius: 20px !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-header { border-bottom: 1px solid rgba(0,0,0,.08) !important; border-radius: 20px 20px 0 0 !important; }
.modal-footer { border-top: 1px solid rgba(0,0,0,.08) !important; border-radius: 0 0 20px 20px !important; }

/* ── Alerts glass ────────────────────────────────────────── */
.alert {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 12px;
}
.alert-success { background: rgba(25,135,84,.12) !important; border-color: rgba(25,135,84,.30) !important; }
.alert-danger  { background: rgba(220,53,69,.12) !important; border-color: rgba(220,53,69,.30) !important; }
.alert-warning { background: rgba(255,193,7,.12) !important; border-color: rgba(255,193,7,.30) !important; }
.alert-info    { background: rgba(13,202,240,.12) !important; border-color: rgba(13,202,240,.30) !important; }

/* ── Dropdown menus ──────────────────────────────────────── */
.dropdown-menu {
  background: rgba(255,255,255,.80) !important;
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(255,255,255,.55) !important;
  border-radius: 14px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.15);
}
.dropdown-item:hover, .dropdown-item:focus {
  background: rgba(46,125,50,.10) !important;
  border-radius: 8px;
}
