/**
 * Diabeticpatients - واجهة تطبيق موبايل
 * يبدو كتطبيق هاتف على الموبايل والكمبيوتر
 */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --blue: #0d6e8a;
    --blue-dark: #0a5469;
    --blue-soft: #e6f4f8;
    --green: #1f8a4c;
    --green-soft: #e8f7ee;
    --red: #d62828;
    --red-dark: #b01f1f;
    --red-soft: #fdecec;
    --amber: #f4a261;
    --amber-soft: #fff4e8;
    --bg: #eef3f6;
    --surface: #ffffff;
    --text: #1a2b34;
    --muted: #5a6f7a;
    --line: #d7e3e9;
    --radius: 20px;
    --shadow: 0 10px 30px rgba(13, 110, 138, 0.1);
    --font: 'Cairo', Tahoma, Arial, sans-serif;
    --topbar-h: 96px;
    --tabbar-h: 78px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body.app-body {
    font-family: var(--font);
    font-size: 17px;
    color: var(--text);
    line-height: 1.6;
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    margin: 0;
    padding: 0;
    width: 100%;
}

a { color: var(--blue); text-decoration: none; }

/* ===== إطار التطبيق: ملء الشاشة على الموبايل ===== */
.app-shell {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

/* شكل هاتف فقط على الكمبيوتر الكبير */
@media (min-width: 768px) {
    body.app-body {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 20px;
        background: radial-gradient(circle at top, #134b5c, #07151b 60%);
    }

    .app-shell {
        width: 100%;
        max-width: 430px;
        height: min(900px, calc(100vh - 40px));
        height: min(900px, calc(100dvh - 40px));
        border-radius: 32px;
        border: 3px solid #1a3340;
        box-shadow: 0 20px 60px rgba(0,0,0,0.35);
        margin: 0 auto;
    }
}

/* ===== الشريط العلوي ===== */
.app-topbar {
    flex-shrink: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    z-index: 50;
    padding-top: env(safe-area-inset-top, 0px);
}

.app-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
    gap: 10px;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text) !important;
    min-width: 0;
}

.app-brand strong {
    display: block;
    font-size: 1.1rem;
    font-weight: 800;
    line-height: 1.2;
}

.app-brand small {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(145deg, var(--blue), var(--blue-dark));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}

.app-top-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-sos-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--red);
    color: #fff !important;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 800;
    font-size: 0.9rem;
}

.app-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--blue-soft);
    color: var(--blue-dark) !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    position: relative;
    border: 0;
    cursor: pointer;
}

.notif-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #d62828;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* تنبيهات لحظية بدون ريفرش */
.live-toast-stack {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4500;
    width: min(420px, calc(100% - 20px));
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.live-toast {
    background: #fff;
    color: var(--text);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
    border-right: 5px solid var(--blue);
    opacity: 0;
    transform: translateY(-12px);
    transition: all .22s ease;
}

.live-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.live-toast.danger {
    border-right-color: #d62828;
    background: #fff5f5;
}

.live-toast.info {
    border-right-color: #0d6e8a;
}

.live-toast-title {
    font-weight: 800;
    margin-bottom: 4px;
}

.live-toast-title i {
    margin-left: 4px;
    color: #d62828;
}

.live-toast-msg {
    font-size: 0.92rem;
    color: var(--muted);
    line-height: 1.5;
}

.help-alert-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 4000;
    background: #d62828;
    color: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 800;
    box-shadow: 0 10px 30px rgba(214, 40, 40, 0.35);
    max-width: min(420px, calc(100% - 24px));
    text-align: center;
    opacity: 0;
    transition: all .25s ease;
    pointer-events: none;
}

.help-alert-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.app-alert-strip {
    background: var(--amber-soft);
    color: #7a4a12;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 7px 12px;
    text-align: center;
    border-top: 1px solid #f0d7b4;
}

.app-alert-strip i {
    color: var(--red);
    margin-left: 4px;
}

