/* =====================================================================
   components.css
   المكوّنات القابلة لإعادة الاستخدام: الكروت، النماذج، الأزرار، الجداول،
   البادجات، شريط الفلترة، المودال، التوست، الرسوم البيانية، شريط الترحيب
   منصة زِمام الرقمية
   ===================================================================== */

/* ============ NEWS CARDS ============ */
.news-cards-section { margin-bottom: 24px; }
.news-section-title {
            font-size: 1.1rem;
            font-weight: 900;
            color: var(--nile-dark);
            margin-bottom: 14px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
.news-cards-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 14px;
        }
.news-card {
            background: var(--bg-card);
            border-radius: var(--radius-lg);
            padding: 18px 16px;
            box-shadow: var(--shadow-card);
            border: 1px solid var(--border-light);
            position: relative;
            transition: var(--transition);
            display: flex;
            flex-direction: column;
            gap: 10px;
            min-height: 140px;
        }
.news-card:hover { box-shadow: 0 8px 20px rgba(15,76,70,0.08); transform: translateY(-2px); }
.news-card.accent-urgent { border-right: 4px solid var(--danger); background: #fffbfb; }
.news-card.accent-awareness { border-right: 4px solid var(--success); background: #fafff9; }
.news-card.accent-general { border-right: 4px solid var(--info); background: #fafcff; }
.news-card.accent-progress { border-right: 4px solid var(--warning); background: #fffdf5; }
.news-card-badge {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.7rem;
            font-weight: 800;
            white-space: nowrap;
            align-self: flex-start;
        }
.news-card-badge.red { background: #7a1c1c; color: #fff; }
.news-card-badge.green { background: var(--success-light); color: var(--success); }
.news-card-badge.blue { background: var(--info-light); color: var(--info); }
.news-card-badge.yellow { background: var(--warning-light); color: var(--warning); }
.news-card h4 {
            font-size: 0.95rem;
            font-weight: 800;
            color: var(--nile-dark);
            line-height: 1.3;
            margin: 0;
        }
.news-card p {
            font-size: 0.8rem;
            color: var(--text-muted);
            line-height: 1.5;
            flex: 1;
            margin: 0;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
.news-card-date { font-size: 0.7rem; color: #999; font-weight: 600; text-align: left; direction: ltr; }
.news-card-empty {
            background: #faf9f5;
            border: 2px dashed var(--border);
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-muted);
            font-weight: 700;
            font-size: 0.85rem;
            min-height: 140px;
            border-radius: var(--radius-lg);
            text-align: center;
            padding: 20px;
        }
/* ============ CARDS & FORMS ============ */
.card-box {
            background: var(--bg-card);
            border-radius: var(--radius-lg);
            padding: 18px 14px;
            box-shadow: var(--shadow-card);
            border: 1px solid var(--border-light);
            margin-bottom: 20px;
        }
.form-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 12px;
            margin-bottom: 12px;
        }
.form-group {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-bottom: 14px;
        }
.form-label { font-size: 0.8rem; font-weight: 700; color: var(--nile-dark); }
.form-hint { font-size: 0.68rem; color: var(--text-muted); margin-top: -2px; }
.form-input, select.form-input {
            padding: 12px 14px;
            border: 2px solid var(--border-light);
            border-radius: var(--radius-sm);
            font-size: 0.85rem;
            font-weight: 600;
            transition: var(--transition);
            min-height: 48px;
            background: #fff;
            width: 100%;
            -webkit-appearance: none;
            appearance: none;
        }
select.form-input {
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%235c665a'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: left 14px center;
            padding-left: 36px;
        }
.form-input:focus { outline: none; border-color: var(--nile-light); box-shadow: 0 0 0 4px rgba(27,110,100,0.08); }
.form-input:disabled { background: #f4f4f0; color: var(--text-muted); cursor: not-allowed; }
textarea.form-input { min-height: 90px; }
.input-wrap-icon { position: relative; }
.input-wrap-icon .form-input { padding-left: 42px; }
.pass-toggle-btn {
            position: absolute;
            left: 6px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            font-size: 1.05rem;
            cursor: pointer;
            padding: 8px;
            line-height: 1;
            color: var(--text-muted);
        }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin-bottom: 16px; }
.check-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--nile-dark); flex-shrink: 0; }
.btn-gps {
            background: var(--info);
            color: white;
            border: none;
            padding: 12px 16px;
            border-radius: var(--radius-sm);
            font-weight: 700;
            cursor: pointer;
            white-space: nowrap;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: var(--transition);
            min-height: 48px;
            flex-shrink: 0;
        }
.btn-gps:hover { background: #154a61; }
.btn-gps.success { background: var(--success); }
.btn-gps:active { transform: scale(0.96); }
.btn-submit {
            background: var(--clay);
            color: white;
            border: none;
            padding: 14px 24px;
            border-radius: var(--radius-md);
            font-size: 0.9rem;
            font-weight: 800;
            cursor: pointer;
            box-shadow: 0 4px 14px rgba(185,105,46,0.2);
            transition: var(--transition);
            min-height: 52px;
            width: 100%;
        }
.btn-submit:hover { background: #a0541f; }
.btn-submit:active { transform: scale(0.985); }
.btn-submit:disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; box-shadow: none; }
.btn-submit.full { width: 100%; }
/* ============ VIEWER MODE ============ */
.viewer-only { display: none; }
.viewer-mode .viewer-only { display: flex; }
.viewer-mode .write-only { display: none !important; }
.viewer-banner {
            background: linear-gradient(135deg, #eaf4fa, #edf7f2);
            border: 1px solid var(--info);
            color: var(--info);
            border-radius: var(--radius-md);
            padding: 12px 16px;
            font-weight: 700;
            font-size: 0.8rem;
            margin-bottom: 16px;
            align-items: center;
            gap: 8px;
        }
/* ============ STATS GRID ============ */
.stats-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 10px;
            margin-bottom: 18px;
        }
.mini-stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
            gap: 10px;
            margin-bottom: 18px;
        }
.stat-card {
            background: var(--bg-card);
            padding: 14px 10px;
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-card);
            border: 1px solid var(--border-light);
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 6px;
        }
.stat-info h4 { font-size: 0.7rem; color: var(--text-muted); }
.stat-info .val { font-size: 1.4rem; font-weight: 900; }
/* ============ COLLAPSIBLE CARDS ============ */
.collapse-card { padding: 0; overflow: hidden; }
.collapse-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            cursor: pointer;
            padding: 18px 14px;
            user-select: none;
        }
.collapse-header h3 { margin: 0; font-size: 0.95rem; }
.collapse-header .collapse-sub { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; margin-top: 2px; }
.collapse-toggle-icon {
            width: 34px; height: 34px;
            border-radius: 50%;
            background: var(--nile-surface);
            color: var(--nile-dark);
            display: flex; align-items: center; justify-content: center;
            font-size: 1.2rem; font-weight: 900;
            flex-shrink: 0;
            transition: transform 0.25s ease, background 0.25s ease;
        }
.collapse-card.open .collapse-toggle-icon { transform: rotate(45deg); background: var(--clay-light); color: var(--clay); }
.collapse-body {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.35s ease;
        }
.collapse-inner { padding: 0 14px 20px; }
.collapse-divider {
            border-top: 1px dashed var(--border);
            margin: 18px 0 16px;
            padding-top: 16px;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.8rem;
            font-weight: 800;
            color: var(--clay);
        }
/* ============ TABLES ============ */
.table-responsive {
            overflow-x: auto;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-light);
            background: white;
            -webkit-overflow-scrolling: touch;
            max-width: 100%;
            margin-top: 10px;
        }
