:root{
  --navy:#122a46;
  --navy-dark:#0f2740;
  --blue:#2b6fd6;
  --text:#16263c;
  --muted:#6b7c93;
  --border:#e4e7ee;
  --header-bg:#eef2fb;
  --red:#f2564c;
  --page:#ffffff;
}
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  font-family:"Peyda(FaNum)","Segoe UI",Tahoma,sans-serif;
  background:var(--page);
  color:var(--text);
  -webkit-font-smoothing:antialiased;
}

/* ---------- Header ---------- */
.header{
  background:var(--header-bg);
  padding:18px 32px;
  display:flex;
  align-items:center;
  gap:48px;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  order:2;
  flex:0 0 auto;
  text-decoration:none;
  color:inherit;
}
.brand-text{text-align:left;line-height:1.25}
.brand-text .top{font-size:13px;color:var(--navy);font-weight:500}
.brand-text .name{font-size:28px;font-weight:800;color:var(--navy);letter-spacing:-.5px}
.logo-mark{width:52px;height:56px;flex:0 0 auto;}

/* ---------- Search Bar & Dropdown ---------- */
.search{
  order:1;
  flex:1 1 auto;
  position:relative;
  max-width:1255px;
}
.search input{
  width:100%;
  height:62px;
  border:1px solid var(--border);
  background:#fff;
  border-radius:12px;
  padding:0 26px 0 60px;
  font-family:inherit;
  font-size:16px;
  color:var(--text);
  outline:none;
  transition:border-color .18s, box-shadow .18s;
}
.search input::placeholder{color:#9aa6b6}
.search input:focus{border-color:#c3d4ee;box-shadow:0 0 0 4px rgba(43,111,214,.08)}
.search .icon{
  position:absolute;
  left:22px;top:50%;transform:translateY(-50%);
  color:#8a97a8;
  display:flex;
  pointer-events:none;
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(18,42,70,.1);
  z-index: 100;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.search-dropdown.active { display: flex; }
.search-item {
  padding: 16px 20px;
  text-decoration: none;
  color: var(--navy);
  font-weight: 700;
  font-size: 15px;
  border-bottom: 1px solid var(--border);
  transition: background .18s;
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: #f8fafc; }
.search-item-icon { color: var(--blue); display: flex; flex: 0 0 auto; }
.search-empty { padding: 16px 20px; color: var(--muted); text-align: center; font-size: 15px; }

/* ---------- Page ---------- */
.container{
  max-width:1440px;
  margin:0 auto;
  padding:0 32px;
}
.page-title{
  font-size:34px;
  font-weight:800;
  color:var(--navy);
  margin:62px 0 44px;
}

/* ---------- Custom Filters ---------- */
.filters{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:22px;
  margin-bottom:56px;
}
.custom-select { position: relative; user-select: none; }
.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 62px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0 20px 0 44px;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  cursor: pointer;
  transition: border-color .18s, box-shadow .18s;
}
.custom-select.open .select-trigger {
  border-color: #c3d4ee;
  box-shadow: 0 0 0 4px rgba(43,111,214,.08);
}
.select-trigger .select-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.select-trigger .chev {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa6b6;
  display: flex;
  transition: transform 0.2s;
}
.custom-select.open .select-trigger .chev {
  transform: translateY(-50%) rotate(180deg);
}
.options-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(18,42,70,.1);
  z-index: 50;
  display: none;
  flex-direction: column;
  max-height: 260px;
  overflow-y: auto;
}
.custom-select.open .options-dropdown {
  display: flex;
}
.option-item {
  padding: 14px 20px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s, color 0.1s;
}
.option-item:last-child { border-bottom: none; }
.option-item:hover { background: #f8fafc; color: var(--blue); }
.option-item.selected { background: var(--header-bg); color: var(--navy); font-weight: 800; }

/* ---------- Cards grid ---------- */
.grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:28px;
  padding-bottom:80px;
}
.card{
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  transition:box-shadow .2s, transform .2s;
}
.card:hover{
  box-shadow:0 1px 2px rgba(0,0,0,.05), 0 8px 22px rgba(18,42,70,.08);
  transform:translateY(-2px);
}
.card-media{
  position:relative;
  background:#f6f1e9;
  aspect-ratio:410/258;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.card-media .edge{
  position:absolute;
  inset:0 0 0 auto;
  width:10px;
  background:#0e6b4f;
  z-index: 1;
}
.cover-text{text-align:center;line-height:1;z-index:1;}
.cover-text .l1{font-size:36px;font-weight:800;color:#1d1d1b;letter-spacing:1px;}
.badge{
  position:absolute;
  top:16px; left:16px;
  background:var(--red);
  color:#fff;
  font-size:15px;
  font-weight:700;
  padding:8px 16px;
  border-radius:999px;
  z-index: 1;
}
.card-body{
  padding:22px;
  display:flex;
  flex-direction:column;
  gap:14px;
  flex: 1;
}
.card-title{
  font-size:17px;
  font-weight:800;
  color:var(--navy);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-teacher{
  font-size:15px;
  color:var(--blue);
  font-weight:500;
  min-height: 22px;
}
.card-price{
  display:flex;
  align-items:baseline;
  gap:10px;
  flex-wrap:wrap;
  margin-top: auto;
}
.card-price .label{font-size:14px;font-weight:700;color:var(--muted)}
.card-price .now{font-size:19px;font-weight:800;color:var(--navy)}
.card-price .old{font-size:14px;color:#9aa6b6;text-decoration:line-through}
.buy{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  margin-top:6px;
  background:var(--navy);
  color:#fff;
  border:none;
  border-radius:10px;
  height:58px;
  font-family:inherit;
  font-size:18px;
  font-weight:700;
  text-decoration:none;
  cursor:pointer;
  transition:background .18s;
}
.buy:hover{background:var(--navy-dark)}
.empty-state { grid-column: 1 / -1; text-align: center; padding: 60px; color: var(--muted); font-size: 18px; }

@media (max-width:1200px){
  .grid{grid-template-columns:repeat(3,1fr)}
  .filters{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:860px){
  .grid{grid-template-columns:repeat(2,1fr)}
}
@media (max-width:526px){
  .grid{grid-template-columns:1fr}
}
@media (max-width:400px){
  .header{flex-direction:column;align-items:stretch;gap:18px;padding:16px 20px}
  .brand{order:1;justify-content:flex-start}
  .search{order:2;max-width:none}
  .container{padding:0 20px}
  .page-title{font-size:26px;margin:36px 0 26px}
  .filters{grid-template-columns:1fr;gap:14px}
  .grid{grid-template-columns:1fr}
}
