:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --bg-body: #f3f4f6;
  --bg-sidebar: #1f2937;
  --bg-header: #ffffff;
  --text-main: #111827;
  --text-secondary: #4b5563;
  --text-light: #9ca3af;
  --border-color: #e5e7eb;
  --radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

/* Layout - Admin Style */
.layui-layout-body {
  overflow: hidden;
}

.layui-layout {
  position: relative;
  width: 100%;
  height: 100vh;
}

/* Header */
.layui-header {
  height: 60px;
  background-color: var(--bg-header);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.layui-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.layui-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
}

.layui-nav-item {
  position: relative;
  margin-left: 20px;
}

.layui-nav-item a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 6px;
  transition: var(--transition);
}

.layui-nav-item a:hover {
  color: var(--primary);
  background-color: #f9fafb;
}

.layui-layout-right {
  margin-left: auto;
}

/* Sidebar */
.layui-side {
  position: fixed;
  top: 60px;
  left: 0;
  bottom: 0;
  width: 240px;
  background-color: var(--bg-sidebar);
  color: #fff;
  transition: var(--transition);
  box-shadow: var(--shadow);
  z-index: 900;
}

.layui-side-scroll {
  height: 100%;
  overflow-y: auto;
  padding: 16px 0;
}

.layui-nav-tree {
  width: 100%;
  display: block;
}

.layui-nav-tree .layui-nav-item {
  margin: 4px 12px;
  margin-left: 12px;
}

.layui-nav-tree .layui-nav-item a {
  display: block;
  color: #d1d5db;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
}

.layui-nav-tree .layui-nav-item a:hover,
.layui-nav-tree .layui-nav-item.layui-this a {
  background-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.4);
}

/* Main Content Area */
.layui-body {
  position: absolute;
  top: 60px;
  left: 240px;
  right: 0;
  bottom: 0;
  padding: 24px;
  overflow-y: auto;
  transition: var(--transition);
}

.layui-fluid {
  max-width: 1200px;
  margin: 0 auto;
}

/* Cards */
.layui-card, .card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  border: 1px solid rgba(229, 231, 235, 0.5);
  overflow: hidden;
  transition: var(--transition);
}

.layui-card:hover, .card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.layui-card-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 16px;
  color: var(--text-main);
  background-color: #fff;
}

.layui-card-body {
  padding: 24px;
  color: var(--text-secondary);
}

/* Panels (Simpler cards) */
.layui-panel {
  background: #fff;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  padding: 16px;
  margin-bottom: 16px;
}

/* Subcards (Cards inside cards) */
.spa-subcard {
  box-shadow: none !important;
  border: 1px solid var(--border-color);
  background: #f9fafb;
}

.spa-subcard .layui-card-header {
  background: #f9fafb;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
  padding: 12px 16px;
}

.spa-subcard .layui-card-body {
  padding: 16px;
}

/* Typography in Content */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  color: var(--text-main);
  font-weight: 700;
}

p {
  color: var(--text-secondary);
  margin-bottom: 16px;
}

/* Buttons */
.layui-btn, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  gap: 8px;
  text-decoration: none;
}

.layui-btn-normal, .btn.primary {
  background-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

.layui-btn-normal:hover, .btn.primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.4);
  transform: translateY(-1px);
}

.layui-btn-primary, .btn {
  background-color: #fff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.layui-btn-primary:hover, .btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: #f9fafb;
}

.layui-btn-danger {
  background-color: #ef4444;
  color: #fff;
}

.layui-btn-danger:hover {
  background-color: #dc2626;
}

.layui-btn-lg, .btn.big {
  padding: 12px 24px;
  font-size: 16px;
}

.layui-btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.layui-btn-xs {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
}

.layui-btn-fluid {
  width: 100%;
}

/* Forms */
.form, .layui-form {
  display: grid;
  gap: 16px;
}

.layui-form-item {
  margin-bottom: 16px;
}

.layui-input-block {
  margin-left: 0; /* Reset default Layui margin */
}

input, select, textarea, .layui-input, .layui-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  background-color: #f9fafb;
  color: var(--text-main);
}

input:focus, select:focus, textarea:focus, .layui-input:focus, .layui-textarea:focus {
  border-color: var(--primary);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input[type="checkbox"], input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  vertical-align: middle;
  margin-right: 8px;
  cursor: pointer;
}

/* Tables */
.layui-table, .table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0;
}

.layui-table th, .table th {
  background-color: #f9fafb;
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.layui-table td, .table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 14px;
}

.layui-table tr:last-child td {
  border-bottom: none;
}

.layui-table tr:hover td {
  background-color: #f9fafb;
}

/* Login / Register Container */
body:not(.layui-layout-body) {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

body:not(.layui-layout-body) .container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

body:not(.layui-layout-body) .card {
  padding: 40px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body:not(.layui-layout-body) h2 {
  text-align: center;
  margin-bottom: 32px;
  font-size: 24px;
  color: var(--text-main);
}

/* Utilities */
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* SPA / Custom Styles */
.spa-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  margin: 16px 0;
  letter-spacing: -0.02em;
}

.spa-warn, .warn {
  color: #ef4444;
  font-size: 14px;
  margin: 8px 0;
  padding: 10px 14px;
  background-color: #fef2f2;
  border-radius: 6px;
  border: 1px solid #fee2e2;
  display: flex;
  align-items: center;
}

.spa-tip, .tip {
  color: var(--text-light);
  font-size: 13px;
  margin-top: 8px;
}

.spa-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.spa-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}