table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.7rem;
            min-width: 650px;
        }
th {
            background: #f6f4ee;
            padding: 10px 8px;
            font-weight: 700;
            color: var(--nile-dark);
            border-bottom: 2px solid var(--border);
            white-space: nowrap;
            font-size: 0.65rem;
        }
td {
            padding: 8px 6px;
            border-bottom: 1px solid var(--border-light);
            vertical-align: middle;
        }
tr.critical-alert { background: var(--danger-light) !important; }
tr:last-child td { border-bottom: none; }
/* Responsive card view for tables on small screens */
.badge {
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 0.65rem;
            font-weight: 700;
            white-space: nowrap;
        }
.badge.green { background: var(--success-light); color: var(--success); }
.badge.yellow { background: var(--warning-light); color: var(--warning); }
.badge.red { background: #7a1c1c; color: #fff; }
.badge.blue { background: var(--info-light); color: var(--info); }
.gps-link { color: var(--info); font-weight: 700; text-decoration: none; font-size: 0.7rem; }
/* ============ FILTER BAR ============ */
.filter-bar {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
            margin-bottom: 14px;
            padding: 12px;
            background: #faf9f5;
            border-radius: var(--radius-md);
            border: 1px solid var(--border-light);
        }
.filter-bar input, .filter-bar select {
            padding: 10px 12px;
            border: 2px solid var(--border-light);
            border-radius: 24px;
            font-size: 0.75rem;
            font-weight: 600;
            min-width: 120px;
            min-height: 42px;
            background: #fff;
            flex: 1 1 auto;
        }
.btn-icon {
            background: white;
            border: 1px solid var(--border);
            border-radius: 24px;
            padding: 8px 14px;
            font-weight: 700;
            cursor: pointer;
            font-size: 0.7rem;
            min-height: 42px;
            white-space: nowrap;
        }
.btn-icon:active { transform: scale(0.95); }
/* ============ EXCEL DROP ============ */
.excel-drop-zone {
            background: #f4efe3;
            border: 2px dashed var(--clay);
            padding: 20px;
            text-align: center;
            border-radius: var(--radius-lg);
            cursor: pointer;
            font-size: 0.85rem;
            margin-top: 10px;
            display: block;
        }
.excel-drop-zone input[type="file"] { display: none; }
.excel-drop-zone:active { background: #efe7d6; }
/* ============ CHARTS ============ */
.charts-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 14px;
            margin-top: 12px;
        }
.chart-card {
            background: white;
            border-radius: var(--radius-lg);
            padding: 14px;
            box-shadow: var(--shadow-card);
            border: 1px solid var(--border-light);
        }
.chart-card h4 { font-size: 0.85rem; margin-bottom: 10px; }
canvas { max-height: 220px; width: 100% !important; }
/* ============ GPS BADGE ============ */
.gps-badge {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            background: #e8f0fe;
            color: #1a56db;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 0.65rem;
            font-weight: 700;
        }
/* ============ TOAST ============ */
.toast {
            position: fixed;
            bottom: 24px;
            left: 50%;
            transform: translateX(-50%) translateY(120px);
            background: var(--nile-dark);
            color: white;
            padding: 14px 24px;
            border-radius: 30px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.2);
            font-weight: 700;
            opacity: 0;
            transition: 0.3s;
            z-index: 1000;
            font-size: 0.85rem;
            white-space: nowrap;
            max-width: 90vw;
            text-align: center;
        }
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
/* ============ MODAL ============ */
.modal-overlay {
            position: fixed; inset: 0;
            background: rgba(15,34,30,0.55);
            display: flex; align-items: center; justify-content: center;
            opacity: 0; pointer-events: none;
            transition: opacity 0.2s ease;
            z-index: 2000;
            padding: 16px;
        }
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-box {
            background: white;
            border-radius: var(--radius-lg);
            padding: 22px 20px;
            max-width: 380px;
            width: 100%;
            box-shadow: var(--shadow-pop);
            transform: translateY(14px) scale(0.96);
            transition: transform 0.22s ease;
        }
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }
.modal-box h3 { font-size: 1.05rem; margin-bottom: 10px; }
.modal-box p { font-size: 0.85rem; color: var(--text-main); line-height: 1.6; white-space: pre-line; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn-submit { margin: 0; }
.modal-btn-secondary { background: #fff !important; color: var(--text-main) !important; border: 2px solid var(--border) !important; box-shadow: none !important; }
.modal-btn-danger { background: var(--danger) !important; box-shadow: none !important; }
/* ============ GREETING ============ */
.greeting-card {
            background: linear-gradient(135deg, #e8f0ee, #fdf2e9);
            border: 1px solid var(--gold);
            border-radius: var(--radius-lg);
            padding: 14px 18px;
            margin-bottom: 18px;
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 800;
            font-size: 1rem;
            color: var(--nile-dark);
            box-shadow: var(--shadow-card);
        }
.role-pill {
            font-size: 0.65rem;
            font-weight: 800;
            padding: 4px 10px;
            border-radius: 20px;
            margin-right: auto;
        }
.role-pill.admin { background: var(--success-light); color: var(--success); }
.role-pill.viewer { background: var(--info-light); color: var(--info); }
/* ============ SETTINGS / TEAM ============ */
.team-intro { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 16px; line-height: 1.8; }
.role-badge-select { padding: 6px; border-radius: 6px; font-weight: 700; min-height: 36px; border: 1px solid var(--border); }