/* ===== المحتوى ===== */
.app-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 14px 14px calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
    scroll-behavior: smooth;
}

.page-wrap,
.container,
.container-fluid {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100%;
}

/* ===== الشريط السفلي ===== */
.app-tabbar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding: 6px 6px calc(8px + var(--safe-bottom));
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    z-index: 60;
}

.tab-item {
    appearance: none;
    border: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: #7d919c !important;
    font-size: 0.72rem;
    font-weight: 700;
    font-family: var(--font);
    padding: 4px 2px;
    min-height: 56px;
    text-decoration: none !important;
}

.tab-item i {
    font-size: 1.25rem;
    line-height: 1;
}

.tab-item.active {
    color: var(--blue) !important;
}

.tab-item.tab-sos {
    position: relative;
    top: -18px;
}

.sos-circle {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(145deg, #e63946, #c1121f);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 8px 20px rgba(214, 40, 40, 0.4);
    border: 4px solid #fff;
}

.tab-sos span:last-child {
    color: var(--red);
    margin-top: 2px;
}

/* ===== البطاقات ===== */
.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    background: var(--surface);
    margin-bottom: 14px;
    overflow: hidden;
}

.card-header {
    background: var(--blue-soft) !important;
    color: var(--blue-dark) !important;
    border-bottom: 1px solid var(--line);
    font-size: 1.05rem;
    font-weight: 800;
    padding: 14px 16px;
}

.card-header.bg-danger {
    background: linear-gradient(135deg, var(--red), var(--red-dark)) !important;
    color: #fff !important;
    border-bottom: none;
}

