/* ============================================================
   研修動画ストリーミング — Premium Dark Neumorphism
   Deep Navy + Warm Gold accent, enterprise-grade
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Zen+Kaku+Gothic+New:wght@400;500;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* --- CSS Variables --- */
:root {
  /* ダークネイビー基調 */
  --bg:            #0f1219;
  --bg-darker:     #0a0d14;
  --bg-section:    #141824;
  --bg-card:       rgba(22, 27, 40, 0.85);
  --bg-elevated:   rgba(30, 36, 54, 0.9);

  /* カード浮遊シャドウ */
  --shadow-dark:   rgba(0, 0, 0, 0.7);
  --shadow-light:  rgba(255, 255, 255, 0.03);
  --card-shadow:   0 8px 32px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  --card-shadow-hover: 0 16px 48px rgba(0,0,0,0.6), 0 0 20px rgba(0,212,255,0.08);

  /* テキスト */
  --text-primary:   #e8ecf4;
  --text-secondary: #8b95a8;
  --text-muted:     #5a6478;

  /* ネオンアクセント（シアン〜パープルグラデーション） */
  --accent:         #00d4ff;
  --accent-hover:   #33ddff;
  --accent-light:   rgba(0, 212, 255, 0.1);
  --accent-gradient: linear-gradient(135deg, #00d4ff, #7c3aed);
  --accent-glow:    0 0 24px rgba(0, 212, 255, 0.2);
  --neon-pink:      #f472b6;
  --neon-gradient:  linear-gradient(135deg, #00d4ff, #a855f7, #f472b6);
  --neon-glow-cyan: 0 0 20px rgba(0, 212, 255, 0.3);
  --neon-glow-purple: 0 0 20px rgba(124, 58, 237, 0.3);

  /* セマンティック（ネオントーン） */
  --success:  #34d399;
  --warning:  #fbbf24;
  --danger:   #fb7185;
  --info:     #38bdf8;

  /* タイポグラフィ */
  --font-sans: 'DM Sans', 'Zen Kaku Gothic New', 'Hiragino Kaku Gothic ProN', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Fira Code', monospace;

  /* ニューモフィズム */
  --neu-convex:     6px  6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
  --neu-convex-sm:  3px  3px  7px var(--shadow-dark), -3px -3px  7px var(--shadow-light);
  --neu-convex-lg: 10px 10px 22px var(--shadow-dark), -10px -10px 22px var(--shadow-light);
  --neu-flat:       4px  4px  9px rgba(0,0,0,0.4), -4px -4px  9px rgba(255,255,255,0.03);
  --neu-inset:      inset  4px  4px  8px rgba(0,0,0,0.5), inset -4px -4px  8px rgba(255,255,255,0.03);
  --neu-pressed:    inset  3px  3px  6px rgba(0,0,0,0.5), inset -3px -3px  6px rgba(255,255,255,0.03);

  /* 角丸 */
  --radius:     14px;
  --radius-sm:  8px;
  --radius-lg:  20px;

  /* グラスモーフィズム的ボーダー */
  --border-subtle: 1px solid rgba(255,255,255,0.06);
}

/* ライトモード */
[data-theme="light"] {
  --bg:            #eef1f5;
  --bg-darker:     #e2e6ec;
  --bg-section:    #e8ecf2;
  --bg-card:       #eef1f5;
  --bg-elevated:   #f0f3f7;
  --shadow-dark:   rgba(163,177,198,0.7);
  --shadow-light:  rgba(255,255,255,0.9);
  --text-primary:  #1a1f2e;
  --text-secondary:#5a6478;
  --text-muted:    #8b95a8;
  --accent:        #0891b2;
  --accent-hover:  #0e7490;
  --accent-light:  rgba(8,145,178,0.1);
  --accent-gradient: linear-gradient(135deg, #0891b2, #6d28d9);
  --accent-glow:   0 0 20px rgba(8,145,178,0.1);
  --border-subtle: 1px solid rgba(0,0,0,0.04);
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background:
    radial-gradient(ellipse at 15% 10%, rgba(0,212,255,0.06) 0%, transparent 40%),
    radial-gradient(ellipse at 85% 20%, rgba(124,58,237,0.05) 0%, transparent 35%),
    radial-gradient(ellipse at 50% 80%, rgba(244,114,182,0.03) 0%, transparent 40%),
    radial-gradient(ellipse at 20% 60%, rgba(56,189,248,0.03) 0%, transparent 30%),
    var(--bg);
  background-attachment: fixed;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-hover); }

/* --- App Header --- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(10, 13, 20, 0.8);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.app-header h1 {
  font-size: 1.15rem;
  font-weight: 700;
  background: var(--neon-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.02em;
}
.app-header nav {
  display: flex;
  gap: 6px;
  align-items: center;
}
.app-header nav a, .app-header nav button {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: var(--border-subtle);
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}
.app-header nav a:hover, .app-header nav button:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
  border-color: rgba(255,255,255,0.1);
}
.app-header nav a.active {
  color: var(--accent);
  background: var(--accent-light);
  border-color: rgba(0,212,255,0.25);
  font-weight: 600;
  box-shadow: 0 0 12px rgba(0,212,255,0.1);
}

.container { max-width: 1240px; margin: 0 auto; padding: 28px; }

/* --- Login Page --- */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(ellipse at 20% 20%, rgba(0,212,255,0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 80%, rgba(124,58,237,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 50%, rgba(244,114,182,0.04) 0%, transparent 60%),
              var(--bg);
}
.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 40px rgba(0,212,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  width: 100%;
  max-width: 420px;
  position: relative;
}
.login-card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 3px;
  background: var(--neon-gradient);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.login-card h1 {
  font-size: 1.5rem;
  text-align: center;
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.login-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 36px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 500;
}

/* --- Form --- */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 11px 16px;
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-darker);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group input:focus, .form-group select:focus {
  border-color: rgba(201,168,76,0.4);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-error { color: var(--danger); font-size: 0.82rem; margin-top: 6px; }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  letter-spacing: 0.01em;
}
.btn:hover {
  background: var(--bg-section);
  border-color: rgba(255,255,255,0.1);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }

.btn-accent {
  background: var(--neon-gradient);
  color: #fff;
  border: none;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,212,255,0.2), 0 4px 14px rgba(124,58,237,0.15);
}
.btn-accent:hover {
  box-shadow: 0 6px 22px rgba(0,212,255,0.35), 0 6px 22px rgba(124,58,237,0.25);
  transform: translateY(-2px);
}

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-danger { background: linear-gradient(135deg, #f87171, #ef4444); color: #fff; border: none; }
.btn-full { width: 100%; justify-content: center; }

/* --- Video Grid --- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}
.video-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--card-shadow);
  transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
}
.video-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--card-shadow-hover);
  border-color: rgba(0,212,255,0.2);
}
.video-card .thumbnail {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-darker);
  overflow: hidden;
}
.video-card .thumbnail img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.4s;
}
.video-card:hover .thumbnail img { transform: scale(1.04); }

.video-card .duration-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}
.video-card .info { padding: 16px; }
.video-card .info h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}
.video-card .info .meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}
.video-card .progress-bar {
  height: 3px;
  background: rgba(255,255,255,0.04);
}
.video-card .progress-bar .fill {
  height: 100%;
  background: var(--accent-gradient);
  transition: width 0.3s;
}

/* --- Category Sidebar --- */
.page-layout { display: flex; gap: 28px; }
.sidebar { width: 240px; flex-shrink: 0; }
.sidebar-nav {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--card-shadow);
  position: sticky;
  top: 72px;
}
.sidebar-nav a {
  display: flex;
  justify-content: space-between;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 0.2s;
}
.sidebar-nav a:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.04);
}
.sidebar-nav a.active {
  color: var(--accent);
  font-weight: 600;
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}
.sidebar-nav .count {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.main-content { flex: 1; min-width: 0; }

/* --- Video Player --- */
.player-wrapper {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  margin-bottom: 24px;
  border: var(--border-subtle);
}
.player-wrapper video {
  width: 100%;
  display: block;
  max-height: 70vh;
}
.video-info-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--card-shadow);
}
.video-info-card h2 { font-size: 1.25rem; margin-bottom: 8px; font-weight: 700; }
.video-info-card .desc { color: var(--text-secondary); font-size: 0.88rem; line-height: 1.7; }

