:root {
  --bg-primary: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #293548;
  --bg-input: #0f172a;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-gold: #fbbf24;
  --accent-gold-hover: #f59e0b;
  --accent-telegram: #229ed9;
  --border-color: #334155;
  --border-focus: #fbbf24;
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --success: #10b981;
  --font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

/* Containers */
.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 16px;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-bottom: 32px;
}

/* Helper Utilities */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.flex-1 {
  flex: 1;
}

/* Admin Bar */
.admin-bar {
  background-color: #1a162b;
  border-bottom: 1px solid #4338ca;
  padding: 8px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-bar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a5b4fc;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Header */
.channel-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 24px 0 16px;
}

.logo-wrapper {
  width: 105px;
  height: 105px;
  border-radius: var(--radius-full);
  padding: 3px;
  background: linear-gradient(135deg, #fbbf24, #b45309);
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.25);
  margin-bottom: 12px;
}

.channel-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-full);
  display: block;
}

.channel-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--accent-gold);
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.channel-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 320px;
}

/* Navigation Bar */
.nav-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 16px;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.btn-back:hover, .btn-back:active {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-gold);
}

.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.breadcrumb-item {
  color: var(--text-secondary);
  cursor: pointer;
}

.breadcrumb-item:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: var(--text-primary);
  font-weight: 700;
  cursor: default;
  text-decoration: none;
}

.breadcrumb-separator {
  color: var(--text-muted);
  user-select: none;
}

/* View Section & Headings */
.view-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-heading {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.section-instruction {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: -8px;
  margin-bottom: 4px;
}

/* Subjects Grid: 2 columns on mobile, adapts to larger screens */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 640px) {
  .subjects-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }
}

.subject-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  cursor: pointer;
  position: relative;
  min-height: 105px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, border-color 0.15s ease, background-color 0.15s ease;
  user-select: none;
}

.subject-card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-gold);
}

.subject-card:active {
  transform: scale(0.98);
}

.subject-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: auto 0;
  word-break: break-word;
  line-height: 1.4;
}

.subject-actions {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-color);
}

/* Choice Cards: Duo (Theory / Practical) */
.cards-duo {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* Choice Cards: Trio (Lectures / Questions / Videos) */
.cards-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@media (max-width: 380px) {
  .cards-trio {
    grid-template-columns: 1fr;
  }
}

.choice-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  color: var(--text-primary);
  font-family: inherit;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}

.choice-card:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--accent-gold);
}

.choice-card:active {
  transform: scale(0.98);
}

.choice-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
  line-height: 1;
}

.choice-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.choice-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Content Items List */
.content-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.content-item-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.content-item-card:hover {
  border-color: var(--accent-gold);
  background-color: var(--bg-card-hover);
}

.content-item-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.content-number-badge {
  background-color: rgba(251, 191, 36, 0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(251, 191, 36, 0.3);
  font-size: 0.85rem;
  font-weight: 800;
  min-width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.content-item-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.content-tg-action {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(34, 158, 217, 0.15);
  color: var(--accent-telegram);
  border: 1px solid rgba(34, 158, 217, 0.35);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.content-tg-action:hover {
  background-color: rgba(34, 158, 217, 0.25);
}

.content-student-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.content-pdf-view {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(251, 191, 36, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.content-pdf-view:hover {
  background-color: rgba(251, 191, 36, 0.25);
}

.content-pdf-download {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.content-pdf-download:hover {
  background-color: rgba(16, 185, 129, 0.25);
}

.pdf-meta-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.current-file-tag {
  background-color: rgba(251, 191, 36, 0.1);
  border: 1px dashed rgba(251, 191, 36, 0.3);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--accent-gold);
}

.content-admin-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 0.95rem;
  background-color: rgba(30, 41, 59, 0.5);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-sm {
  font-size: 0.8rem;
  padding: 6px 10px;
}

.btn-primary {
  background-color: var(--accent-gold);
  color: #0f172a;
}

.btn-primary:hover {
  background-color: var(--accent-gold-hover);
}

.btn-secondary {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--text-muted);
}

.btn-outline-danger {
  background-color: transparent;
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-outline-danger:hover {
  background-color: var(--danger-bg);
  color: #f87171;
}

.btn-icon-sm {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  cursor: pointer;
}

.btn-icon-sm:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

.btn-icon-sm.delete:hover {
  color: var(--danger);
  border-color: var(--danger);
}

/* Footer */
.app-footer {
  margin-top: auto;
  padding-top: 32px;
  text-align: center;
  border-top: 1px solid rgba(51, 65, 85, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-text {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.admin-link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 8px;
  text-decoration: underline;
  opacity: 0.7;
}

.admin-link-btn:hover {
  opacity: 1;
  color: var(--text-secondary);
}

/* Modals */
.modal-dialog {
  border: none;
  border-radius: var(--radius-lg);
  background: transparent;
  padding: 0;
  max-width: 440px;
  width: 90%;
  margin: auto;
  box-shadow: var(--shadow-md);
}

.modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
}

.modal-box {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px 8px;
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  border-color: var(--border-focus);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.alert-error {
  background-color: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

/* Video Modal & Player */
.modal-video-dialog {
  max-width: 640px;
  width: 95%;
}

.modal-video-box {
  padding: 16px;
}

.video-container {
  width: 100%;
  background-color: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 6px 0;
}

.video-element {
  width: 100%;
  max-height: 60vh;
  display: block;
  outline: none;
}

.video-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

/* Radio Toggle for Video Source */
.radio-toggle-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: var(--bg-input);
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
}

.radio-label input[type="radio"] {
  accent-color: var(--accent-gold);
  cursor: pointer;
}

/* Progress Bar */
.progress-bar-wrapper {
  width: 100%;
  height: 8px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #fbbf24, #10b981);
  transition: width 0.2s ease;
}

/* Content Video Actions */
.content-video-watch {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: background-color 0.15s ease;
}

.content-video-watch:hover {
  background-color: rgba(168, 85, 247, 0.25);
}

.content-video-download {
  display: flex;
  align-items: center;
  gap: 4px;
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.content-video-download:hover {
  background-color: rgba(16, 185, 129, 0.25);
}
