/* =====================================================
   SAS Knowledge Base - DOS/Terminal Dark Theme
   ===================================================== */

/* ==================== RESET & BASE ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Modern Grayscale Palette */
  --bg-primary: #fafafa;
  --bg-secondary: #f5f5f5;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f8f9fa;
  --border-color: #e5e7eb;
  --border-light: #f3f4f6;

  /* Text Colors */
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-inverse: #ffffff;

  /* Accent Colors - Dark Charcoal */
  --accent-primary: #161616;
  --accent-hover: #000000;
  --accent-light: #f5f5f5;
  --accent-border: #4b5563;

  /* Semantic Colors */
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --error: #ef4444;
  --error-light: #fee2e2;
  --success: #10b981;
  --success-light: #d1fae5;

  /* Shadows - Subtle and refined */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==================== TYPOGRAPHY ==================== */
h1, h2, h3, h4, h5, h6 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.5rem;
}

code, pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

/* ==================== NAVIGATION ==================== */
.navbar {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-color);
  padding: 0;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.nav-left,
.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: all 0.2s ease;
}

.logo:hover {
  color: var(--accent-primary);
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.btn-create {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-weight: 600;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
}

.nav-link.btn-create:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}

.nav-link.btn-back {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  font-weight: 600;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
}

.nav-link.btn-back:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}

.nav-link.btn-edit {
  background: #161616;
  color: var(--text-inverse);
  border: 1px solid #161616;
  font-weight: 600;
  padding: 0.5rem 1rem;
  transition: all 0.2s ease;
}

.nav-link.btn-edit:hover {
  background: #000000;
  border-color: #000000;
  box-shadow: var(--shadow-sm);
}

.user-name {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
}

/* Dropdown Styles */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-family: inherit;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--border-color);
}

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

.dropdown-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color);
  margin: 0.5rem 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 1rem;
  }

  .nav-right {
    gap: 0.25rem;
  }

  .user-name {
    padding: 0.5rem;
    font-size: 0.75rem;
  }

  .nav-link {
    padding: 0.5rem;
    font-size: 0.75rem;
  }

  .dropdown-menu {
    right: -1rem;
  }
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  min-height: calc(100vh - 180px);
  padding: 0;
}

.container {
  max-width: 1200px;
  margin: 35px auto 0;
  padding: 0 2rem;
}

/* ==================== BUTTONS ==================== */
.btn-primary {
  background: var(--accent-primary);
  color: var(--text-inverse);
  font-weight: 600;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

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

.btn-danger {
  background: var(--error);
  color: var(--text-inverse);
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
  background: #dc2626;
  box-shadow: var(--shadow-md);
}

/* ==================== FORMS ==================== */
.terminal-input,
.form-group input,
.form-group textarea,
.form-group select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  width: 100%;
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.terminal-input:focus,
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
  outline: none;
}

.terminal-input::placeholder,
.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ==================== AUTHENTICATION PAGES ==================== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}

.auth-container {
  width: 100%;
  max-width: 500px;
}

.auth-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.auth-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  text-align: center;
  letter-spacing: -0.01em;
  font-family: "Baskervville", serif;
  font-optical-sizing: auto;
  font-style: normal;
}

.auth-form {
  margin-bottom: 1.5rem;
}

.auth-link {
  text-align: center;
  color: var(--text-secondary);
}

.auth-link a {
  color: var(--accent-primary);
  text-decoration: none;
}

.auth-link a:hover {
  text-decoration: underline;
}

/* ==================== SEARCH SECTION ==================== */
.search-section {
  margin-bottom: 3rem;
}

.search-section h2 {
  color: var(--accent-primary);
  margin-bottom: 1.5rem;
}

.search-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.search-bar input {
  flex: 1;
}

.search-bar button {
  padding: 12px 24px;
}

.filters {
  display: flex;
  gap: 1rem;
}

.filters select {
  flex: 1;
  max-width: 200px;
}

/* ==================== SOP CARDS ==================== */
.sops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}

.sop-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.2s ease;
  text-decoration: none;
  color: var(--text-primary);
  display: block;
  position: relative;
  box-shadow: var(--shadow-xs);
}