/* --- Admin --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--card-shadow);
  position: relative;
  overflow: hidden;
  transition: all 0.3s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}
.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 2px;
  background: var(--neon-gradient);
  opacity: 0.7;
}
.stat-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  background: var(--neon-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.table-wrapper {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--card-shadow);
  overflow-x: auto;
}
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg-darker);
  border-bottom: var(--border-subtle);
}
th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
th:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
td {
  padding: 11px 14px;
  font-size: 0.84rem;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(201,168,76,0.03); }

.chip {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--bg-darker);
  border: var(--border-subtle);
  letter-spacing: 0.02em;
}
.chip-success { color: var(--success); border-color: rgba(74,222,128,0.2); }
.chip-warning { color: var(--warning); border-color: rgba(251,191,36,0.2); }
.chip-danger { color: var(--danger); border-color: rgba(248,113,113,0.2); }

/* --- Filters --- */
.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 24px;
  padding: 14px 16px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--card-shadow);
}
.filter-bar .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }
.filter-bar .form-group label { font-size: 0.7rem; margin-bottom: 4px; }
.filter-bar .form-group input, .filter-bar .form-group select {
  padding: 7px 12px;
  font-size: 0.82rem;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border-radius: var(--radius-lg);
  padding: 32px;
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 40px rgba(0,212,255,0.05);
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal h2 { margin-bottom: 20px; font-weight: 700; }

/* --- Pagination --- */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 28px;
}
.pagination button {
  padding: 7px 13px;
  border: var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}
