:root {
  --primary: #1877f2;
  --primary-dark: #145dbf;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1c1e21;
  --muted: #65676b;
  --border: #e4e6eb;
}
* { box-sizing: border-box; font-family: system-ui, -apple-system, sans-serif; }
body { background: var(--bg); color: var(--text); margin: 0; display: flex; flex-direction: column; align-items: center; min-height: 100vh; }
.navbar { width: 100%; background: var(--card); box-shadow: 0 2px 10px rgba(0,0,0,0.05); padding: 12px 20px; display: flex; justify-content: center; }
.nav-inner { width: 100%; max-width: 750px; display: flex; justify-content: space-between; align-items: center; }
.brand { font-weight: 800; font-size: 22px; color: var(--primary); text-decoration: none; }
.lang-select { background: #f0f2f5; border: 1px solid #ddd; padding: 7px 10px; border-radius: 8px; font-size: 13px; font-weight: bold; color: var(--text); outline: none; cursor: pointer; }
.main-wrapper { width: 100%; max-width: 750px; padding: 20px 15px; flex: 1; }
.hero-card, .section-card { background: var(--card); padding: 25px 20px; border-radius: 16px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 20px; }
.hero-card { text-align: center; }
h1 { color: var(--primary); margin: 0 0 8px 0; font-size: 28px; }
p.subtitle { color: var(--muted); margin: 0 0 20px 0; font-size: 14px; }

/* مربع الرابط */
.input-box { display: flex; align-items: center; background: #f8f9fa; padding: 4px 10px; border: 2px solid #ddd; border-radius: 12px; margin-bottom: 12px; }
.input-box:focus-within { border-color: var(--primary); background: #fff; }
input[type="url"] { flex: 1; border: none; background: transparent; padding: 12px 6px; font-size: 15px; outline: none; min-width: 0; }
.clear-btn { display: none; background: #ffebe9; color: #d93025; border: none; width: 32px; height: 32px; border-radius: 50%; font-weight: bold; cursor: pointer; font-size: 14px; align-items: center; justify-content: center; flex-shrink: 0; }

/* أزرار اللصق والجلب */
.action-buttons { display: flex; gap: 10px; width: 100%; }
.paste-btn, .fetch-btn { flex: 1; padding: 14px; border: none; border-radius: 12px; font-size: 16px; font-weight: bold; cursor: pointer; }
.paste-btn { background: #e4e6eb; color: var(--text); }
.fetch-btn { background: var(--primary); color: white; }
.fetch-btn:hover { background: var(--primary-dark); }

.loader { display: none; margin: 20px auto; border: 4px solid #f3f3f3; border-top: 4px solid var(--primary); border-radius: 50%; width: 36px; height: 36px; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.error-msg { display: none; color: #d93025; background: #fce8e6; padding: 12px; border-radius: 8px; margin-top: 15px; font-size: 14px; }

/* أزرار التنزيل الأصلية تظهر تحت زر اللصق والجلب مباشرة */
.result-card { display: none; margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px; }
.media-preview { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; background: #f8f9fa; padding: 12px; border-radius: 12px; text-align: start; }
.media-preview img { width: 100px; height: 75px; object-fit: cover; border-radius: 8px; background: #ddd; }
.media-info h3 { margin: 0 0 5px 0; font-size: 14px; }
.media-info span { font-size: 12px; color: #42b72a; font-weight: bold; }

.download-grid { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.dl-btn { display: flex; align-items: center; justify-content: center; width: 100%; padding: 15px; border-radius: 12px; text-decoration: none; color: white; font-weight: bold; font-size: 15px; border: none; cursor: pointer; }
.btn-hd { background: #1877f2; }
.btn-sd { background: #42b72a; }
.btn-mp3 { background: #e1306c; }
.btn-photo { background: #f59e0b; }
.btn-combo { background: #7c3aed; }

.status-text { font-size: 13px; color: #7c3aed; margin-top: 10px; display: none; font-weight: bold; }
.section-card h2 { margin: 0 0 15px 0; font-size: 19px; text-align: center; }
.steps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.step-item { background: #f8f9fa; padding: 15px; border-radius: 12px; text-align: center; }
.step-num { width: 30px; height: 30px; background: var(--primary); color: white; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: bold; margin-bottom: 8px; }
.step-item h4 { margin: 0 0 5px 0; font-size: 15px; }
.step-item p { margin: 0; font-size: 13px; color: var(--muted); }
details { border-bottom: 1px solid var(--border); padding: 12px 0; }
summary { font-weight: bold; font-size: 14px; cursor: pointer; }
details p { margin: 8px 0 0 0; font-size: 13px; color: var(--muted); }
footer { width: 100%; background: var(--card); padding: 18px; text-align: center; border-top: 1px solid var(--border); margin-top: auto; }
.footer-links { display: flex; justify-content: center; gap: 18px; margin-bottom: 8px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); text-decoration: none; font-size: 13px; font-weight: bold; cursor: pointer; }
.copyright { font-size: 12px; color: #8a8d91; }
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); align-items: center; justify-content: center; padding: 15px; z-index: 100; }
.modal-content { background: white; padding: 20px; border-radius: 12px; max-width: 480px; width: 100%; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 12px; }
.close-btn { background: none; border: none; font-size: 22px; cursor: pointer; }
/* تنسيق نافذة إعلان الفيديو في منتصف الشاشة */
.ad-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 15px;
}
.ad-modal-box {
  background: #1c1e21;
  color: white;
  width: 100%;
  max-width: 450px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.ad-top-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: #242526;
  font-size: 13px;
}
.skip-btn {
  background: #1877f2;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
}
.skip-btn:disabled {
  background: #555;
  cursor: not-allowed;
}
.video-ad-container {
  width: 100%;
  min-height: 250px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.ad-placeholder {
  color: #aaa;
  font-size: 14px;
}
/* تنسيق صندوق إعلان البانير الثابت في الأعلى */
.safe-banner-ad {
  width: 100%;
  min-height: 65px;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.ad-label {
  font-size: 13px;
  color: #65676b;
  font-weight: 600;
}