.sop-card:hover {
  border-color: var(--accent-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.sop-type-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  padding: 4px 12px;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sop-type-badge.text {
  background: rgba(0, 217, 255, 0.2);
  color: var(--accent-secondary);
  border-color: var(--accent-secondary);
}

.sop-type-badge.video {
  background: rgba(0, 255, 159, 0.2);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.sop-icon {
  font-size: 3rem;
  text-align: center;
  margin: 2rem 0;
}

.sop-thumbnail {
  position: relative;
  margin-bottom: 1rem;
}

.sop-thumbnail img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 3rem;
  color: var(--accent-primary);
}

.sop-title {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.sop-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.sop-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.category-tag {
  background: rgba(0, 255, 159, 0.1);
  color: var(--accent-primary);
  padding: 4px 8px;
  border: 1px solid var(--accent-primary);
  font-family: 'IBM Plex Mono', monospace;
}

.view-count {
  color: var(--text-muted);
}

/* ==================== SOP VIEW PAGE ==================== */
.sop-header {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.sop-page-title {
  font-size: 2rem;
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.sop-meta-bar {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.tags-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.tag {
  background: rgba(0, 217, 255, 0.1);
  color: var(--accent-secondary);
  padding: 4px 12px;
  border: 1px solid var(--accent-secondary);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
}

.sop-content-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 2rem;
  margin-bottom: 2rem;
}

.sop-description {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.sop-content {
  line-height: 1.8;
}

.sop-content h1,
.sop-content h2,
.sop-content h3 {
  color: var(--accent-primary);
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.sop-content p {
  margin-bottom: 1rem;
  font-size: 14px;
}

.sop-content ul,
.sop-content ol {
  margin-left: 2rem;
  margin-bottom: 1rem;
}

.sop-content code {
  background: var(--bg-primary);
  padding: 2px 6px;
  border: 1px solid var(--border-color);
  color: var(--accent-secondary);
}

.sop-content pre {
  background: var(--bg-primary);
  padding: 1rem;
  border: 1px solid var(--border-color);
  overflow-x: auto;
  margin-bottom: 1rem;
}

.video-placeholder {
  background: var(--bg-primary);
  border: 2px dashed var(--border-color);
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-secondary);
}

.video-placeholder p {
  margin-bottom: 0.5rem;
}

/* ==================== COMMENTS ==================== */
.comments-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 2rem;
  margin-top: 2rem;
}

.comments-section h3 {
  color: var(--accent-primary);
  margin-bottom: 1.5rem;
}

.comments-list {
  margin-bottom: 2rem;
}

.comment {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 1rem;
  margin-bottom: 1rem;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

.comment-author {
  color: var(--accent-primary);
  font-family: 'IBM Plex Mono', monospace;
}

.comment-date {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 1rem;
}

.comment-actions {
  display: flex;
  gap: 0.5rem;
}

.comment-text {
  color: var(--text-primary);
  line-height: 1.6;
}

.comment-edit-form {
  margin-top: 0.5rem;
}

.comment-edit-textarea {
  width: 100%;
  margin-bottom: 0.5rem;
}

.comment-edit-actions {
  display: flex;
  gap: 0.5rem;
}

.comment-form {
  margin-top: 1.5rem;
}

/* ==================== ADMIN ACTIONS ==================== */
.admin-actions {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
}

.status-badge {
  padding: 4px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.status-badge.draft {
  background: rgba(251, 191, 36, 0.2);
  color: var(--warning);
  border: 1px solid var(--warning);
}

/* ==================== SOP FORM ==================== */
.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.75rem;
}

.sop-form {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.form-section {
  margin-bottom: 0;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
  border-bottom: none;
}

.form-section:first-child {
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
}

.form-section:last-child {
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.form-section h3 {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1.125rem;
  margin-bottom: 1.25rem;
}

.form-grid-two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-group-full {
  grid-column: 1 / -1;
}

@media (max-width: 768px) {
  .form-grid-two-column {
    grid-template-columns: 1fr;
  }
}

.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
}

.radio-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: all 0.2s ease;
}

.radio-label:hover {
  background: var(--bg-elevated);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
}

.radio-label input[type="radio"] {
  display: none;
}

.radio-label input[type="radio"]:checked + span {
  color: var(--text-inverse);
}

.radio-label:has(input[type="radio"]:checked) {
  background: #161616;
  border-color: #161616;
  border-width: 2px;
  box-shadow: var(--shadow-md);
  color: var(--text-inverse);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
  border-bottom-left-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
}

.type-display {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--accent-primary);
  padding: 12px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
}

.info-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

/* Quill Editor Customization */
#editor {
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 400px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ql-toolbar {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color) !important;
  flex-shrink: 0;
}

.ql-container {
  border: 1px solid var(--border-color) !important;
  font-size: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.ql-editor {
  color: var(--text-primary);
  flex: 1;
  min-height: 350px;
  padding: 1rem;
}

.ql-editor.ql-blank::before {
  color: var(--text-muted);
}

/* ==================== ERROR PAGES ==================== */
.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.error-container {
  max-width: 600px;
  width: 100%;
  padding: 2rem;
}

.error-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 3rem;
  text-align: center;
}

.error-code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 3rem;
  color: var(--error);
  margin-bottom: 1rem;
}

.error-message {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1.25rem;
}

/* ==================== MESSAGES ==================== */
.error-message {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.error-message p{
  font-size:13px;
  text-align: center;
}

.success-message {
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.no-sops {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

.no-sops p {
  margin-bottom: 1rem;
}

/* ==================== SEARCH INFO ==================== */
.search-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.results-count {
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
}

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-top: 3rem;
  padding: 2rem 0;
}

.page-info {
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
}

/* ==================== FOOTER ==================== */
.footer {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border-light);
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  margin-top: 4rem;
  font-size: 0.875rem;
}

/* ==================== CATEGORY MANAGEMENT ==================== */
.category-form-section,
.categories-list-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 2rem;
  margin-bottom: 2rem;
}

.category-form-section h2,
.categories-list-section h2 {
  color: var(--accent-primary);
  margin-bottom: 1.5rem;
}

.category-form {
  max-width: 800px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.categories-table {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.reorder-hint {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  font-style: italic;
}

.category-item {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: all 0.3s ease;
  cursor: grab;
}

.category-item:active {
  cursor: grabbing;
}

.category-item:hover {
  border-color: var(--accent-primary);
}

.drag-handle {
  display: flex;
  align-items: center;
  margin-right: 1rem;
  color: var(--text-muted);
  cursor: grab;
}

.drag-handle:active {
  cursor: grabbing;
}

.category-info {
  flex: 1;
}

.category-name {
  color: var(--accent-primary);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.category-dept {
  color: var(--text-secondary);
  margin-left: 0.5rem;
}

.category-desc {
  color: var(--text-secondary);
  margin: 0.5rem 0;
}

.category-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.5rem;
}

.category-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.no-categories {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

#userMenuDropdown i{
  font-size: 18px;
}

/* ==================== MODAL ==================== */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 14, 20, 0.9);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-secondary);
  border: 2px solid var(--accent-primary);
  padding: 2rem;
  max-width: 600px;
  width: 90%;
  box-shadow: 0 0 40px rgba(0, 255, 159, 0.3);
}

.modal-content h2 {
  color: var(--accent-primary);
  margin-bottom: 1.5rem;
}

/* ==================== VIDEO RECORDING ==================== */
.recording-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 2rem;
  margin-bottom: 2rem;
}

.recording-section h2 {
  color: var(--accent-primary);
  margin-bottom: 1.5rem;
}

.sop-title-ref {
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.preview-container {
  position: relative;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  margin-bottom: 2rem;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.preview-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.recording-indicator {
  position: absolute;
  top: 1rem;
  left: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.8);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  color: white;
  font-size: 1.25rem;
}

.rec-dot {
  width: 12px;
  height: 12px;
  background: var(--error);
  border-radius: 50%;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.2);
  }
}

