body { background:#f9f9f7; color:#2d1c0d; }
mark {
  background:rgba(255,214,153,0.65);
  padding:0 4px;
  border-radius:6px;
}
.muted {
  color:#8c7e6b;
}

.cat_header {
  text-align:center;
  padding:40px 20px;
  background:linear-gradient(135deg,#fff7e2,#f4e2c2);
  border-radius:28px;
  margin:25px auto 30px;
  max-width:1100px;
  position:relative;
  overflow:hidden;
  box-shadow:0 25px 45px rgba(0,0,0,0.08);
}
.cat_header::after {
  content:"";
  position:absolute;
  inset:25px 30px auto auto;
  width:140px;
  height:140px;
  border-radius:35% 65% 55% 45%;
  background:rgba(255,255,255,0.35);
  filter:blur(0.5px);
}
.cat_header img {
  width:140px;
  height:140px;
  object-fit:cover;
  border-radius:50%;
  border:5px solid rgba(255,255,255,0.8);
  box-shadow:0 18px 35px rgba(0,0,0,0.15);
  margin-bottom:15px;
  position:relative;
  z-index:1;
}
.cat_header h1 {
  color:#2d1c0d;
  font-size:30px;
  margin:0;
  position:relative;
  z-index:1;
}
.search_header h1 {
  margin-bottom:12px;
}
.search_header p {
  margin:0;
  font-size:16px;
  color:#5c4f3f;
}

/* الأزرار الفرعية */
.subcats {
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:12px;
  margin:0 auto 30px;
  max-width:1000px;
  padding:0 15px;
}
.subcat_btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 20px;
  background:#fff;
  color:#2d1c0d;
  border-radius:999px;
  text-decoration:none;
  font-weight:bold;
  border:1px solid rgba(212,168,87,0.4);
  box-shadow:0 10px 25px rgba(0,0,0,0.05);
  transition:.25s ease;
}
.subcat_btn:hover,
.subcat_btn:focus-visible {
  background:#d4a857;
  color:#2d1c0d;
  transform:translateY(-2px);
}

/* المواد */
.materials_list {
  max-width:1100px;
  margin:0 auto 40px;
  padding:0 15px;
}
.search_results {
  padding-top:0;
}
.search_intro {
  background:#fff;
  border-radius:30px;
  padding:24px 28px;
  margin-bottom:22px;
  display:flex;
  flex-wrap:wrap;
  gap:20px;
  justify-content:space-between;
  align-items:center;
  box-shadow:0 12px 25px rgba(0,0,0,0.08);
}
.search_intro h2 {
  margin:0 0 8px;
  color:#0c3964;
}
.search_intro p {
  margin:0;
  color:#6b5a40;
}
.search_form {
  display:flex;
  gap:10px;
  flex:1;
  justify-content:flex-end;
}
.search_form input {
  flex:1;
  min-width:240px;
  border-radius:999px;
  border:1px solid rgba(12,57,100,0.15);
  padding:12px 20px;
  font-size:15px;
  font-family:inherit;
}
.search_form button {
  border:none;
  border-radius:999px;
  padding:12px 20px;
  background:#0c3964;
  color:#fff;
  font-weight:700;
  cursor:pointer;
  display:flex;
  align-items:center;
  gap:8px;
  transition:.2s ease;
}
.search_form button:hover {
  background:#082845;
}
.materials_table_wrap {
  background:#fff;
  border-radius:30px;
  padding:32px;
  box-shadow:0 25px 60px rgba(12,57,100,0.12);
  overflow:hidden;
  position:relative;
}
.materials_table_wrap::after {
  content:"";
  position:absolute;
  width:180px;
  height:180px;
  border-radius:50%;
  background:radial-gradient(circle at center, rgba(212,168,87,0.25), transparent 60%);
  inset:auto -40px -40px auto;
}
.materials_table_wrap > * {
  position:relative;
  z-index:1;
}
.table_header {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  margin-bottom:25px;
}
.table_header h2 {
  margin:0;
  font-size:26px;
  color:#0c3964;
}
.table_header p {
  margin:6px 0 0;
  color:#6b5a40;
  font-size:15px;
}
.table_badge {
  background:#fff5d9;
  color:#b07b20;
  padding:8px 18px;
  border-radius:999px;
  font-weight:700;
  box-shadow:inset 0 0 0 1px rgba(176,123,32,0.15);
}

.material_row {
  cursor:pointer;
}
.material_row:focus-visible {
  outline:3px solid rgba(212,168,87,0.45);
  outline-offset:-3px;
}
.mat_title_link {
  color:inherit;
  text-decoration:none;
}
.mat_title_link:hover,
.mat_title_link:focus-visible {
  text-decoration:underline;
}

.materials_table {
  width:100%;
  border-collapse:separate;
  border-spacing:0;
}
.materials_table th,
.materials_table td {
  padding:16px 18px;
  border-bottom:1px solid #f1e6d8;
  text-align:right;
  vertical-align:top;
}
.materials_table thead th {
  background:#f6efe1;
  color:#6f4a1d;
  font-size:13px;
  letter-spacing:.5px;
  text-transform:uppercase;
}
.materials_table tbody tr:last-child td {
  border-bottom:none;
}
.materials_table tbody tr {
  transition:background .2s ease, transform .2s ease;
}
.materials_table tbody tr:hover {
  background:#fff9ef;
  transform:translateY(-2px);
}

.mat_item {
  display:flex;
  align-items:center;
  gap:15px;
}
.mat_thumb {
  width:72px;
  height:72px;
  border-radius:18px;
  overflow:hidden;
  flex:0 0 72px;
  box-shadow:0 12px 25px rgba(0,0,0,0.08);
}
.mat_thumb img {
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}
.mat_item h3 {
  margin:0;
  font-size:18px;
  color:#1a365d;
}
.mat_badge {
  display:inline-block;
  margin-top:6px;
  padding:4px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:600;
  background:#e8eef6;
  color:#1f4d7a;
}
.mat_badge--cat {
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:#fff4eb;
  color:#b36a1b;
  border:1px solid rgba(179,106,27,0.2);
  margin-top:0;
}
.mat_desc {
  margin:0;
  line-height:1.7;
  color:#4a4a4a;
}
.mat_actions {
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  justify-content:flex-start;
}
.mat_action_btn {
  display:inline-flex;
  align-items:center;
  gap:8px;
  border:none;
  border-radius:999px;
  padding:10px 22px;
  font-size:14px;
  font-weight:700;
  text-decoration:none;
  cursor:pointer;
  transition:transform .2s ease, box-shadow .2s ease, background .2s ease;
  position:relative;
  overflow:hidden;
  line-height:1.2;
}
.mat_action_btn:hover {
  transform:translateY(-2px);
}
.mat_action_btn:focus-visible {
  outline:3px solid rgba(212,168,87,0.4);
  outline-offset:2px;
}
.mat_action_btn--primary {
  background:linear-gradient(135deg,#0c3964,#1d567f);
  color:#fff;
  box-shadow:0 12px 28px rgba(12,57,100,0.35);
}
.mat_action_btn--primary:hover {
  background:linear-gradient(135deg,#0a2a49,#163f60);
}
.mat_action_btn--ghost {
  background:rgba(12,57,100,0.08);
  color:#0c3964;
  border:1px solid rgba(12,57,100,0.15);
  box-shadow:none;
}
.mat_action_btn--ghost:hover {
  background:rgba(12,57,100,0.12);
}
.mat_action_icon {
  font-size:16px;
}
.play_btn {
  background:none;
  color:inherit;
  border:none;
  padding:0;
  box-shadow:none;
}

/* المشغل المنبثق */
.modal {
  display:none;
  position:fixed;
  z-index:999;
  left:0;
  top:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,0.5);
}
.modal_content {
  background:#fff;
  margin:100px auto;
  padding:20px;
  border-radius:10px;
  width:90%;
  max-width:500px;
  text-align:center;
  box-shadow:0 4px 12px rgba(0,0,0,0.3);
}
.close_modal {
  float:left;
  font-size:24px;
  cursor:pointer;
  color:#900;
}
.close_modal:hover {
  color:#c00;
}
.search_empty {
  background:#fff;
  border-radius:26px;
  padding:40px 30px;
  text-align:center;
  box-shadow:0 20px 45px rgba(0,0,0,0.08);
}
.search_empty img {
  width:180px;
  margin-bottom:20px;
}
.search_empty h3 {
  margin:0 0 10px;
  color:#0c3964;
}
.search_empty p {
  margin:0 0 20px;
  color:#6b5a40;
}

/* إستجابات */
@media (max-width:1100px) {
  .cat_header {
    margin:20px 15px;
  }
  .materials_table_wrap {
    padding:28px 22px;
  }
  .search_intro {
    padding:22px;
  }
}

@media (max-width:992px) {
  .table_header {
    flex-direction:column;
    align-items:flex-start;
    text-align:right;
  }
  .table_badge {
    align-self:flex-start;
  }
  .mat_actions {
    justify-content:center;
  }
  .search_intro {
    flex-direction:column;
    align-items:flex-start;
  }
  .search_form {
    width:100%;
  }
}

@media (max-width:768px) {
  .materials_table thead {
    display:none;
  }
  .materials_table,
  .materials_table tbody,
  .materials_table tr,
  .materials_table td {
    display:block;
    width:100%;
  }
  .materials_table tr {
    margin-bottom:20px;
    border:1px solid #f1e6d8;
    border-radius:22px;
    padding:20px;
    background:#fff;
    box-shadow:0 25px 45px rgba(0,0,0,0.07);
  }
  .materials_table td {
    border:none;
    padding:10px 0;
  }
  .materials_table td::before {
    content:attr(data-label);
    display:block;
    font-size:13px;
    font-weight:700;
    color:#d4a857;
    margin-bottom:6px;
  }
  .materials_table td[data-label="#"] {
    font-size:18px;
    font-weight:700;
    color:#b07b20;
  }
  .materials_table td[data-label="#"]::before {
    content:"الترتيب";
  }
  .mat_item {
    flex-direction:column;
    align-items:flex-start;
  }
  .mat_thumb {
    width:100%;
    height:190px;
    border-radius:18px;
  }
  .mat_actions {
    justify-content:flex-start;
  }
  .search_intro {
    padding:18px;
  }
}

@media (max-width:480px) {
  .cat_header {
    padding:30px 15px;
  }
  .table_header h2 {
    font-size:22px;
  }
  .mat_action_btn,
  .search_form button {
    width:100%;
    text-align:center;
  }
  .search_form {
    flex-direction:column;
  }
}
