/* =====================================================================
   MovieDokan — Search redesign (header search, live dropdown, search page)
   Uses the design tokens from custom.css (--md-*), with fallbacks.
   ===================================================================== */
:root {
    --mds-bg: var(--md-bg, #050507);
    --mds-solid: var(--md-solid, #111116);
    --mds-solid-2: var(--md-solid-2, #18181f);
    --mds-field: #16161d;
    --mds-line: var(--md-line, rgba(255,255,255,.07));
    --mds-line-2: var(--md-line-2, rgba(255,255,255,.12));
    --mds-text: var(--md-text, #f5f5f7);
    --mds-muted: var(--md-muted, #a1a1aa);
    --mds-dim: var(--md-dim, #71717a);
    --mds-accent: var(--md-accent, #e50914);
    --mds-accent-2: var(--md-accent-2, #ff3b4a);
    --mds-gold: var(--md-gold, #f5c518);
    --mds-font: var(--md-font, 'Roboto', 'Noto Sans Bengali', system-ui, sans-serif);
    --mds-display: var(--md-display, 'Outfit', 'Noto Sans Bengali', 'Roboto', sans-serif);
}

/* ---------- Header search box ---------- */
header.main .hbox .headitems .search { width: 300px !important; }
@media (min-width: 1280px) { header.main .hbox .headitems .search { width: 340px !important; } }

header.main .hbox .search form.mds-form,
.search_responsive form.mds-form { position: relative; background: transparent !important; border: 0 !important; box-shadow: none !important; }

header.main .hbox .search form.mds-form input[name="s"],
.search_responsive form.mds-form input[name="s"] {
    height: 42px !important;
    padding: 0 52px 0 40px !important;
    background: var(--mds-field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a1a1aa' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 14px 50% !important;
    border: 1.5px solid var(--mds-line-2) !important;
    border-radius: 12px !important;
    color: var(--mds-text) !important;
    font: 400 14px/42px var(--mds-font) !important;
    box-shadow: none !important;
    transition: border-color .2s ease, box-shadow .2s ease !important;
}
header.main .hbox .search form.mds-form input[name="s"]::placeholder,
.search_responsive form.mds-form input[name="s"]::placeholder { color: var(--mds-dim) !important; opacity: 1; }

header.main .hbox .search form.mds-form input[name="s"]:focus,
header.main .hbox .search form.mds-form.mds-focus input[name="s"],
.search_responsive form.mds-form input[name="s"]:focus {
    border-color: var(--mds-accent) !important;
    box-shadow: 0 0 0 4px rgba(229, 9, 20, .16) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e50914' stroke-width='2.5'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") !important;
}

header.main .hbox .search form.mds-form button[type=submit],
.search_responsive form.mds-form button[type=submit] {
    position: absolute !important;
    top: 5px !important; right: 5px !important;
    width: 34px; height: 32px;
    padding: 0 !important;
    border-radius: 9px !important;
    background: var(--mds-accent) !important;
    color: #fff !important;
    font-size: 13px !important;
    line-height: 32px !important;
    text-align: center;
    transition: background .2s ease, transform .2s ease;
}
header.main .hbox .search form.mds-form button[type=submit]:hover,
.search_responsive form.mds-form button[type=submit]:hover { background: var(--mds-accent-2) !important; color: #fff !important; }
header.main .hbox .search form.mds-form button[type=submit] span,
.search_responsive form.mds-form button[type=submit] span { color: #fff !important; }

/* the old live-search box is no longer used */
header.main .hbox > .live-search,
.search_responsive > .live-search { display: none !important; }

/* ---------- Live search dropdown ---------- */
.mds-drop {
    display: none;
    position: absolute;
    z-index: 120;
    background: var(--mds-solid);
    border: 1px solid var(--mds-line-2);
    border-radius: 16px;
    box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .95);
    overflow: hidden;
    font-family: var(--mds-font);
    color: var(--mds-text);
    text-align: left;
}
.mds-drop.is-open { display: block; animation: mdsIn .16s ease-out; }
.mds-drop.is-mobile { position: relative; width: 100%; margin-top: 10px; border-radius: 14px; box-shadow: none; }
@keyframes mdsIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.mds-chips { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--mds-line); overflow-x: auto; scrollbar-width: none; }
.mds-chips::-webkit-scrollbar { display: none; }
.mds-chip {
    flex-shrink: 0;
    font: 600 12px/1 var(--mds-font);
    padding: 7px 13px;
    border-radius: 20px;
    border: 0;
    background: var(--mds-solid-2);
    color: var(--mds-muted);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}
.mds-chip:hover { color: #fff; }
.mds-chip.on { background: var(--mds-accent); color: #fff; }

.mds-list { max-height: min(62vh, 470px); overflow-y: auto; }
.mds-item { display: flex; gap: 12px; align-items: center; padding: 10px 14px; color: var(--mds-text) !important; text-decoration: none; transition: background .12s ease; }
.mds-item:hover, .mds-item.is-active { background: var(--mds-solid-2); }
.mds-poster { width: 42px; height: 60px; flex-shrink: 0; border-radius: 6px; overflow: hidden; background: var(--mds-solid-2); display: block; }
.mds-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mds-info { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.mds-title { font-size: 14px; font-weight: 600; color: #fff; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mds-title mark, .mds-match mark { background: none; color: var(--mds-accent-2); }
.mds-match { font-size: 12px; color: var(--mds-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mds-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--mds-dim); }

.mds-badge { display: inline-block; font: 700 10px/1 var(--mds-font); padding: 4px 7px; border-radius: 4px; text-transform: uppercase; letter-spacing: .4px; }
.mds-b-movie { background: rgba(59, 130, 246, .18); color: #7fb0ff; }
.mds-b-tv { background: rgba(245, 158, 11, .18); color: #fbbf4b; }
.mds-b-ep { background: rgba(16, 185, 129, .18); color: #4fd8a4; }
.mds-b-q { background: var(--mds-solid-2); color: #d4d4d8; }
.mds-imdb { color: var(--mds-gold); font-weight: 700; }

.mds-all { display: block; padding: 13px 14px; text-align: center; font-size: 13px; font-weight: 600; color: var(--mds-accent-2) !important; border-top: 1px solid var(--mds-line); text-decoration: none; }
.mds-all:hover { background: var(--mds-solid-2); }

.mds-hint { padding: 18px 16px; font-size: 13px; color: var(--mds-muted); }
.mds-recent { padding: 12px 14px 16px; }
.mds-recent-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.mds-recent-h span { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--mds-dim); }
.mds-clear { background: none; border: 0; color: var(--mds-muted); font-size: 12px; cursor: pointer; }
.mds-clear:hover { color: #fff; }
.mds-rtags { display: flex; flex-wrap: wrap; gap: 8px; }
.mds-rtag { border: 0; cursor: pointer; font: 400 13px/1 var(--mds-font); padding: 8px 12px 8px 30px; border-radius: 8px; color: #d4d4d8; background: var(--mds-solid-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E") no-repeat 10px 50%; }
.mds-rtag:hover { color: #fff; background-color: #22222b; }

.mds-empty { padding: 22px 16px; text-align: center; }
.mds-empty-t { font-size: 14px; color: var(--mds-muted); margin-bottom: 12px; }
.mds-req, .mds-req-btn { display: inline-block; padding: 9px 18px; border-radius: 10px; background: var(--mds-accent); color: #fff !important; font-size: 13px; font-weight: 600; text-decoration: none; }
.mds-req:hover, .mds-req-btn:hover { background: var(--mds-accent-2); }

.mds-skel .mds-poster, .mds-line { background: linear-gradient(90deg, #17171e 0%, #22222b 50%, #17171e 100%); background-size: 200% 100%; animation: mdsShimmer 1.1s linear infinite; }
.mds-line { height: 10px; border-radius: 5px; }
.mds-line.w70 { width: 220px; } .mds-line.w40 { width: 120px; }
@keyframes mdsShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Search results page ---------- */
.md-search-page .module.mds-module { min-height: 0; }
.mds-page { padding: 30px 34px 40px; font-family: var(--mds-font); color: var(--mds-text); }
.mds-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; flex-wrap: wrap; }
.mds-heading h1 { font: 700 26px/1.3 var(--mds-display); color: #fff; margin: 0; }
.mds-heading h1 span { color: var(--mds-accent-2); }
.mds-heading p { color: var(--mds-muted); font-size: 14px; margin: 6px 0 0; }

.mds-big { display: flex; align-items: center; gap: 10px; width: 520px; max-width: 100%; height: 52px; padding: 0 7px 0 18px; background: var(--mds-field); border: 1.5px solid var(--mds-line-2); border-radius: 14px; color: var(--mds-dim); transition: border-color .2s ease, box-shadow .2s ease; }
.mds-big:focus-within { border-color: var(--mds-accent); box-shadow: 0 0 0 4px rgba(229, 9, 20, .16); color: var(--mds-accent); }
.mds-big svg { flex-shrink: 0; }
.mds-big input[type=text] { flex: 1; min-width: 0; height: 100%; background: none !important; border: 0 !important; padding: 0 !important; color: #fff !important; font: 400 16px var(--mds-font) !important; box-shadow: none !important; outline: 0; }
.mds-big input::placeholder { color: var(--mds-dim); }
.mds-big button { height: 38px; padding: 0 20px; border: 0; border-radius: 10px; background: var(--mds-accent); color: #fff; font: 600 14px var(--mds-font); cursor: pointer; }
.mds-big button:hover { background: var(--mds-accent-2); }

.mds-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--mds-line); border-bottom: 1px solid var(--mds-line); margin-bottom: 24px; }
.mds-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.mds-tab { font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 10px; background: var(--mds-solid); color: var(--mds-muted) !important; text-decoration: none; transition: background .15s ease, color .15s ease; }
.mds-tab small { font-size: 11px; opacity: .7; margin-left: 6px; font-weight: 500; }
.mds-tab:hover { color: #fff !important; background: var(--mds-solid-2); }
.mds-tab.on { background: var(--mds-accent); color: #fff !important; }
.mds-filter { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; }
.mds-select { display: inline-flex; align-items: center; gap: 4px; padding: 0 10px 0 14px; height: 38px; border-radius: 10px; background: var(--mds-solid); border: 1px solid var(--mds-line-2); font-size: 13px; color: var(--mds-dim); cursor: pointer; }
.mds-select select { background: transparent !important; border: 0 !important; color: #e4e4e7 !important; font: 500 13px var(--mds-font) !important; padding: 0 4px !important; height: 36px; cursor: pointer; outline: 0; box-shadow: none !important; }
.mds-select select option { background: var(--mds-solid); color: #e4e4e7; }
.mds-go { height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--mds-accent); color: #fff; }

.mds-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 22px 20px; }
.mds-card { min-width: 0; }
.mds-card-link { display: block; color: inherit !important; text-decoration: none; }
.mds-card-poster { position: relative; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; background: var(--mds-solid-2); }
.mds-card-poster img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s var(--md-ease, ease), filter .35s ease; }
.mds-card-link:hover .mds-card-poster img { transform: scale(1.06); }
.mds-card-poster::after { content: ""; position: absolute; inset: 55% 0 0; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); pointer-events: none; }
.mds-card-poster .mds-badge { position: absolute; top: 8px; left: 8px; z-index: 1; }
.mds-card-poster .mds-b-movie { background: #1d4ed8; color: #fff; }
.mds-card-poster .mds-b-tv { background: #d97706; color: #fff; }
.mds-card-poster .mds-b-ep { background: #059669; color: #fff; }
.mds-card-poster .mds-q { left: auto; right: 8px; background: rgba(0, 0, 0, .7); color: #fff; }
.mds-rate { position: absolute; left: 8px; bottom: 8px; z-index: 1; font-size: 12px; font-weight: 700; color: var(--mds-gold); background: rgba(0, 0, 0, .72); padding: 4px 8px; border-radius: 6px; }
.mds-card-title { font: 600 14px/1.35 var(--mds-font); color: #fff; margin: 10px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mds-card-link:hover .mds-card-title { color: var(--mds-accent-2); }
.mds-card-match { font-size: 12px; color: var(--mds-accent-2); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mds-card-meta { font-size: 12px; color: var(--mds-dim); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mds-pag { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 34px; }
.mds-pag a, .mds-pag span { min-width: 40px; height: 40px; padding: 0 12px; border-radius: 10px; background: var(--mds-solid); display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; color: var(--mds-muted) !important; text-decoration: none; border: 0 !important; }
.mds-pag a:hover { background: var(--mds-solid-2); color: #fff !important; }
.mds-pag .current { background: var(--mds-accent); color: #fff !important; }
.mds-pag .dots { background: none; }

.mds-noresult { max-width: 560px; margin: 30px auto 10px; padding: 34px 30px; text-align: center; background: var(--mds-solid); border: 1px solid var(--mds-line); border-radius: 18px; }
.mds-noresult-icon { width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(229, 9, 20, .12); color: var(--mds-accent-2); }
.mds-noresult h2 { font: 700 20px/1.4 var(--mds-display); color: #fff; margin: 0 0 14px; }
.mds-noresult ul { list-style: none; margin: 0 0 22px; padding: 0; color: var(--mds-muted); font-size: 14px; line-height: 1.9; }
.mds-noresult ul a { color: var(--mds-accent-2) !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) { .mds-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (max-width: 1024px) {
    header.main .hbox .headitems .search { width: 240px !important; }
    .mds-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .mds-big { width: 100%; }
}
@media (max-width: 768px) {
    .mds-page { padding: 20px 14px 30px; }
    .mds-heading h1 { font-size: 21px; }
    .mds-top { margin-bottom: 16px; }
    .mds-big { height: 48px; }
    .mds-bar { flex-direction: column; align-items: stretch; }
    .mds-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .mds-tabs::-webkit-scrollbar { display: none; }
    .mds-tab { flex-shrink: 0; }
    .mds-filter .mds-select { flex: 1; }
    .mds-filter .mds-select select { flex: 1; }
    .mds-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 12px; }
    .mds-list { max-height: 60vh; }
}
@media (max-width: 480px) {
    .mds-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mds-pag a, .mds-pag span { min-width: 36px; height: 36px; }
}
