/* ===================== VARIABLES ===================== */
:root {
  --bg: #0a0d12;
  --bg2: #0f1318;
  --bg3: #151b22;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.12);
  --accent: #00e5ff;
  --accent2: #7c4dff;
  --green: #00e676;
  --text: #e8edf2;
  --text2: #8a95a3;
  --text3: #5a6470;
  --card-bg: rgba(15,19,24,0.9);
  --header-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Syne', sans-serif;
}

/* ===================== RESET ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===================== BACKGROUND GRID ===================== */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0,229,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,229,255,0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

/* ===================== PAGES ===================== */
.page { display: none; position: relative; min-height: 100vh; }
.page.active { display: block; }

/* ===================== HEADER ===================== */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: rgba(10,13,18,0.85);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.logo-icon {
  color: var(--accent);
  font-size: 1.4rem;
  line-height: 1;
}

.admin-btn {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text2);
  text-decoration: none;
  padding: 7px 18px;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.admin-btn:hover { color: var(--accent); border-color: var(--accent); }

.back-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text2);
  background: none;
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.back-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ===================== HOME MAIN ===================== */
.home-main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 40px 80px;
}

.hero {
  margin-bottom: 60px;
}
.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(0,229,255,0.08);
  border: 1px solid rgba(0,229,255,0.2);
  padding: 5px 14px;
  border-radius: 30px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(3rem, 7vw, 5.5rem);
  font-weight: 800;
  line-height: 1.0;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 16px;
}
.hero h1 .accent {
  color: var(--accent);
  position: relative;
}
.hero-sub {
  font-size: 1rem;
  color: var(--text2);
  font-weight: 400;
  max-width: 420px;
}

/* ===================== PRACTICALS GRID ===================== */
.practicals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.practical-card {
  position: relative;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.practical-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0,229,255,0.04) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
}
.practical-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,229,255,0.1);
}
.practical-card:hover::before { opacity: 1; }

.card-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  opacity: 0.7;
  margin-bottom: 12px;
  text-transform: uppercase;
}
.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.3;
}
.card-desc {
  font-size: 0.82rem;
  color: var(--text2);
  line-height: 1.6;
  margin-bottom: 20px;
  min-height: 40px;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.card-tag {
  font-size: 0.68rem;
  font-weight: 600;
  font-family: var(--mono);
  color: var(--text3);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
}
.card-tag.has-code { color: var(--green); border-color: rgba(0,230,118,0.3); background: rgba(0,230,118,0.05); }
.card-tag.has-img { color: var(--accent2); border-color: rgba(124,77,255,0.3); background: rgba(124,77,255,0.05); }

.card-arrow {
  color: var(--text3);
  transition: transform 0.2s, color 0.2s;
}
.practical-card:hover .card-arrow { color: var(--accent); transform: translateX(4px); }

/* ===================== DETAIL PAGE ===================== */
.detail-content {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 50px 40px 80px;
}

.detail-header {
  margin-bottom: 44px;
}
.detail-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(0,229,255,0.08);
  border: 1px solid rgba(0,229,255,0.2);
  padding: 5px 14px;
  border-radius: 30px;
  margin-bottom: 16px;
}
#detail-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 12px;
  line-height: 1.15;
}
.detail-desc {
  font-size: 0.95rem;
  color: var(--text2);
  line-height: 1.7;
  max-width: 640px;
}

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 12px;
}

/* Image */
.detail-img-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.detail-img {
  width: 100%;
  max-height: 440px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
}

/* Code */
.detail-code-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.code-header .section-label { margin-bottom: 0; }

.copy-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text2);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { color: var(--green); border-color: rgba(0,230,118,0.5); }

.code-block {
  margin: 0;
  padding: 24px 20px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.75;
  color: #a8d8ea;
  background: transparent;
  white-space: pre;
}

/* ===================== ADMIN PANEL ===================== */
.admin-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - var(--header-h));
}