/* Flash Messages */
.flash, .spa-flash {
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 14px;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  font-weight: 500;
}

.flash.success, .spa-flash.success {
  background-color: #ecfdf5;
  color: #047857;
  border-color: #d1fae5;
}

.flash.error, .spa-flash.error {
  background-color: #fef2f2;
  color: #b91c1c;
  border-color: #fee2e2;
}

.flash.info, .spa-flash.info {
  background-color: #eff6ff;
  color: #1d4ed8;
  border-color: #dbeafe;
}

/* Grid System */
.layui-row {
  display: flex;
  flex-wrap: wrap;
  margin: -12px;
}

.layui-col-space12 > * {
  padding: 12px;
}

.layui-col-xs12 { width: 100%; }
.layui-col-xs6 { width: 50%; }

@media (min-width: 768px) {
  .layui-col-sm4 { width: 33.3333%; }
  .layui-col-sm6 { width: 50%; }
  .layui-col-sm8 { width: 66.6667%; }

  .course-layout .layui-col-sm4 { width: 40%; }
  .course-layout .layui-col-sm8 { width: 60%; }
}

@media (min-width: 992px) {
  .layui-col-md2 { width: 16.6667%; }
  .layui-col-md3 { width: 25%; }
  .layui-col-md4 { width: 33.3333%; }
}

/* Responsive */
@media screen and (max-width: 768px) {
  .layui-side {
    transform: translateX(-100%);
  }
  
  .layui-body {
    left: 0;
    padding: 16px;
  }
  
  .layui-layout-admin .layui-side.show {
    transform: translateX(0);
  }
  
  .spa-toggle {
    display: block;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    font-style: normal;
    letter-spacing: 1px;
    padding: 8px;
  }
  
  .layui-logo {
    font-style: normal;
    letter-spacing: 0.5px;
    font-size: 16px;
    white-space: nowrap;
  }

  .layui-nav-item {
    margin-left: 10px;
  }

  .layui-nav-item a {
    letter-spacing: 1px;
    font-style: normal;
    padding: 8px 10px;
  }
}

.course-layout .layui-menu-item a {
  font-size: 13px;
  line-height: 1.35;
  white-space: normal;
  word-break: break-all;
}

.spa-player-title {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  word-break: break-all;
}

.spa-file-viewer {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #0b1220;
}

.spa-file-viewer iframe {
  width: 100%;
  height: 60vh;
  border: 0;
  background: #fff;
}

.spa-file-viewer img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  background: #fff;
}

/* New Course Layout */
.course-player-box {
  margin-bottom: 32px;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  background: #000;
  transition: transform 0.3s ease;
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

@media screen and (min-width: 900px) {
  .course-player-box {
    margin: 24px auto 32px;
    border-radius: 16px;
    max-width: 1200px;
  }
}

.course-player-box > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100% !important;
  height: 100% !important;
}

.course-container {
  max-width: 100%;
  margin: 0 auto;
  position: relative;
}

.back-btn {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 100;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.back-btn:hover {
  background: rgba(0, 0, 0, 0.6);
  transform: scale(1.05);
  color: #fff;
}

.course-header-info {
  text-align: center;
  padding: 40px 20px;
  background: #fff;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
}

.course-header-info h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-main);
}

.course-header-info p {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 600px;
  margin: 0 auto;
}

@media screen and (min-width: 900px) {
  .course-header-info {
    padding: 60px 0;
    margin-bottom: 40px;
    background: linear-gradient(to bottom, #ffffff, #f9fafb);
  }
  
  .back-btn {
    top: 24px;
    left: 24px;
    background: #fff;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
  }
}

.course-chapters {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 12px;
}

.chapter-item {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 16px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(229, 231, 235, 0.5);
  overflow: hidden;
  transition: all 0.3s ease;
}

.chapter-item:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);
  border-color: rgba(79, 70, 229, 0.2);
}

.chapter-title {
  padding: 20px 24px;
  font-weight: 600;
  font-size: 17px;
  color: var(--text-main);
  background: linear-gradient(to right, #ffffff, #f9fafb);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: all 0.3s ease;
  position: relative;
}

.chapter-title:hover {
  color: var(--primary);
  background: linear-gradient(to right, #f9fafb, #f3f4f6);
}

.chapter-icon {
  font-size: 12px;
  color: var(--text-light);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: #f3f4f6;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.chapter-title:hover .chapter-icon {
  background: #e0e7ff;
  color: var(--primary);
}

.chapter-lessons {
  border-top: 1px solid rgba(229, 231, 235, 0.5);
  background: #fff;
}

.lesson-item {
  border-bottom: 1px solid rgba(243, 244, 246, 0.8);
}

.lesson-item:last-child {
  border-bottom: none;
}

.lesson-link {
  display: flex;
  align-items: center;
  padding: 16px 32px;
  color: var(--text-secondary);
  font-size: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.lesson-link:hover {
  background-color: #f8fafc;
  color: var(--primary);
  padding-left: 38px;
  border-left-color: var(--primary);
}

.lesson-icon {
  margin-right: 16px;
  font-size: 10px;
  color: #d1d5db;
  transition: all 0.3s;
  background: #f9fafb;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.lesson-link:hover .lesson-icon {
  background: var(--primary);
  color: #fff;
  transform: scale(1.1);
}

.lesson-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-light);
  font-size: 14px;
  background: #f9fafb;
}
