/* OFA Calendar — ofa-calendar.css v3 */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;900&display=swap');

.ofa-calendar-wrap, .ofa-calendar-wrap * { box-sizing:border-box; }
.ofa-calendar-wrap { font-family:'Cairo',sans-serif; direction:rtl; color:#0d1b2a; width:100%; }

/* ─── Loading Bar ─── */
.ofa-loading-bar { position:fixed;top:0;right:0;left:0;height:3px;z-index:9999;display:none;
  background:linear-gradient(90deg,#D9232D,#c9a84c,#D9232D);
  background-size:200% 100%; animation:ofaSlide 1.2s linear infinite; }
.ofa-loading-bar.ofa-active { display:block; }
@keyframes ofaSlide { to { background-position:-200% 0; } }

/* ─── Header — بدون زوايا مستديرة ─── */
.ofa-header {
  background:#0d1b2a;
  border-radius:0;
}
.ofa-header-top {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 24px;
  border-bottom:1px solid rgba(255,255,255,.08);
  gap:12px;
}
.ofa-logo-group { display:flex; align-items:center; gap:12px; min-width:0; }
.ofa-logo-img {
  width:52px; height:52px; border-radius:50%;
  object-fit:contain; flex-shrink:0;
  background:#fff; padding:3px;
  border:2px solid #c9a84c;
}
.ofa-header-titles { min-width:0; }
.ofa-header-titles h2 {
  font-size:1.05rem; font-weight:900; color:#fff; line-height:1.2;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.ofa-header-titles span { font-size:.72rem; color:#c9a84c; display:block; margin-top:2px; white-space:nowrap; }

.ofa-header-actions { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.ofa-sync-badge { display:flex; align-items:center; gap:6px; }
.ofa-sync-dot { width:7px; height:7px; border-radius:50%; background:#4ade80; flex-shrink:0; }
.ofa-sync-dot.ofa-err  { background:#f87171; }
.ofa-sync-dot.ofa-spin { background:#c9a84c; animation:ofaBlink .8s ease-in-out infinite; }
@keyframes ofaBlink { 0%,100%{opacity:1} 50%{opacity:.3} }
#ofa-sync-label { font-size:.7rem; color:rgba(255,255,255,.45); white-space:nowrap; }

/* ─── Buttons ─── */
.ofa-btn {
  display:inline-flex; align-items:center; gap:5px;
  padding:8px 16px; border-radius:7px;
  font-family:'Cairo',sans-serif; font-size:.83rem; font-weight:600;
  cursor:pointer; border:none; transition:all .18s; white-space:nowrap;
}
.ofa-btn-ghost { background:rgba(255,255,255,.07); color:rgba(255,255,255,.85); border:1px solid rgba(255,255,255,.15); }
.ofa-btn-ghost:hover { background:rgba(255,255,255,.15); }
.ofa-btn-ghost:disabled { opacity:.4; cursor:not-allowed; }
.ofa-btn-outline { background:#fff; color:#0d1b2a; border:1.5px solid #dee2e6; }
.ofa-btn-outline:hover { border-color:#D9232D; color:#D9232D; }

/* ─── View Bar ─── */
.ofa-view-bar {
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 24px; gap:12px;
}
.ofa-view-tabs { display:flex; gap:3px; background:rgba(255,255,255,.07); border-radius:8px; padding:3px; }
.ofa-view-tab {
  padding:7px 20px; border-radius:6px;
  font-family:'Cairo',sans-serif; font-size:.83rem; font-weight:600;
  color:rgba(255,255,255,.5); cursor:pointer; border:none; background:transparent; transition:all .18s;
}
.ofa-view-tab.active { background:#D9232D; color:#fff; }
.ofa-year-nav-wrap { display:flex; align-items:center; gap:10px; }
.ofa-year-nav-wrap strong { color:#c9a84c; font-size:.98rem; font-weight:700; min-width:36px; text-align:center; }
.ofa-year-nav {
  background:rgba(255,255,255,.09); border:none; color:rgba(255,255,255,.7);
  width:28px; height:28px; border-radius:50%; cursor:pointer;
  font-size:16px; display:flex; align-items:center; justify-content:center; transition:background .15s;
}
.ofa-year-nav:hover { background:rgba(255,255,255,.2); }

/* ─── Stats ─── */
.ofa-stats-bar { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin:16px 0 0; }
.ofa-stat-card {
  background:#fff; border-radius:9px;
  padding:16px 18px; border-right:4px solid #D9232D;
  box-shadow:0 2px 12px rgba(13,27,42,.07);
}
.ofa-stat-card.ofa-sc-green  { border-color:#16a34a; }
.ofa-stat-card.ofa-sc-purple { border-color:#7c3aed; }
.ofa-stat-card.ofa-sc-teal   { border-color:#0891b2; }
.ofa-stat-num { font-size:1.8rem; font-weight:900; color:#0d1b2a; line-height:1; }
.ofa-stat-lbl { font-size:.73rem; color:#444; margin-top:5px; font-weight:500; }

/* ─── Search ─── */
.ofa-search-bar { display:flex; gap:10px; margin:16px 0 0; align-items:stretch; }
.ofa-search-input {
  flex:3; font-family:'Cairo',sans-serif; direction:rtl;
  padding:14px 20px; border:1.5px solid #dee2e6; border-radius:9px;
  font-size:.96rem; color:#0d1b2a; outline:none; transition:border .18s; background:#fff;
  min-width:0; height:52px;
}
.ofa-search-input:focus { border-color:#D9232D; box-shadow:0 0 0 3px rgba(217,35,45,.08); }
.ofa-filter-select {
  flex:1; font-family:'Cairo',sans-serif; direction:rtl;
  padding:14px 12px; border:1.5px solid #dee2e6; border-radius:9px;
  font-size:.88rem; color:#0d1b2a; outline:none; background:#fff; cursor:pointer;
  min-width:130px; max-width:180px; height:52px;
}
.ofa-filter-select:focus { border-color:#D9232D; }

/* ─── View Panels ─── */
.ofa-view-panel { display:none; margin-top:16px; }
.ofa-view-panel.ofa-active { display:block; }

/* ─── Year Grid ─── */
.ofa-year-grid-wrap { background:#fff; border-radius:9px; box-shadow:0 2px 14px rgba(13,27,42,.08); overflow:hidden; }
.ofa-legend-bar { display:flex; flex-wrap:wrap; gap:8px 18px; padding:12px 18px; background:#f8f9fa; border-bottom:1px solid #e9ecef; }
.ofa-legend-item { display:flex; align-items:center; gap:6px; font-size:.76rem; font-weight:600; color:#343a40; }
.ofa-ldot { width:11px; height:11px; border-radius:3px; flex-shrink:0; display:inline-block; }
.ofa-year-table-scroll { overflow-x:auto; -webkit-overflow-scrolling:touch; }
.ofa-year-table-scroll::-webkit-scrollbar { height:6px; }
.ofa-year-table-scroll::-webkit-scrollbar-track { background:#f0f0f0; border-radius:3px; }
.ofa-year-table-scroll::-webkit-scrollbar-thumb { background:#c0c0c0; border-radius:3px; }
.ofa-year-table-scroll::-webkit-scrollbar-thumb:hover { background:#D9232D; }
.ofa-year-table { width:100%; border-collapse:collapse; min-width:940px; font-size:.74rem; }
.ofa-year-table th, .ofa-year-table td { border:1px solid #eee; text-align:center; padding:0; }
.ofa-mlabel { background:#0d1b2a; color:#ffffff; font-weight:800; font-size:.82rem; padding:7px 8px; width:52px; min-width:52px; vertical-align:middle; letter-spacing:.3px; }
.ofa-dh { background:#1a2e45; color:rgba(255,255,255,.85); font-size:.65rem; font-weight:700; padding:4px 1px; width:26px; min-width:26px; }
.ofa-dc { position:relative; height:32px; min-width:26px; width:26px; vertical-align:middle; }
.ofa-dc.ofa-empty { background:#f5f5f5; }
.ofa-dn { font-size:.6rem; color:#aaa; position:absolute; top:1px; left:50%; transform:translateX(-50%); pointer-events:none; font-weight:500; }
.ofa-has-ev .ofa-dn { color:rgba(255,255,255,.9); font-weight:700; }

/* ─── Monthly ─── */
.ofa-monthly-nav { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; gap:10px; }
.ofa-monthly-nav h3 { font-size:1.35rem; font-weight:900; color:#0d1b2a; text-align:center; }
.ofa-monthly-grid { background:#fff; border-radius:9px; box-shadow:0 2px 14px rgba(13,27,42,.08); overflow:hidden; }
.ofa-week-headers { display:grid; grid-template-columns:repeat(7,1fr); background:#0d1b2a; }
.ofa-week-header { padding:10px 2px; text-align:center; color:rgba(255,255,255,.65); font-size:.76rem; font-weight:700; }
.ofa-days-grid { display:grid; grid-template-columns:repeat(7,1fr); }
.ofa-cd { min-height:90px; border:1px solid #eee; padding:5px; background:#fff; }
.ofa-cd.ofa-om { background:#f9f9f9; }
.ofa-cd.ofa-today { background:#fff5f5; }
.ofa-cdn { font-size:.78rem; font-weight:700; color:#0d1b2a; width:24px; height:24px; display:flex; align-items:center; justify-content:center; margin-bottom:3px; border-radius:50%; }
.ofa-today .ofa-cdn { background:#D9232D; color:#fff; }
.ofa-om .ofa-cdn { color:#ccc; }
.ofa-cpill { display:block; padding:2px 5px; border-radius:3px; font-size:.64rem; font-weight:600; color:#fff; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:default; }

/* ─── Tooltip ─── */
.ofa-tooltip {
  position:fixed; background:#0d1b2a; color:#fff;
  padding:8px 13px; border-radius:7px; font-family:'Cairo',sans-serif;
  font-size:.78rem; font-weight:600; pointer-events:none; z-index:9999;
  display:none; box-shadow:0 4px 18px rgba(0,0,0,.3); max-width:240px; line-height:1.5;
}

/* ─── Toast ─── */
.ofa-toast {
  position:fixed; bottom:26px; left:50%; transform:translateX(-50%);
  padding:10px 22px; border-radius:8px; font-family:'Cairo',sans-serif;
  font-size:.84rem; font-weight:600; color:#fff; z-index:9999;
  box-shadow:0 4px 18px rgba(0,0,0,.25); white-space:nowrap;
  animation:ofaToast .3s ease;
}
@keyframes ofaToast { from{opacity:0;transform:translateX(-50%) translateY(10px)} to{opacity:1;transform:translateX(-50%) translateY(0)} }

/* ════════════════════════════════
   RESPONSIVE — الجوال أولاً
════════════════════════════════ */

/* ─── Tablet ≤ 900px ─── */
@media (max-width:900px) {
  .ofa-stats-bar { grid-template-columns:1fr 1fr; gap:10px; }
  .ofa-header-top { padding:14px 18px; }
  .ofa-view-bar { padding:8px 18px; }
  #ofa-sync-label { display:none; }
}

/* ─── Mobile ≤ 600px ─── */
@media (max-width:600px) {
  /* Header */
  .ofa-header-top {
    flex-direction:column; align-items:flex-start;
    padding:14px 14px 10px;
  }
  .ofa-logo-img { width:44px; height:44px; }
  .ofa-header-titles h2 { font-size:.95rem; }
  .ofa-header-actions { width:100%; justify-content:space-between; }
  .ofa-sync-badge { order:-1; }

  /* View bar */
  .ofa-view-bar { flex-direction:column; align-items:stretch; padding:8px 14px; gap:8px; }
  .ofa-view-tabs { justify-content:center; }
  .ofa-view-tab { padding:7px 14px; font-size:.8rem; }
  .ofa-year-nav-wrap { justify-content:center; }

  /* Stats */
  .ofa-stats-bar { grid-template-columns:1fr 1fr; gap:8px; margin:12px 0 0; }
  .ofa-stat-card { padding:12px 14px; }
  .ofa-stat-num { font-size:1.5rem; }
  .ofa-stat-lbl { font-size:.68rem; }

  /* Search */
  .ofa-search-bar { flex-direction:column; gap:8px; margin:12px 0 0; }
  .ofa-search-input { height:48px; padding:12px 14px; font-size:.9rem; flex:1; max-width:100%; }
  .ofa-filter-select { height:48px; width:100%; max-width:100%; padding:12px 14px; font-size:.86rem; }

  /* Legend */
  .ofa-legend-bar { gap:6px 14px; padding:10px 14px; }
  .ofa-legend-item { font-size:.72rem; }

  /* Monthly */
  .ofa-cd { min-height:64px; padding:3px; }
  .ofa-cdn { font-size:.7rem; width:20px; height:20px; }
  .ofa-cpill { font-size:.58rem; padding:1px 4px; }
  .ofa-week-header { font-size:.68rem; padding:8px 2px; }
  .ofa-monthly-nav h3 { font-size:1.1rem; }
  .ofa-btn-outline { padding:7px 12px; font-size:.78rem; }
}

/* ─── Small Mobile ≤ 380px ─── */
@media (max-width:380px) {
  .ofa-stats-bar { grid-template-columns:1fr 1fr; }
  .ofa-stat-num { font-size:1.3rem; }
  .ofa-header-titles h2 { font-size:.88rem; }
  .ofa-view-tab { padding:6px 10px; font-size:.76rem; }
}

/* ════════════════════════════════
   WELCOME MODAL
════════════════════════════════ */
.ofa-welcome-overlay {
  position:fixed; inset:0; z-index:10000;
  background:rgba(13,27,42,.75);
  backdrop-filter:blur(5px);
  display:flex; align-items:center; justify-content:center;
  padding:16px;
  animation:ofaFadeIn .3s ease;
}
.ofa-welcome-overlay.ofa-hidden { display:none; }
@keyframes ofaFadeIn { from{opacity:0} to{opacity:1} }

.ofa-welcome-modal {
  background:#fff; border-radius:16px;
  width:100%; max-width:440px;
  overflow:hidden;
  box-shadow:0 24px 64px rgba(13,27,42,.35);
  animation:ofaSlideUp .35s cubic-bezier(.34,1.56,.64,1);
  font-family:'Cairo',sans-serif;
  direction:rtl;
}
@keyframes ofaSlideUp {
  from{opacity:0;transform:translateY(30px) scale(.96)}
  to{opacity:1;transform:translateY(0) scale(1)}
}

/* Header */
.ofa-welcome-header {
  background:#0d1b2a;
  display:flex; align-items:center; gap:14px;
  padding:20px 24px;
  border-bottom:3px solid #D9232D;
}
.ofa-welcome-logo {
  width:48px; height:48px; border-radius:50%;
  object-fit:contain; background:#fff; padding:3px;
  border:2px solid #c9a84c; flex-shrink:0;
}
.ofa-welcome-header h3 { font-size:1rem; font-weight:900; color:#fff; margin:0; line-height:1.3; }
.ofa-welcome-header span { font-size:.73rem; color:#c9a84c; display:block; margin-top:2px; }

/* Body */
.ofa-welcome-body { padding:20px 24px; display:flex; flex-direction:column; gap:14px; }

.ofa-tip-card {
  display:flex; align-items:flex-start; gap:14px;
  padding:14px 16px; border-radius:10px;
  background:#f8f9fa; border:1.5px solid #e9ecef;
  transition:border-color .2s;
}
.ofa-tip-card:hover { border-color:#D9232D; background:#fff9f9; }

/* Tip icons — CSS shapes, no emoji */
.ofa-tip-icon {
  width:38px; height:38px; border-radius:10px;
  flex-shrink:0; display:flex; align-items:center; justify-content:center;
  position:relative;
}
.ofa-tip-hover {
  background:#fff0f0;
  border:2px solid #D9232D;
}
.ofa-tip-hover::before {
  content:'';
  width:14px; height:20px;
  background:#0d1b2a;
  clip-path:polygon(0 0,8px 0,100% 70%,90% 100%,50% 80%,40% 100%,30% 70%);
  border-radius:2px;
}
.ofa-tip-view {
  background:#f0f4ff;
  border:2px solid #2563eb;
}
.ofa-tip-view::before {
  content:'';
  width:20px; height:14px;
  border:2.5px solid #2563eb;
  border-radius:3px;
}
.ofa-tip-view::after {
  content:'';
  position:absolute;
  bottom:7px; left:50%; transform:translateX(-50%);
  width:10px; height:2px;
  background:#2563eb; border-radius:2px;
  box-shadow:0 -4px 0 #2563eb;
}
.ofa-tip-sync {
  background:#f0fdf4;
  border:2px solid #16a34a;
}
.ofa-tip-sync::before {
  content:'';
  width:18px; height:18px;
  border:2.5px solid #16a34a;
  border-top-color:transparent;
  border-radius:50%;
}

.ofa-tip-text strong { display:block; font-size:.88rem; font-weight:700; color:#0d1b2a; margin-bottom:3px; }
.ofa-tip-text p { font-size:.78rem; color:#6c757d; margin:0; line-height:1.5; }

/* Footer */
.ofa-welcome-footer {
  display:flex; align-items:center; justify-content:space-between;
  padding:16px 24px 20px; gap:14px;
  border-top:1px solid #e9ecef; background:#fafafa;
}
.ofa-no-show-label {
  display:flex; align-items:center; gap:8px;
  font-size:.78rem; color:#6c757d; cursor:pointer; user-select:none;
}
.ofa-no-show-label input[type=checkbox] {
  width:15px; height:15px; accent-color:#D9232D; cursor:pointer; flex-shrink:0;
}
.ofa-welcome-close-btn {
  background:#D9232D; color:#fff;
  border:none; border-radius:9px;
  padding:10px 24px;
  font-family:'Cairo',sans-serif; font-size:.88rem; font-weight:700;
  cursor:pointer; transition:background .2s, transform .1s;
  white-space:nowrap; flex-shrink:0;
}
.ofa-welcome-close-btn:hover { background:#a8181f; transform:translateY(-1px); }
.ofa-welcome-close-btn:active { transform:translateY(0); }

@media (max-width:480px) {
  .ofa-welcome-modal { border-radius:12px; }
  .ofa-welcome-header { padding:16px 18px; }
  .ofa-welcome-body { padding:16px 18px; gap:10px; }
  .ofa-welcome-footer { flex-direction:column; align-items:stretch; padding:14px 18px 18px; }
  .ofa-welcome-close-btn { text-align:center; }
}
@keyframes ofaFadeOut { from{opacity:1} to{opacity:0} }