.pip-indicator {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  background: rgba(0, 0, 0, 0.8);
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--secondary);
  font-size: 0.875rem;
  border: 1px solid var(--secondary);
}

.recording-controls {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group label {
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
  text-transform: uppercase;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.recording-info {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.recording-info p {
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
  margin-bottom: 0.5rem;
}

.recording-info span {
  color: var(--accent-primary);
  margin-left: 1rem;
}

/* Upload Progress */
.upload-progress {
  margin-bottom: 2rem;
}

.progress-bar {
  width: 100%;
  height: 40px;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  overflow: hidden;
  margin-bottom: 1rem;
}

.progress-fill {
  height: 100%;
  background: #000000;
  transition: width 0.3s ease;
  width: 0%;
}

#uploadStatus {
  color: var(--text-primary);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  text-align: center;
  margin-bottom: 0.5rem;
}

#uploadPercent {
  color: var(--accent-primary);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 2rem;
  text-align: center;
  font-weight: 700;
}

.processing-info {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  padding: 1.5rem;
  margin-top: 2rem;
  text-align: center;
}

.processing-info .info-text {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

/* Video Player */
.video-player-container {
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  margin-bottom: 2rem;
  aspect-ratio: 16 / 9;
}

.video-js {
  width: 100%;
  height: 100%;
}

.video-js .vjs-big-play-button {
  border-color: var(--accent-primary);
  background-color: rgba(0, 255, 159, 0.2);
}

.video-js .vjs-control-bar {
  background-color: rgba(10, 14, 20, 0.9);
}

.video-js .vjs-play-progress {
  background-color: var(--accent-primary);
}

/* ==================== TRIM UI ==================== */
.trim-timeline-container {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.trim-time-displays {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.time-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.time-display label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  font-weight: 600;
}

.time-display span {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.trim-slider-wrapper {
  margin-bottom: 1rem;
}

.timeline-track {
  position: relative;
  height: 50px;
  background: linear-gradient(135deg, #4B5563 0%, #6B7280 100%);
  border-radius: 8px;
  cursor: pointer;
  overflow: visible;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.timeline-selection {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(135deg, #1F2937 0%, #374151 100%);
  border-radius: 8px;
  pointer-events: none;
  transition: all 0.1s ease;
}

.timeline-handle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 60px;
  background: white;
  border: 3px solid #3B82F6;
  border-radius: 6px;
  cursor: ew-resize;
  pointer-events: all;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.timeline-handle:hover {
  background: #F0F9FF;
  border-color: #2563EB;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  transform: translateY(-50%) scale(1.05);
}

.timeline-handle:active {
  background: #DBEAFE;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.5);
}

.timeline-handle svg {
  pointer-events: none;
}

.timeline-handle-start {
  left: -18px;
}

.timeline-handle-end {
  right: -18px;
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

.trim-info {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: 8px;
  margin: 1.5rem 0;
}

.trim-info p {
  margin: 0.5rem 0;
  font-family: 'IBM Plex Mono', monospace;
}

.trim-status {
  color: var(--accent-primary);
  font-size: 0.875rem;
  margin-top: 0.5rem !important;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .sops-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  }
}

@media (max-width: 768px) {
  .nav-container {
    height: auto;
    min-height: 64px;
    padding: 1rem;
  }

  .nav-left {
    flex: 1;
  }

  .nav-right {
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .nav-link {
    font-size: 0.75rem;
    padding: 0.5rem;
    white-space: nowrap;
  }

  .logo {
    font-size: 1rem;
  }

  .sops-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    flex-direction: column;
  }

  .filters select {
    max-width: 100%;
  }

  .form-actions {
    flex-direction: column;
  }

  .admin-actions {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }

  .auth-box {
    padding: 2rem;
  }

  .sop-form {
    padding: 1.5rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.5rem;
  }
}

/* ==================== ANIMATIONS ==================== */
@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(0, 255, 159, 0.5);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 255, 159, 0.8);
  }
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus indicators */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ==================== USER MANAGEMENT ==================== */
.users-table-section {
  margin-top: 3rem;
}

.table-container {
  overflow-x: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  margin-top: 1rem;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.9rem;
}

.users-table thead {
  background: var(--bg-primary);
  border-bottom: 2px solid var(--accent-primary);
}

.users-table th {
  padding: 1rem;
  text-align: left;
  color: var(--accent-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem;
}

.users-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.users-table tr:hover {
  background: rgba(0, 255, 159, 0.05);
}

.role-badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: 'IBM Plex Mono', monospace;
}

.role-badge.admin {
  background: rgba(0, 255, 159, 0.2);
  color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
}

.role-badge.employee {
  background: rgba(0, 217, 255, 0.2);
  color: var(--accent-secondary);
  border: 1px solid var(--accent-secondary);
}

.invite-form {
  margin-top: 1rem;
}

.success-message {
  background: rgba(16, 185, 129, 0.1);
  border-left: 4px solid var(--success);
  padding: 1rem;
  margin-bottom: 1.5rem;
  color: var(--success);
}

.success-message p {
  margin: 0;
  font-family: 'IBM Plex Mono', monospace;
}

.help-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
  font-family: 'IBM Plex Mono', monospace;
}

.btn-link-danger {
  color: var(--error) !important;
}

.btn-link-danger:hover {
  color: var(--error) !important;
  opacity: 0.8;
}

/* ==================== HOMEPAGE STYLES ==================== */

/* Hero Section */
.hero-section {
  background: var(--bg-elevated);
  padding: 4rem 2rem 5rem;
  text-align: center;
  border-bottom: 1px solid var(--border-light);
}

.hero-content {
  max-width: 720px;
  margin: 0 auto;
}

.hero-logo {
  max-width: 200px;
  height: auto;
  margin: 0 auto 1rem;
  display: block;
}

.hero-section h1 {
  font-size: 2.5rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-family: Baskerville;
}

.hero-subtitle {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  margin-bottom: 2.5rem;
  font-weight: 400;
  line-height: 1.6;
}

/* Hero Search */
.hero-search-form {
  margin-bottom: 2rem;
}

.hero-search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.625rem 1rem;
  gap: 0.75rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.hero-search-bar:focus-within {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

.search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.hero-search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none !important;
  box-shadow: none !important;
}

.hero-search-input:focus {
  outline: none !important;
  box-shadow: none !important;
  border: none !important;
}

.hero-search-input::placeholder {
  color: var(--text-muted);
}

.hero-search-btn {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border: none;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.hero-search-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* Quick Filters */
.quick-filters {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.filter-tag {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tag:hover {
  border-color: var(--accent-border);
  color: var(--text-primary);
  background: var(--accent-light);
}

.filter-tag.active {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-color: var(--accent-primary);
}

/* Feature Cards Section */
.feature-cards-section {
  padding: 3rem 0;
}

.feature-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.feature-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
}

.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-border);
}

.feature-icon {
  width: 56px;
  height: 56px;
  background: var(--accent-light);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  color: var(--accent-primary);
}

.feature-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.feature-card p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.feature-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: gap 0.2s ease;
}

.feature-link:hover {
  gap: 0.5rem;
}

/* Browse by Topic Section */
.browse-section {
  padding: 3rem 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.see-all-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: gap 0.2s ease;
}

.see-all-link:hover {
  gap: 0.5rem;
}

.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.topic-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
}

.topic-card:hover {
  transform: translateX(2px);
  border-color: var(--accent-border);
  box-shadow: var(--shadow-sm);
  background: var(--bg-hover);
}

.topic-icon {
  width: 44px;
  height: 44px;
  background: var(--accent-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  flex-shrink: 0;
}

.topic-content {
  flex: 1;
}

.topic-card h3 {
  font-size: 1.125rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.topic-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0;
}

/* SOPs Section */
.sops-section {
  padding: 3rem 0;
}

.sops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
}

.sop-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
}

.sop-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-border);
}