.pagination button:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}
.pagination button.active {
  color: var(--accent);
  background: var(--accent-light);
  border-color: rgba(201,168,76,0.3);
  font-weight: 700;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 16px; opacity: 0.5; }

/* --- Search Bar --- */
.search-bar {
  position: relative;
  margin-bottom: 24px;
}
.search-bar input {
  width: 100%;
  padding: 13px 20px 13px 48px;
  border: var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s;
}
.search-bar input:focus {
  border-color: rgba(201,168,76,0.3);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.search-bar .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

/* --- Upload Area --- */
.upload-area {
  border: 2px dashed rgba(0,212,255,0.25);
  border-radius: var(--radius-lg);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: var(--bg-card);
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: var(--accent-glow);
}
.upload-area .icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.6; }
.upload-area p { color: var(--text-secondary); margin: 0; font-size: 0.9rem; }
.upload-area .hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 8px; }

.upload-progress { margin-top: 20px; display: none; }
.upload-progress.active { display: block; }
.upload-progress .file-name { font-weight: 600; margin-bottom: 8px; font-size: 0.88rem; }
.upload-progress .progress-track {
  height: 8px;
  border-radius: 4px;
  background: var(--bg-darker);
  overflow: hidden;
}
.upload-progress .progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent-gradient);
  transition: width 0.3s;
  box-shadow: 0 0 10px rgba(0,212,255,0.4);
}
.upload-progress .progress-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
  font-family: var(--font-mono);
}

/* --- Progress track (global) --- */
.progress-track {
  height: 8px;
  border-radius: 4px;
  background: var(--bg-darker);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent-gradient);
  transition: width 0.3s;
}

/* --- Speed Button --- */
.speed-btn.active {
  background: var(--accent-gradient) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 12px rgba(0,212,255,0.2);
}

/* --- Theme Toggle --- */
.theme-toggle {
  width: 34px;
  height: 34px;
  border: var(--border-subtle);
  border-radius: 50%;
  background: var(--bg-elevated);
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.theme-toggle:hover { background: var(--bg-section); }

/* --- ダウンロード防止 --- */
video::-webkit-media-controls-enclosure { overflow: hidden; }
video::-webkit-media-controls-panel { width: calc(100% + 30px); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .page-layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar-nav { position: static; }
  .video-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .app-header { flex-direction: column; gap: 12px; }
  .app-header nav { flex-wrap: wrap; justify-content: center; }
  .filter-bar { flex-direction: column; }
  .container { padding: 16px; }
}

@media (max-width: 480px) {
  .video-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* --- Accessibility --- */
.btn:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-contrast: high) {
  .card, .btn, .stat-card, .video-card { border: 2px solid var(--text-primary); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
@media (hover: none) {
  .btn:hover, .video-card:hover { transform: none; }
}

/* --- Print --- */
@media print {
  body { background: #fff; color: #000; }
  .app-header, .theme-toggle, .sidebar { display: none; }
}
