/* ===== المتغيرات ===== */
:root {
  --primary:    #4f46e5;
  --primary-h:  #4338ca;
  --success:    #10b981;
  --error:      #ef4444;
  --bg:         #f8fafc;
  --surface:    #ffffff;
  --border:     #e2e8f0;
  --text:       #1e293b;
  --text-muted: #64748b;
  --radius:     14px;
  --shadow:     0 4px 24px rgba(0,0,0,.08);
}

/* ===== أساسيات ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== الهيدر ===== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
}

.logo svg { width: 28px; height: 28px; }

.lang-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .875rem;
  transition: all .2s;
}

.lang-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ===== المحتوى الرئيسي ===== */
main {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 48px 24px 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

/* ===== البطل ===== */
.hero { text-align: center; }

.hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
}

/* ===== بطاقة الرفع ===== */
.upload-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ===== منطقة السحب والإفلات ===== */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 10px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: #f5f3ff;
}

.drop-icon svg {
  width: 48px;
  height: 48px;
  color: var(--primary);
  opacity: .7;
}

.drop-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.drop-sub  { color: var(--text-muted); font-size: .9rem; }
.drop-limit { color: var(--text-muted); font-size: .8rem; }

/* ===== معلومات الملف المختار ===== */
.file-info {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 14px 16px;
}

.file-icon {
  background: var(--primary);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  padding: 6px 8px;
  border-radius: 6px;
  letter-spacing: .5px;
}

.file-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.file-name {
  font-weight: 600;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size { color: var(--text-muted); font-size: .8rem; }

.remove-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all .2s;
}

.remove-btn:hover { background: #fee2e2; color: var(--error); }

/* ===== مستوى الضغط ===== */
.level-label {
  font-weight: 600;
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: -8px;
}

.level-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.level-option { cursor: pointer; }
.level-option input { display: none; }

.level-card {
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}

.level-option input:checked + .level-card {
  border-color: var(--primary);
  background: #f5f3ff;
}

.level-card:hover { border-color: var(--primary); }

.level-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.level-name { font-weight: 700; font-size: .95rem; }
.level-desc { color: var(--text-muted); font-size: .75rem; line-height: 1.4; }

/* ===== زر الضغط ===== */
.compress-btn {
  width: 100%;
  padding: 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}

.compress-btn:hover  { background: var(--primary-h); transform: translateY(-1px); }
.compress-btn:active { transform: translateY(0); }

/* ===== شريط التحميل ===== */
.progress-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.progress-label { font-weight: 600; color: var(--text-muted); }

.progress-bar {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), #7c3aed);
  border-radius: 99px;
  transition: width .4s ease;
  animation: progress-pulse 1.5s ease-in-out infinite;
}

@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .7; }
}

/* ===== النتيجة ===== */
.result-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.result-icon {
  width: 56px;
  height: 56px;
  background: var(--success);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.result-card h2 { font-size: 1.3rem; }

.result-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.stat { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.stat-label { font-size: .8rem; color: var(--text-muted); }
.stat-value { font-size: 1.1rem; font-weight: 700; }
.stat-arrow { font-size: 1.3rem; color: var(--text-muted); }
.savings .stat-value { color: var(--success); }

.download-btn {
  display: inline-block;
  padding: 14px 32px;
  background: var(--success);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-weight: 700;
  font-size: .95rem;
  transition: all .2s;
}

.download-btn:hover { background: #059669; transform: translateY(-1px); }

.expiry-note { color: var(--text-muted); font-size: .82rem; }

.new-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-size: .875rem;
  transition: all .2s;
}

.new-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ===== الخطأ ===== */
.error-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.error-icon {
  width: 56px;
  height: 56px;
  background: var(--error);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
}

.error-msg { color: var(--text); font-size: .95rem; }

/* ===== الميزات ===== */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
}

.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.feature-icon { font-size: 1.6rem; }
.feature h3   { font-size: .9rem; font-weight: 700; }
.feature p    { color: var(--text-muted); font-size: .8rem; line-height: 1.5; }

/* ===== الفوتر ===== */
footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: .85rem;
  border-top: 1px solid var(--border);
}

/* ===== الاستجابة للشاشات الصغيرة ===== */
@media (max-width: 560px) {
  header { padding: 14px 16px; }
  main   { padding: 32px 16px 48px; }

  .upload-card { padding: 20px; }
  .drop-zone   { padding: 28px 16px; }

  .level-options { grid-template-columns: 1fr; }
  .features      { grid-template-columns: 1fr; }

  .result-stats { flex-direction: column; gap: 12px; }
  .stat-arrow   { transform: rotate(90deg); }
}