.sop-thumbnail,
.sop-thumbnail-placeholder {
  width: 100%;
  height: 180px;
  position: relative;
  overflow: hidden;
  background: var(--bg-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sop-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sop-thumbnail-placeholder {
  color: var(--text-muted);
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.sop-card:hover .play-overlay {
  background: rgba(0, 0, 0, 0.8);
  transform: translate(-50%, -50%) scale(1.1);
}

.sop-card-content {
  padding: .5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.sop-card-header {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.sop-type-badge {
  font-size: 0.6875rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sop-type-badge.text {
  background: var(--accent-light);
  color: var(--accent-primary);
}

.sop-type-badge.video {
  background: #f3e8ff;
  color: #9333ea;
}

.status-badge {
  font-size: 0.6875rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.draft {
  background: var(--warning-light);
  color: var(--warning);
}

.sop-card-title {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.sop-card-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
  flex: 1;
}

.sop-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.category-tag {
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.view-count {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.view-count svg {
  opacity: 0.7;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state svg {
  color: var(--text-muted);
  opacity: 0.5;
  margin-bottom: 1.5rem;
}

.empty-state h3 {
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  margin-bottom: 1.5rem;
}

/* =====================================================
   AI ASSIST MODAL STYLES
   ===================================================== */

/* Modal Overlay */
.ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal Container */
.ai-modal {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 640px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Modal Header */
.ai-modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-modal-header h2 {
  font-size: 1.25rem;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.ai-modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

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

/* Modal Body */
.ai-modal-body {
  padding: 1.5rem;
}

.ai-modal-body .form-group {
  margin-bottom: 1.25rem;
}

.ai-modal-body label {
  display: block;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.ai-modal-body .label-description {
  display: block;
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.ai-modal-body textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  resize: vertical;
  transition: all 0.2s ease;
}

.ai-modal-body textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.ai-modal-body select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--bg-elevated);
  cursor: pointer;
  transition: all 0.2s ease;
}

.ai-modal-body select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* URL Input Group */
.url-inputs-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.url-input-group {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.url-input-group input[type="url"] {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.url-input-group input[type="url"]:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.url-input-group input[type="url"].error {
  border-color: var(--error);
}

.url-input-group .btn-icon {
  padding: 0.75rem;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.url-input-group .btn-icon:hover {
  background: var(--error-light);
  border-color: var(--error);
  color: var(--error);
}

.btn-add-url {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

.btn-add-url:hover {
  background: var(--accent-light);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

/* Radio Group (AI Modal specific styles) */
.ai-modal .radio-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
}

.radio-option:hover {
  background: var(--bg-hover);
}

.radio-option input[type="radio"] {
  margin-top: 0.25rem;
  cursor: pointer;
}

.radio-option-content {
  flex: 1;
}

.radio-option-label {
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.25rem;
}

.radio-option-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.radio-option input[type="radio"]:checked ~ .radio-option-label {
  color: var(--accent-primary);
}

/* Modal Footer */
.ai-modal-footer {
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Loading State */
.ai-loading {
  text-align: center;
  padding: 3rem 2rem;
}

.ai-loading-spinner {
  border: 3px solid var(--border-light);
  border-top: 3px solid var(--accent-primary);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.ai-loading-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.ai-loading-subtext {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Error Message in Modal */
.ai-error-message {
  background: var(--error-light);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* Success Notification */
.ai-success-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #10b981;
  color: white;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  animation: slideInRight 0.3s ease-out;
  z-index: 1001;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Character Counter */
.character-counter {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  margin-top: 0.25rem;
}

.character-counter.warning {
  color: var(--warning);
}

.character-counter.error {
  color: var(--error);
}

/* Content Header with AI Button */
.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.content-header h3 {
  margin: 0;
}

.btn-ai-assist {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(102, 126, 234, 0.2);
}

.btn-ai-assist:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-ai-assist:active {
  transform: translateY(0);
}

.btn-ai-assist svg {
  width: 16px;
  height: 16px;
}

/* ==================== COURSES ==================== */

/* Course Grid (Browse Page) */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.course-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.course-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.course-thumbnail {
  width: 100%;
  height: 180px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-secondary);
}

.course-thumbnail-default {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--bg-secondary) 100%);
}

.course-thumbnail-default i {
  font-size: 3rem;
  color: var(--text-muted);
}

.course-card-content {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.course-title {
  margin: 0;
  font-size: 1.25rem;
  flex: 1;
}

.course-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.course-title a:hover {
  color: var(--accent-primary);
}

.course-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.course-meta-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.course-meta-item i {
  font-size: 1rem;
}

.course-progress {
  margin-bottom: 1rem;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--success) 0%, #059669 100%);
  transition: width 0.3s ease;
  border-radius: var(--radius-full);
}

.progress-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.course-actions {
  margin-top: auto;
}

.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

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

.btn-secondary:hover {
  background: var(--bg-hover);
}

/* Course Detail Page */
.course-detail {
  max-width: 900px;
  margin: 0 auto;
}

.course-detail-header {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.course-detail-meta {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.course-detail-title {
  font-size: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.course-detail-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.course-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 1.5rem;
}

.course-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.course-stat i {
  font-size: 1.25rem;
  color: var(--accent-primary);
}

.user-progress-section {
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.user-progress-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.completion-message {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--success);
  font-weight: 600;
  margin-top: 0.5rem;
}

.completion-message i {
  font-size: 1.25rem;
}

/* Course Modules List */
.course-modules {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.course-modules h2 {
  margin-bottom: 1.5rem;
}

.modules-list {
  list-style: none;
  counter-reset: module-counter;
}

.module-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  transition: all 0.2s ease;
}

.module-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.module-item.module-completed {
  background: var(--success-light);
  border-color: var(--success);
}

.module-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9rem;
}

.module-completed .module-number {
  background: var(--success);
}

.module-content {
  flex: 1;
}

.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.module-title {
  font-size: 1.1rem;
  margin: 0;
  display: flex;
  align-items: center;
}

.module-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.module-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0;
}

/* Student Progress Table */
.student-progress-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.students-table-container {
  overflow-x: auto;
  margin-top: 1rem;
  width: 100%;
}

.students-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.students-table th,
.students-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

.students-table th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.progress-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.progress-bar-container-small {
  flex: 1;
  min-width: 80px;
  height: 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

.status-completed {
  background: var(--success-light);
  color: var(--success);
}

.status-in-progress {
  background: var(--warning-light);
  color: var(--warning);
}

.status-not-started {
  background: var(--bg-secondary);
  color: var(--text-muted);
}

.btn-reset-progress {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

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

.btn-reset-progress i {
  font-size: 1rem;
}

.course-detail-footer {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-light);
}

.detail-meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

/* Module Manager (Drag & Drop) */
.module-manager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.available-sops-panel,
.course-modules-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  height: fit-content;
  min-height: 500px;
  display: flex;
  flex-direction: column;
}

.panel-header {
  margin-bottom: 1.5rem;
}

.panel-header h2 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(22, 22, 22, 0.1);
}

.sop-list {
  flex: 1;
  overflow-y: auto;
  max-height: 600px;
}

.sop-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  transition: all 0.2s ease;
}

.sop-item:hover:not(.sop-item-disabled) {
  background: var(--bg-hover);
  border-color: var(--border-color);
  cursor: pointer;
}

.sop-item-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sop-item-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.sop-item-icon i {
  font-size: 1.25rem;
  color: var(--text-secondary);
}

.sop-item-content {
  flex: 1;
}

.sop-item-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.25rem 0;
  color: var(--text-primary);
}

.sop-item-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.sop-type-badge {
  padding: 0.125rem 0.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-weight: 500;
  text-transform: uppercase;
}

.btn-add-sop {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-add-sop:hover {
  background: var(--accent-hover);
  transform: scale(1.1);
}

.added-badge {
  padding: 0.25rem 0.75rem;
  background: var(--success-light);
  color: var(--success);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
}

.course-modules-list {
  flex: 1;
  overflow-y: auto;
  max-height: 600px;
}

.module-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  cursor: move;
  transition: all 0.2s ease;
}

.module-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.module-card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.module-drag-handle {
  flex-shrink: 0;
  cursor: grab;
  color: var(--text-muted);
}

.module-drag-handle:active {
  cursor: grabbing;
}

.module-order-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.85rem;
}

.module-card-content {
  flex: 1;
}

.module-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.module-card-header h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.module-card-description {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0;
}

.btn-remove-module {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--error-light);
  color: var(--error);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-remove-module:hover {
  background: var(--error);
  color: var(--text-inverse);
  transform: scale(1.1);
}

.module-actions {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 1rem;
}

.empty-state-small {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
}

.empty-state-small p {
  margin: 0.5rem 0;
}

.help-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Learning View */
.learning-container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
}

.learning-header {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
}

.learning-header-content {
  margin-bottom: 1rem;
}

.learning-course-title {
  font-size: 1.5rem;
  margin: 0 0 0.5rem 0;
}

.learning-module-info {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0;
}

.learning-progress-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.learning-progress-bar .progress-bar-container {
  flex: 1;
}

.learning-content {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.module-content-wrapper {
  max-width: 800px;
  margin: 0 auto;
}

.module-content-header {
  margin-bottom: 2rem;
}

.module-type-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.module-content-title {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.module-content-description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.module-content-body {
  line-height: 1.8;
}

.video-container {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 2rem;
}

.learning-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-md);
}

.text-content {
  font-size: 1.05rem;
  line-height: 1.8;
}

.info-message {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--warning-light);
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

.info-message i {
  font-size: 1.5rem;
  color: var(--warning);
}

.learning-footer {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  position: relative;
}

.learning-nav-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.btn-toggle-sidebar {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.btn-toggle-sidebar:hover {
  background: var(--bg-hover);
}

.module-sidebar {
  position: fixed;
  top: 0;
  right: -350px;
  width: 350px;
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-xl);
  transition: right 0.3s ease;
  z-index: 1000;
  overflow-y: auto;
}

.module-sidebar.show {
  right: 0;
}

.module-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  background: var(--bg-elevated);
  z-index: 10;
}

.module-sidebar-header h3 {
  margin: 0;
  font-size: 1.1rem;
}

.btn-close-sidebar {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.btn-close-sidebar:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.module-sidebar-list {
  list-style: none;
  padding: 1rem;
}

.module-sidebar-item {
  margin-bottom: 0.5rem;
}

.module-sidebar-item a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.module-sidebar-item a:hover {
  background: var(--bg-hover);
  border-color: var(--border-color);
}

.module-sidebar-item.active a {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-color: var(--accent-primary);
}

.module-sidebar-item.completed a {
  background: var(--success-light);
  border-color: var(--success);
}

.module-sidebar-number {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.85rem;
}

.module-sidebar-item.active .module-sidebar-number {
  background: var(--text-inverse);
  color: var(--accent-primary);
}

.module-sidebar-item.completed .module-sidebar-number {
  background: var(--success);
  color: var(--text-inverse);
}

.module-sidebar-content {
  flex: 1;
}

.module-sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  display: block;
  margin-bottom: 0.25rem;
}

.module-sidebar-type {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.module-sidebar-item.active .module-sidebar-type {
  color: rgba(255, 255, 255, 0.7);
}

.module-complete-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  color: var(--success);
}

.btn-danger {
  background: var(--error);
  color: var(--text-inverse);
  border: none;
}

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

.form-info-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
}

.page-header-content {
  flex: 1;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin: 0.5rem 0 0 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .courses-grid {
    grid-template-columns: 1fr;
  }

  .module-manager {
    grid-template-columns: 1fr;
  }

  .course-modules-panel {
    order: -1;
  }

  .learning-nav-buttons {
    flex-direction: column;
  }

  .module-sidebar {
    width: 100%;
    right: -100%;
  }
}

/* ==================== HOME PAGE COURSES ==================== */

.courses-section {
  margin-bottom: 3rem;
}

.courses-section .section-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.courses-section .section-header h2 i {
  font-size: 1.75rem;
  color: var(--accent-primary);
}

.courses-grid-home {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.course-card-home {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
}

.course-card-home:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.course-thumbnail-home {
  width: 100%;
  height: 160px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-secondary);
}

.course-card-content-home {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.course-header-home {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.course-title-home {
  margin: 0;
  font-size: 1.15rem;
  flex: 1;
}

.course-title-home a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.course-title-home a:hover {
  color: var(--accent-primary);
}

.course-description-home {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.course-meta-home {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

.course-meta-item-home {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.course-meta-item-home i {
  font-size: 0.95rem;
}

.course-progress-home {
  margin-bottom: 1rem;
}

.course-actions-home {
  margin-top: auto;
}

.btn-small {
  padding: 0.625rem 1rem;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .courses-grid-home {
    grid-template-columns: 1fr;
  }
}

/* Page Header with Button Layout */
section.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.page-header-content {
  flex: 1;
}

.page-header .btn-primary {
  flex-shrink: 0;
  white-space: nowrap;
}

@media (max-width: 768px) {
  section.page-header {
    flex-direction: column;
    align-items: stretch;
  }
  
  .page-header .btn-primary {
    width: 100%;
    text-align: center;
  }
}
