:root{
  --bg:#f6f8fb;
  --card:#ffffff;
  --accent:#1e88e5;
  --text:#222;
  --muted:#666;
}

*{box-sizing:border-box}
html,body{height:100%;margin:0;font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial;}
body{background:var(--bg);color:var(--text);display:flex;align-items:flex-start;justify-content:center;padding:28px;}
.container{width:100%;max-width:980px;background:var(--card);padding:20px;border-radius:10px;box-shadow:0 6px 24px rgba(16,24,40,0.08);direction:rtl}
h1{margin:0 0 12px;font-size:20px;text-align:center}
.controls{display:flex;gap:12px;align-items:center;flex-wrap:wrap;justify-content:center;margin:10px 0 18px}
.controls label{font-weight:600}
.controls input[type="number"]{width:88px;padding:6px;margin-inline-start:8px}
.buttons{display:flex;gap:8px}
button{padding:8px 12px;border-radius:6px;border:1px solid #ccc;background:white;cursor:pointer}
button.primary{background:var(--accent);color:white;border-color:transparent}
button:hover{opacity:0.95}
.parties h2{margin-top:8px;margin-bottom:8px}
table{width:100%;border-collapse:collapse;background:transparent;margin-bottom:12px}
thead th{background:#f0f6ff;padding:10px;border-bottom:1px solid #e6eefc;font-weight:700;text-align:center}
tbody td{padding:8px;border-bottom:1px solid #eee;text-align:center}
input.party-name,input.party-votes{width:100%;padding:6px;border:1px solid #ddd;border-radius:6px}
.actions-btn{background:#ffebee;border-color:#f2c2c2}
.results{margin-top:12px}
#summary{margin-bottom:10px;font-weight:700;color:var(--muted)}
footer{margin-top:12px;text-align:center;color:var(--muted)}
.removeBtn{background:#ffecec;border-color:#f3c2c2;padding:6px 8px;border-radius:6px}
.small{font-size:13px;color:var(--muted)}

@media (max-width:640px){
  .controls{flex-direction:column}
  thead th, tbody td{text-align:center;font-size:13px}
}

/* أزرار التحميل */
#downloadSeatsBtn, #downloadResultsBtn {
  display: inline-block;
  background-color: #F53BC3;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.15s ease;
  margin-bottom: 20px;
}

#downloadSeatsBtn:hover, #downloadResultsBtn:hover {
  background-color: #6D3BF5;
  transform: scale(1.03);
}

#downloadSeatsBtn:active, #downloadResultsBtn:active {
  transform: scale(0.97);
}

.note {
  text-align: center;
  color: #555;
  font-size: 14px;
  margin-top: 8px;
}

/* روابط التواصل الاجتماعي */
.social-links {
  margin-top: 15px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.social-links a {
  font-size: 34px;
  color: #555;
  transition: 0.25s;
}

.social-links a:hover {
  color: #000;
}

.social-links a:hover i {
  transform: scale(1.2);
}

/* زر تحميل تحليل الذكاء الاصطناعي */
#downloadAnalysisBtn {
  display: block;
  background-color: #F53BC3;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.25s ease, transform 0.15s ease;
  margin: 10px auto 20px auto;
}

#downloadAnalysisBtn:hover {
  background-color: #9c2880; 
  transform: scale(1.03);
}

#downloadAnalysisBtn:active {
  transform: scale(0.97);
}

/* ------------------------------------- */
/* --- تعريف حركة الموجة النيونية --- */
/* ------------------------------------- */
@keyframes neon-wave {
    0% {
        box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
        border-color: #00c7e2;
    }
    50% {
        box-shadow: 0 0 25px rgba(0, 243, 255, 0.7);
        border-color: #33e8ff;
    }
    100% {
        box-shadow: 0 0 10px rgba(0, 243, 255, 0.4);
        border-color: #00c7e2;
    }
}

/* === تنسيق منطقة ناتج التحليل (الذكاء الاصطناعي) === */
#analysisOutput {
    white-space: pre-wrap;
    word-break: break-word;
    
    background: #1e1e1e; 
    border: 1px solid #00c7e2; 
    color: #f0f0f0; 
    padding: 20px;
    border-radius: 10px;
    
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px; 
    line-height: 1.65;
    margin-top: 15px;

    animation: neon-wave 5s infinite alternate ease-in-out;
}

/* تنسيقات Markdown داخل التحليل */
#analysisOutput h1 {
    color: #00fff3; 
    border-bottom: 2px solid #00fff3;
    padding-bottom: 10px;
    margin-top: 25px;
    font-size: 2.2em;
    line-height: 1.2;
}

#analysisOutput h2 {
    color: #a0f0ff; 
    border-bottom: 1px dashed #444;
    padding-bottom: 5px;
    margin-top: 20px;
    font-size: 1.8em;
}

#analysisOutput h3 {
    color: #f9d86c; 
    margin-top: 15px;
    font-size: 1.4em;
}

#analysisOutput h4, #analysisOutput h5, #analysisOutput h6 {
    color: #d0d0d0;
    margin-top: 10px;
    font-size: 1.2em;
}

#analysisOutput strong, #analysisOutput b {
    color: #fff;
    font-weight: 700;
}

#analysisOutput em, #analysisOutput i {
    color: #b0e0a0; 
    font-style: italic;
}

#analysisOutput strong em, #analysisOutput b i {
    color: #ffc0cb; 
    font-weight: 800;
    font-style: italic;
}

#analysisOutput del, #analysisOutput s {
    color: #888;
    text-decoration: line-through;
}

#analysisOutput u {
    text-decoration: underline 2px solid #f9d86c; 
    text-underline-offset: 4px;
}

#analysisOutput mark {
    background-color: #fffd38; 
    color: #000;
    padding: 2px 5px;
    border-radius: 3px;
    font-weight: 700;
}