.card-header.bg-warning {
    background: linear-gradient(135deg, #f4a261, #e76f51) !important;
    color: #fff !important;
    border-bottom: none;
}

.card-body { padding: 16px; }

/* ===== الأزرار ===== */
.btn {
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 700;
    padding: 13px 18px;
    border-radius: 16px;
    border-width: 2px;
}

.btn-lg {
    font-size: 1.15rem;
    padding: 15px 22px;
    border-radius: 16px;
}

.btn-xl {
    font-size: 1.4rem;
    padding: 20px 24px;
    border-radius: 22px;
    width: 100%;
    min-height: 74px;
}

.btn-primary {
    background: var(--blue);
    border-color: var(--blue);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
}

.btn-outline-primary {
    color: var(--blue);
    border-color: var(--blue);
    background: #fff;
}

.btn-outline-primary:hover {
    background: var(--blue-soft);
    color: var(--blue-dark);
    border-color: var(--blue);
}

.btn-outline-success {
    color: var(--green);
    border-color: var(--green);
}

.btn-outline-success:hover {
    background: var(--green-soft);
    color: #146c38;
}

.btn-outline-light {
    border-width: 2px;
    font-weight: 700;
}

.btn-light {
    background: #fff;
    color: var(--blue-dark);
    border: none;
    font-weight: 800;
}

.btn-emergency {
    background: linear-gradient(145deg, #e63946, #c1121f);
    color: #fff !important;
    border: none;
    box-shadow: 0 10px 28px rgba(214, 40, 40, 0.35);
    animation: pulse-emergency 2.2s infinite;
}

.btn-emergency:hover,
.btn-emergency:focus {
    background: linear-gradient(145deg, #c1121f, #9b0c16);
    color: #fff !important;
}

@keyframes pulse-emergency {
    0%, 100% { box-shadow: 0 10px 28px rgba(214, 40, 40, 0.35); }
    50% { box-shadow: 0 12px 36px rgba(214, 40, 40, 0.55); }
}

.btn-help {
    background: var(--green);
    color: #fff !important;
    border: none;
}

.btn-help:hover { background: #176b3b; color: #fff !important; }

/* ===== النماذج ===== */
.form-label {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.form-control,
.form-select {
    font-family: var(--font);
    font-size: 1.05rem;
    padding: 13px 14px;
    border-radius: 14px;
    border: 2px solid var(--line);
    min-height: 52px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 138, 0.18);
}

/* ===== الحالة ===== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 800;
}

.status-available { background: var(--green-soft); color: #146c38; }
.status-unavailable { background: var(--red-soft); color: #8f1d1d; }

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green { background: var(--green); }
.status-dot.red { background: var(--red); }

/* ===== الخريطة ===== */
#map {
    width: 100%;
    height: 42vh;
    min-height: 280px;
    border-radius: 16px;
    border: 2px solid var(--line);
    z-index: 1;
}

.legend-bar {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 10px;
    background: var(--blue-soft);
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.85rem;
}

.legend-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 5px;
    vertical-align: middle;
    border: 2px solid #fff;
}

.legend-marker.red { background: var(--red); }
.legend-marker.green { background: var(--green); }
.legend-marker.blue { background: var(--blue); }

/* ===== علامات الخريطة بأسماء واضحة ===== */
.help-request-marker,
.helper-marker,
.custom-marker {
    background: transparent !important;
    border: none !important;
}

.help-pin {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 160px;
}

.help-pin-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 160px;
    background: #ffffff;
    color: #1a2b34;
    border: 2px solid #d62828;
    border-radius: 16px;
    padding: 7px 10px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.22);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.help-pin-bubble strong {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.help-pin-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #d62828;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(214, 40, 40, 0.2);
}

.help-pin-arrow {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #d62828;
    margin-top: -1px;
}

.helper-pin {
    display: flex;
    justify-content: center;
    width: 140px;
}

.helper-pin-bubble {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 140px;
    background: #ffffff;
    color: #146c38;
    border: 2px solid #1f8a4c;
    border-radius: 14px;
    padding: 6px 9px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.helper-pin-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #1f8a4c;
    flex-shrink: 0;
}

.map-popup {
    text-align: right;
    min-width: 190px;
    font-family: var(--font);
    font-size: 0.95rem;
    line-height: 1.7;
}

.map-popup-title {
    display: inline-block;
    background: #fdecec;
    color: #d62828;
    font-weight: 800;
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 999px;
    margin-bottom: 6px;
}

.map-popup-title.helper {
    background: #e8f7ee;
    color: #1f8a4c;
}

/* ===== الصفحة الرئيسية ===== */
.hero-section {
    background: linear-gradient(160deg, var(--blue-dark), var(--blue));
    color: #fff;
    padding: 22px 16px 26px;
    border-radius: 0 0 24px 24px;
    text-align: center;
    margin: -14px -14px 16px;
}

.hero-kicker {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.22);
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.hero-section h1 {
    font-size: 1.9rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.hero-section p {
    font-size: 1rem;
    opacity: 0.95;
    margin: 0 auto 18px;
}

.hero-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.feature-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.feature-card {
    text-align: center;
    padding: 18px 14px;
}

.feature-icon {
    width: 58px;
    height: 58px;
    margin: 0 auto 10px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.feature-icon.red { background: var(--red-soft); color: var(--red); }
.feature-icon.blue { background: var(--blue-soft); color: var(--blue); }
.feature-icon.green { background: var(--green-soft); color: var(--green); }

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.feature-card p {
    color: var(--muted);
    margin: 0;
    font-size: 0.95rem;
}

.steps-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.step-item {
    text-align: center;
    padding: 14px 10px;
    background: var(--bg);
    border-radius: 16px;
    border: 1px solid var(--line);
}

.step-num {
    width: 40px;
    height: 40px;
    margin: 0 auto 8px;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.step-item.danger .step-num { background: var(--red); }
.step-item.success .step-num { background: var(--green); }

.step-item h5 {
    font-weight: 800;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.step-item p {
    color: var(--muted);
    margin: 0;
    font-size: 0.82rem;
}

/* ===== لوحة المستخدم ===== */
.welcome-card {
    background: linear-gradient(135deg, #fff, var(--blue-soft));
}

.welcome-card h2 {
    font-weight: 800;
    font-size: 1.35rem;
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.action-panel {
    display: flex;
    flex-direction: column;
}

.emergency-panel {
    text-align: center;
    padding: 22px 14px !important;
    background: linear-gradient(180deg, #fff, var(--red-soft));
}

.emergency-panel p {
    font-size: 1.05rem;
    color: var(--muted);
}

.quick-actions .btn { width: 100%; }

.app-section-title {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--muted);
    margin: 6px 2px 10px;
}

/* ===== الجداول ===== */
.table {
    font-size: 0.95rem;
}

.table th {
    background: var(--blue-soft);
    color: var(--blue-dark);
    font-weight: 800;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    padding: 12px 8px;
}

.table-responsive {
    border-radius: 14px;
}

/* ===== Admin ===== */
.stat-card {
    text-align: center;
    padding: 20px 12px;
    border-radius: var(--radius);
    color: #fff;
    border: none;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
    display: block;
}

.stat-card .stat-label {
    font-size: 0.9rem;
    font-weight: 600;
}

.stat-blue { background: linear-gradient(145deg, var(--blue), var(--blue-dark)); }
.stat-green { background: linear-gradient(145deg, #2a9d5c, #1f8a4c); }
.stat-red { background: linear-gradient(145deg, #e63946, #c1121f); }
.stat-orange { background: linear-gradient(145deg, #f4a261, #e76f51); }

.alert {
    font-size: 0.98rem;
    border-radius: 14px;
    padding: 14px;
    border: none;
    font-weight: 600;
}

.request-info-card { border-right: 6px solid var(--blue); }
.request-status-waiting { border-right-color: var(--amber) !important; }
.request-status-accepted { border-right-color: var(--green) !important; }
.request-status-completed { border-right-color: var(--blue) !important; }
.request-status-cancelled { border-right-color: var(--red) !important; }

.info-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 1rem;
}

.info-row:last-child { border-bottom: none; }
.info-label { font-weight: 700; color: var(--muted); }

.auth-card .card-header {
    text-align: center;
    font-size: 1.2rem;
}

.leaflet-popup-content {
    font-family: var(--font);
    font-size: 0.95rem;
}

/* ===== قائمة الحساب ===== */
.account-sheet {
    position: fixed;
    inset: 0;
    z-index: 200;
}

.account-sheet[hidden] { display: none !important; }

.account-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}

.account-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    border-radius: 24px 24px 0 0;
    padding: 12px 18px calc(24px + var(--safe-bottom));
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
}

@media (min-width: 768px) {
    .account-sheet-panel {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        max-width: 430px;
    }
}

.account-sheet-handle {
    width: 48px;
    height: 5px;
    border-radius: 999px;
    background: #d0dbe1;
    margin: 4px auto 14px;
}

.account-sheet-panel h3 {
    font-weight: 800;
    margin-bottom: 2px;
}

.sheet-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--line);
    color: var(--text) !important;
    font-weight: 700;
    font-size: 1.05rem;
}

.sheet-link.danger { color: var(--red) !important; }
.sheet-link i { font-size: 1.2rem; width: 24px; text-align: center; }

/* ===== نوافذ منبثقة جميلة داخل التطبيق ===== */
.app-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.app-modal[hidden] { display: none !important; }

.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 24, 32, 0.55);
    backdrop-filter: blur(4px);
}

.app-modal-card {
    position: relative;
    width: min(360px, 100%);
    background: #fff;
    border-radius: 24px;
    padding: 24px 20px 18px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    transform: translateY(18px) scale(0.96);
    opacity: 0;
    transition: all .2s ease;
}

.app-modal.show .app-modal-card {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.app-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.app-modal[data-type="success"] .app-modal-icon {
    background: #e8f7ee;
    color: #1f8a4c;
}

.app-modal[data-type="error"] .app-modal-icon,
.app-modal[data-type="danger"] .app-modal-icon {
    background: #fdecec;
    color: #d62828;
}

.app-modal[data-type="warning"] .app-modal-icon {
    background: #fff4e8;
    color: #c77700;
}

.app-modal[data-type="info"] .app-modal-icon,
.app-modal[data-type="confirm"] .app-modal-icon {
    background: #e6f4f8;
    color: #0d6e8a;
}

.app-modal-title {
    font-size: 1.25rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text);
}

.app-modal-text {
    color: var(--muted);
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 18px;
    white-space: pre-line;
}

.app-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-modal-btn {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
    font-weight: 800;
}

.btn-success {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.btn-success:hover {
    background: #176b3b;
    border-color: #176b3b;
    color: #fff;
}

/* ===== شات المساعدة ===== */
.chat-page {
    height: calc(100% - 8px);
    display: flex;
    flex-direction: column;
}

.chat-card {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 190px);
    min-height: 420px;
    margin-bottom: 0;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--blue-soft);
    border-bottom: 1px solid var(--line);
}

.chat-header strong {
    display: block;
    font-size: 1.05rem;
}

.chat-header small {
    color: var(--muted);
    font-size: 0.82rem;
}

.chat-header-actions {
    display: flex;
    gap: 6px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px;
    background: linear-gradient(180deg, #f7fafb, #eef4f7);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-empty {
    margin: auto;
    text-align: center;
    color: var(--muted);
    font-weight: 700;
    padding: 20px;
}

.chat-bubble {
    max-width: 82%;
    padding: 10px 12px;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.chat-bubble.mine {
    align-self: flex-start;
    background: var(--blue);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble.theirs {
    align-self: flex-end;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
    border-bottom-left-radius: 4px;
}

.chat-bubble-text {
    font-size: 1rem;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
}

.chat-bubble-meta {
    margin-top: 6px;
    font-size: 0.75rem;
    opacity: 0.8;
}

.chat-input-bar {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.chat-input-bar .form-control {
    min-height: 48px;
    border-radius: 14px;
}

.chat-send-btn {
    width: 52px;
    min-height: 48px;
    border-radius: 14px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-closed {
    text-align: center;
    padding: 14px;
    background: #fff4e8;
    color: #7a4a12;
    font-weight: 700;
    border-top: 1px solid #f0d7b4;
}

.chat-participants {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.chat-participant-chip {
    display: inline-flex;
    flex-direction: column;
    gap: 1px;
    background: var(--blue-soft);
    color: var(--blue-dark);
    border-radius: 12px;
    padding: 6px 10px;
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1.2;
}

.chat-participant-chip small {
    font-size: 0.7rem;
    font-weight: 600;
    opacity: 0.8;
}

.chat-participant-chip.admin {
    background: #fff4e8;
    color: #9a5b00;
}

.chat-bubble.admin-msg.theirs {
    border-color: #f4a261;
    background: #fff8f0;
}

/* تنبيه طلب جديد */
.help-alert-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    z-index: 4000;
    background: #d62828;
    color: #fff;
    padding: 12px 16px;
    border-radius: 14px;
    font-weight: 800;
    box-shadow: 0 10px 30px rgba(214, 40, 40, 0.35);
    max-width: min(420px, calc(100% - 24px));
    text-align: center;
    opacity: 0;
    transition: all .25s ease;
    pointer-events: none;
}

.help-alert-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.help-alert-toast i {
    margin-left: 6px;
}

/* إخفاء عناصر الويب القديمة إن وُجدت */
.navbar,
.site-footer,
.emergency-banner { display: none !important; }

/* صفوف الموبايل في الجداول */
@media (max-width: 430px) {
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td {
        display: block;
        width: 100%;
    }
    .table tr {
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 14px;
        margin-bottom: 12px;
        padding: 8px 12px;
    }
    .table td {
        border: none;
        padding: 8px 0;
        text-align: right !important;
    }
}
