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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  line-height: 1.5;
  min-height: 100vh;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navbar */
.navbar {
  background: #fff;
  border-bottom: 1px solid #e5e5e7;
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.logo {
  font-size: 20px;
  font-weight: 600;
  color: #1d1d1f;
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Main Content */
.main-content {
  padding: 32px 20px;
}

.page-header {
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.page-header h1 {
  font-size: 32px;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

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

.btn-primary {
  background: #0066cc;
  color: #fff;
}

.btn-primary:hover {
  background: #0055b3;
}

.btn-success {
  background: #34c759;
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid #d2d2d7;
  color: #1d1d1f;
}

.btn-outline:hover {
  background: #f5f5f7;
}

.btn-outline.active {
  background: #0066cc;
  border-color: #0066cc;
  color: #fff;
}

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

/* Forms */
.form-card {
  background: #fff;
  border-radius: 12px;
  padding: 32px;
  max-width: 800px;
}

.form-group {
  margin-bottom: 20px;
}

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

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-family: inherit;
}

.form-group textarea {
  min-height: 200px;
  resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #0066cc;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-label input {
  width: 18px;
  height: 18px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.help-text {
  font-size: 13px;
  color: #86868b;
  margin-top: 6px;
}

/* Alerts */
.alert {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.alert-error {
  background: #fff2f2;
  color: #ff3b30;
  border: 1px solid #ffcdd2;
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 20px;
}

.badge-success {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-gray {
  background: #f5f5f7;
  color: #86868b;
}

.badge-warning {
  background: #fff3e0;
  color: #e65100;
}

.badge-primary {
  background: #e3f2fd;
  color: #0066cc;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  border: 1px solid #e5e5e7;
}

.stat-value {
  font-size: 36px;
  font-weight: 600;
  color: #1d1d1f;
}

.stat-label {
  font-size: 13px;
  color: #86868b;
  margin-top: 4px;
}

/* Table */
.table-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
  overflow: hidden;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 20px;
  text-align: left;
  border-bottom: 1px solid #e5e5e7;
}

.data-table th {
  background: #f5f5f7;
  font-weight: 500;
  font-size: 12px;
  color: #86868b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.data-table td {
  font-size: 14px;
}

.data-table tr:hover {
  background: #f9f9fb;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
}

.empty-state h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

.empty-state p {
  color: #86868b;
  margin-bottom: 24px;
}

/* Cards Grid (Articles, Courses) */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e5e7;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.card-cover {
  height: 160px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 48px;
}

.card-body {
  padding: 20px;
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.card-title a {
  color: inherit;
  text-decoration: none;
}

.card-title a:hover {
  color: #0066cc;
}

.card-excerpt {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #86868b;
}

.card-actions {
  padding: 16px 20px;
  border-top: 1px solid #e5e5e7;
  display: flex;
  gap: 8px;
}

/* Article Content */
.article-content {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  border: 1px solid #e5e5e7;
}

.article-content h1 { font-size: 32px; margin-bottom: 16px; }
.article-content h2 { font-size: 24px; margin: 32px 0 16px; }
.article-content h3 { font-size: 20px; margin: 24px 0 12px; }
.article-content p { margin-bottom: 16px; line-height: 1.7; }
.article-content ul, .article-content ol { margin: 16px 0; padding-left: 24px; }
.article-content li { margin-bottom: 8px; }
.article-content code {
  background: #f5f5f7;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}
.article-content pre {
  background: #1d1d1f;
  color: #fff;
  padding: 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 20px 0;
}
.article-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}
.article-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 20px 0;
}

/* Sidebar */
.content-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 32px;
}

.sidebar {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e5e5e7;
  height: fit-content;
  position: sticky;
  top: 100px;
}

.sidebar-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #86868b;
  margin-bottom: 12px;
}

.sidebar-nav {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.sidebar-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: #1d1d1f;
  font-size: 14px;
}

.sidebar-nav a:hover {
  background: #f5f5f7;
}

.sidebar-nav a.active {
  background: #0066cc;
  color: #fff;
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: #e5e5e7;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: #34c759;
  border-radius: 4px;
  transition: width 0.3s;
}

/* Login */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-card h1 {
  font-size: 24px;
  text-align: center;
  margin-bottom: 8px;
}

.login-card .subtitle {
  text-align: center;
  color: #86868b;
  margin-bottom: 32px;
}

/* Analytics */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}

.analytics-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  border: 1px solid #e5e5e7;
}

.analytics-card h3 {
  font-size: 14px;
  color: #86868b;
  margin-bottom: 16px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 1px solid #e5e5e7;
  padding-bottom: 16px;
}

.tab {
  padding: 8px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: #333;
  font-size: 14px;
}

.tab:hover {
  background: #f5f5f7;
}

.tab.active {
  background: #0066cc;
  color: white;
}

/* Back Link */
.back-link {
  color: #0066cc;
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
  margin-bottom: 16px;
}

.back-link:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav-right {
    flex-wrap: wrap;
  }

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

  .content-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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