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

body {
  font-family: 'Cairo', 'Inter', 'Segoe UI', Tahoma, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body[dir="ltr"] {
  font-family: 'Inter', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* Header */
header {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  padding: 30px 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.header-right {
  display: flex;
  align-items: center;
}

.lang-select {
  padding: 8px 14px;
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  appearance: auto;
}

.lang-select:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.4);
}

.lang-select:focus {
  outline: none;
  border-color: #fff;
}

.lang-select option {
  color: #1a1a2e;
  background: #fff;
}

.logo {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo::before {
  content: "\26A1";
  margin-inline-end: 8px;
}

.tagline {
  font-size: 15px;
  opacity: 0.85;
  font-weight: 500;
}

/* Controls */
.controls {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin: 30px 0 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.search-bar {
  margin-bottom: 18px;
}

.search-bar input {
  width: 100%;
  padding: 14px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s;
  background: #f8f9fa;
}

.search-bar input:focus {
  outline: none;
  border-color: #0f3460;
  background: #fff;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filter-group {
  flex: 1;
  min-width: 150px;
}

.filter-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  margin-bottom: 4px;
}

.filter-group select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #f8f9fa;
  cursor: pointer;
  transition: border-color 0.2s;
}

.filter-group select:focus {
  outline: none;
  border-color: #0f3460;
}

.check-group {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto;
  min-width: auto;
  padding-top: 18px;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  white-space: nowrap;
}

.check-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #0f3460;
  cursor: pointer;
}

.btn-reset {
  padding: 10px 22px;
  background: #e8e8e8;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  margin-inline-end: auto;
}

.btn-reset:hover {
  background: #d0d0d0;
}

.results-bar {
  margin-top: 16px;
  font-size: 15px;
  font-weight: 600;
  color: #666;
}

.results-bar span {
  color: #0f3460;
  font-size: 20px;
  font-weight: 800;
}

/* Courses Grid */
.courses-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
  min-height: 200px;
}

.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  font-size: 18px;
  color: #888;
}

.loading::after {
  content: "";
  display: block;
  width: 40px;
  height: 40px;
  margin: 16px auto 0;
  border: 4px solid #e0e0e0;
  border-top-color: #0f3460;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  font-size: 18px;
  color: #999;
}

/* Course Card */
.course-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

.course-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.card-thumb {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #e8e8e8;
}

.card-thumb-placeholder {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: rgba(255,255,255,0.6);
}

.card-body {
  padding: 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.5;
  margin-bottom: 14px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #f0f2f5;
  color: #444;
}

.tag.free {
  background: #e8f5e9;
  color: #2e7d32;
}

.tag.paid {
  background: #fce4ec;
  color: #c62828;
}

.tag.cert {
  background: #e3f2fd;
  color: #0d47a1;
}

.tag.level {
  background: #fff3e0;
  color: #e65100;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.card-platform {
  font-size: 12px;
  color: #888;
  font-weight: 500;
}

.card-link {
  display: inline-block;
  padding: 8px 18px;
  background: #0f3460;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}

.card-link:hover {
  background: #1a4a7a;
}

/* Footer */
footer {
  margin-top: auto;
  background: #1a1a2e;
  color: #aaa;
  text-align: center;
  padding: 24px 0;
  font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    text-align: center;
  }

  .filters {
    flex-direction: column;
  }

  .filter-group {
    min-width: 100%;
  }

  .check-group {
    flex-wrap: wrap;
  }

  .btn-reset {
    width: 100%;
    margin-inline-end: 0;
  }

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