.admin-sidebar {
  background: var(--bg2);
  border-right: 1px solid var(--border);
  padding: 28px 0;
}
.admin-sidebar-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text3);
  padding: 0 20px 16px;
}
.admin-nav {
  display: flex;
  flex-direction: column;
}
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.admin-nav-item:hover { color: var(--text); background: rgba(255,255,255,0.03); }
.admin-nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(0,229,255,0.04); }
.admin-nav-item .nav-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border2);
  flex-shrink: 0;
}
.admin-nav-item.has-data .nav-dot { background: var(--green); }

.admin-form-area {
  padding: 36px 44px;
  overflow-y: auto;
  max-height: calc(100vh - var(--header-h));
}
.admin-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}
.admin-form-header h3 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.save-status {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green);
  opacity: 0;
  transition: opacity 0.3s;
}
.save-status.show { opacity: 1; }

.form-group {
  margin-bottom: 22px;
}
.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}
.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea.code-textarea {
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.7;
  color: #a8d8ea;
}

.img-upload-area {
  background: var(--bg3);
  border: 2px dashed var(--border2);
  border-radius: var(--radius-sm);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  margin-bottom: 10px;
  transition: border-color 0.2s;
}
.img-upload-area:hover { border-color: var(--accent); }
#img-preview-wrap p {
  font-size: 0.85rem;
  color: var(--text3);
  margin-top: 10px;
}
#img-preview {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 8px;
}

.upload-btn, .clear-img-btn {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 8px;
}
.upload-btn {
  background: rgba(0,229,255,0.08);
  border: 1px solid rgba(0,229,255,0.25);
  color: var(--accent);
}
.upload-btn:hover { background: rgba(0,229,255,0.15); }
.clear-img-btn {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border2);
  color: var(--text3);
}
.clear-img-btn:hover { color: var(--text); border-color: var(--border2); }

.save-btn {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 12px 32px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.save-btn:hover { background: #33eaff; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,229,255,0.3); }

.form-actions { margin-top: 12px; }

/* ===================== EMPTY STATE ===================== */
.empty-card {
  border-style: dashed;
  opacity: 0.5;
  pointer-events: none;
}
.empty-card .card-title { color: var(--text3); }

/* ===================== PASSWORD MODAL ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.modal-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}
.modal-box h3 {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.modal-box p {
  font-size: 0.85rem;
  color: var(--text2);
  margin-bottom: 20px;
}
.modal-box input[type="password"] {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  text-align: center;
  letter-spacing: 0.1em;
  transition: border-color 0.2s;
  margin-bottom: 8px;
}
.modal-box input[type="password"]:focus { border-color: var(--accent); }
.pwd-error {
  font-size: 0.78rem;
  color: #ff5370;
  min-height: 20px;
  margin-bottom: 16px;
}
.modal-btns {
  display: flex;
  gap: 10px;
}
.modal-cancel, .modal-confirm {
  flex: 1;
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.modal-cancel {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border2);
  color: var(--text2);
}
.modal-cancel:hover { color: var(--text); }
.modal-confirm {
  background: var(--accent);
  border: none;
  color: #000;
}
.modal-confirm:hover { background: #33eaff; }

/* ===================== DETAIL FOOTER ===================== */
.detail-footer {
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-start;
}
.footer-back-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text2);
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 10px 22px;
  cursor: pointer;
  transition: all 0.2s;
}
.footer-back-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateX(-3px);
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  header { padding: 0 20px; }
  .home-main { padding: 40px 20px 60px; }
  .detail-content { padding: 32px 20px 60px; }
  .admin-content { grid-template-columns: 1fr; }
  .admin-sidebar { border-right: none; border-bottom: 1px solid var(--border); padding: 16px 0; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; padding: 0 16px; gap: 6px; }
  .admin-nav-item { border-left: none; border-bottom: 3px solid transparent; border-radius: 6px; }
  .admin-nav-item.active { border-left-color: transparent; border-bottom-color: var(--accent); }
  .admin-form-area { padding: 24px 20px; max-height: none; }
}
