/* =====================================================================
   لوحة الإدارة + شاشات الدخول والبوابة
   ===================================================================== */

/* ======================= الدخول والبوابة ======================= */
.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.auth-card, .portal {
    width: min(94vw, 440px);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(28px, 5vw, 46px);
    text-align: center;
    animation: fadeUp .5s ease both;
}
.auth-shield { width: 56px; height: 62px; color: var(--gold); margin-bottom: 8px; }
.auth-logo { width: clamp(90px, 22vw, 120px); height: auto; margin: 0 auto 10px; display: block; object-fit: contain; }
.auth-title {
    font-size: clamp(26px, 5vw, 38px); font-weight: 800; color: var(--gold);
    background: linear-gradient(90deg, #a87b12, var(--gold), #f0d488, var(--gold));
    background-size: 250% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: shimmer 6s linear infinite;
}
.auth-sub { color: var(--text-dim); margin-top: 4px; margin-bottom: 22px; font-size: clamp(14px, 2vw, 18px); }

.auth-form { display: flex; flex-direction: column; gap: 16px; text-align: start; }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field span { font-weight: 700; color: var(--navy); font-size: 15px; }
.auth-field input {
    padding: 14px 16px; font-family: inherit; font-size: 17px;
    color: var(--text); background: #fff;
    border: 1.5px solid var(--panel-border); border-radius: 12px; outline: none;
    transition: border-color .15s ease;
}
.auth-field input:focus { border-color: var(--gold); }
.auth-error {
    color: #b23434; background: rgba(255, 107, 107, .1);
    border: 1px solid rgba(255, 107, 107, .4); border-radius: 10px;
    padding: 10px 14px; font-weight: 700; font-size: 14px; text-align: center;
}
.auth-submit { margin-top: 6px; width: 100%; }

/* البوابة */
.portal-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 8px 0 18px; }
.portal-card {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 26px 14px; text-decoration: none; color: var(--navy);
    background: #fff; border: 1.5px solid var(--panel-border); border-radius: 18px;
    box-shadow: var(--shadow); transition: transform .15s ease, border-color .15s ease;
}
.portal-card:hover { transform: translateY(-4px); }
.portal-card--admin:hover { border-color: var(--gold); }
.portal-card--public:hover { border-color: #3ea6ff; }
.portal-ic { font-size: 42px; line-height: 1; }
.portal-name { font-weight: 800; font-size: clamp(15px, 2.4vw, 19px); }
.portal-desc { color: var(--text-dim); font-size: 13px; }
.portal-logout { color: var(--text-dim); text-decoration: none; font-size: 14px; }
.portal-logout:hover { color: #b23434; }

@media (max-width: 420px) { .portal-choices { grid-template-columns: 1fr; } }

/* ======================= لوحة الإدارة ======================= */
.admin-body { overflow-x: hidden; }
.admin { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.admin-side {
    background: var(--navy);
    color: #eaf0ff;
    display: flex; flex-direction: column;
    padding: 22px 16px;
    position: sticky; top: 0; height: 100vh;
}
.admin-brand { text-align: center; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.admin-brand__title { display: block; font-size: 24px; font-weight: 800; color: var(--gold-soft); }
.admin-brand__sub { display: block; font-size: 13px; color: #9fb0d8; margin-top: 2px; }

.admin-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; flex: 1; }
.admin-nav__item {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 14px; border-radius: 12px;
    background: transparent; border: none; color: #d6e0fb;
    font-family: inherit; font-size: 15px; font-weight: 700; text-align: start;
    cursor: pointer; transition: background .15s ease, color .15s ease;
}
.admin-nav__item:hover { background: rgba(255,255,255,.07); }
.admin-nav__item.active { background: var(--gold); color: #2b2205; }
.admin-nav__ic { font-size: 20px; }

.admin-side__foot { display: flex; flex-direction: column; gap: 8px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); }
.admin-link { color: #9fb0d8; text-decoration: none; font-size: 14px; padding: 6px 8px; border-radius: 8px; }
.admin-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-link--out:hover { color: #ffb3b3; }

.admin-main { padding: clamp(20px, 3vw, 40px); max-width: 1000px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.admin-head h1 { color: var(--navy); font-size: clamp(20px, 3vw, 28px); }
.admin-actions { display: flex; gap: 10px; }
.admin-hint { color: var(--text-dim); margin-top: 8px; font-size: 15px; line-height: 1.7; }
.admin-warn {
    margin-top: 12px; padding: 12px 18px; border-radius: 12px;
    background: rgba(255, 170, 40, .12); border: 1.5px solid #e0a020; color: #8a5a00;
    font-weight: 700; line-height: 1.7;
}
.admin-warn code { background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 5px; direction: ltr; }

.admin-toast {
    margin: 14px 0; padding: 12px 18px; border-radius: 12px; font-weight: 700;
    animation: fadeUp .3s ease;
}
.admin-toast.ok { background: rgba(53,201,142,.14); border: 1px solid #35c98e; color: #14794f; }
.admin-toast.err { background: rgba(255,107,107,.12); border: 1px solid #ff6b6b; color: #b23434; }

/* المحرّر */
.admin-editor { display: flex; flex-direction: column; gap: 16px; margin-top: 18px; }

.admin-top {
    display: flex; flex-wrap: wrap; gap: 16px;
    background: var(--panel); border: 1px solid var(--panel-border);
    border-radius: 14px; padding: 16px 18px;
}

.admin-item {
    background: var(--panel); border: 1px solid var(--panel-border);
    border-radius: 16px; padding: 18px 20px; box-shadow: var(--shadow);
    position: relative;
}
.admin-item__head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px dashed var(--panel-border);
}
.admin-item__num { font-weight: 800; color: var(--gold); font-size: 16px; }
.admin-item__del {
    background: rgba(255,107,107,.1); border: 1px solid rgba(255,107,107,.4);
    color: #b23434; border-radius: 10px; padding: 7px 12px;
    font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
}
.admin-item__del:hover { background: rgba(255,107,107,.2); }
.admin-item__del.armed { background: #ff6b6b; color: #fff; border-color: #ff6b6b; font-weight: 800; }

.admin-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.admin-field > label { font-weight: 700; color: var(--navy); font-size: 14px; }
.admin-field input[type=text], .admin-field textarea, .admin-field select, .admin-field input[type=number] {
    font-family: inherit; font-size: 15px; color: var(--text);
    background: #fff; border: 1.5px solid var(--panel-border); border-radius: 10px;
    padding: 11px 14px; outline: none; width: 100%; transition: border-color .15s ease;
}
.admin-field textarea { min-height: 72px; resize: vertical; line-height: 1.7; }
.admin-field input:focus, .admin-field textarea:focus, .admin-field select:focus { border-color: var(--gold); }
.admin-field--inline { flex-direction: row; align-items: center; gap: 10px; }
.admin-field--inline input { width: auto; }
.admin-field input[type=color] { width: 54px; height: 40px; padding: 3px; border-radius: 10px; border: 1.5px solid var(--panel-border); cursor: pointer; }

/* قائمة الخيارات مع تحديد الصحيح */
.admin-opts { display: flex; flex-direction: column; gap: 8px; }
.admin-opt { display: flex; align-items: center; gap: 10px; }
.admin-opt input[type=text] { flex: 1; }
.admin-opt__mark { display: flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 13px; color: var(--text-dim); font-weight: 700; }
.admin-opt__mark input { width: 20px; height: 20px; accent-color: #35c98e; }
.admin-opt__del {
    background: none; border: none; color: #b23434; cursor: pointer; font-size: 20px; line-height: 1;
    padding: 4px 8px; border-radius: 8px;
}
.admin-opt__del:hover { background: rgba(255,107,107,.12); }
.admin-add-opt {
    align-self: flex-start; background: rgba(62,166,255,.1); border: 1px dashed #3ea6ff;
    color: #1d6fb8; border-radius: 10px; padding: 8px 14px;
    font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
}
.admin-add-opt:hover { background: rgba(62,166,255,.18); }

/* خيارات الأطفال (نص + صحيح + تغذية) */
.admin-choice {
    border: 1px solid var(--panel-border); border-radius: 12px; padding: 12px; margin-bottom: 10px;
    background: rgba(28,44,85,.02);
}
.admin-choice__top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.admin-choice__top input[type=text] { flex: 1; }

/* حقل الفيديو في لوحة الإدارة */
.admin-video { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.admin-video__preview { width: min(100%, 340px); border-radius: 12px; border: 1px solid var(--panel-border); background: #000; }
.admin-video__name { font-size: 13px; color: var(--text-dim); direction: ltr; }
.admin-cardimg { width: 150px; height: 150px; object-fit: contain; border-radius: 12px; border: 1px solid var(--panel-border); background: #f4f7fe; }

.admin-raw { margin-top: 24px; }
.admin-raw summary { cursor: pointer; color: var(--text-dim); font-weight: 700; }
.admin-raw textarea {
    width: 100%; min-height: 260px; margin-top: 12px;
    font-family: "Consolas", monospace; font-size: 13px; direction: ltr;
    border: 1.5px solid var(--panel-border); border-radius: 12px; padding: 14px;
}

@media (max-width: 760px) {
    .admin { grid-template-columns: 1fr; }
    .admin-side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; gap: 8px; }
    .admin-nav { flex-direction: row; flex-wrap: wrap; }
}
