/* ===============================
   SchoolPress – Calendar (Clean)
   Premium header + compact chips + footer banner (cross-browser)
   =============================== */

/* Global variables: colors & logo sizes can be provided by plugin JS */
:root{
  --sp-color-national:  #006233;
  --sp-color-religious: #C1272D;
  --sp-color-school:    #2563EB;
  --sp-color-personal:  #9333EA;     /* ← NEW: Personal purple */

  --sp-logo-width: clamp(33px, 24vw, 150px);
  --sp-logo-height: auto;

  --sp-font-family: 'Cairo', system-ui, -apple-system, Segoe UI, Roboto, 'Helvetica Neue', sans-serif;
  --sp-font-size: 16px;
}

/* Base page */
body{
  background:#ffffff;
  color:#0f172a;
  font-family: var(--sp-font-family);
  font-size: var(--sp-font-size);
}
.sp-app{direction:rtl;min-height:90vh}

/* ===============================
   FINAL HEADER – Buttons on RIGHT + aligned with filters
   Put this at the VERY BOTTOM of your CSS file
   =============================== */
.sp-header-container {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    max-width: 1100px;
    margin: 30px auto 20px;
    padding: 0 10px;
    direction: rtl;
}

.sp-header {
    flex: 1 !important;
    min-width: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 !important;
    margin: 0 !important;
}

.sp-personal-action {
    flex-shrink: 0 !important;
    align-self: flex-end !important;
    text-align: right !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Purple Add button */
.sp-fab-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 12px 26px;
    background: linear-gradient(135deg, #9333EA, #7E22C3);
    color: #fff;
    border: none;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(147,51,234,.45);
    transition: all 0.3s ease;
}

.sp-fab-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(147,51,234,.5);
}

.sp-fab-plus {
    width: 30px;
    height: 30px;
    background: #fff;
    color: #6D28D9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 900;
}

/* Login / Register buttons */
.sp-auth-wrap {
    display: flex !important;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end !important;
    align-items: center !important;
}

.sp-auth-btn {
    padding: 10px 22px;
    border-radius: 9999px;
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 6px 16px rgba(0,0,0,.15);
    transition: all 0.3s;
    white-space: nowrap;
}

.sp-auth-btn.blue  { background:#2563EB; }
.sp-auth-btn.green { background:#16A34A; }
.sp-auth-btn:hover { transform: translateY(-1px); }

.sp-auth-hint {
    width: 100%;
    text-align: right !important;
    margin-top: 6px;
    font-size: .8rem;
    color: #6b7280;
}
/* =========================================
   🔥 FINAL HEADER + BUTTON UI (CLEAN)
   ========================================= */

/* RIGHT SECTION */
.sp-personal-action {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* AUTH BUTTONS */
.sp-auth-wrap {
    display: flex;
    gap: 10px;
}

.sp-auth-btn {
    height: 42px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    border-radius: 999px;
}

/* ADD BUTTON */
.sp-fab-btn {
    height: 42px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sp-fab-plus {
    width: 24px;
    height: 24px;
    background: #fff;
    color: #6D28D9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* USER MENU */
.sp-user-menu {
    position: relative;
    padding: 0 16px;
    height: 42px;
    display: flex;
    align-items: center;
    background: #111827;
    color: #fff;
    border-radius: 999px;
    font-weight: 700;
    cursor: pointer;
}

/* DROPDOWN - Fixed */
.sp-user-dropdown {
    position: absolute;
    top: 100%;           /* ← التعديل الرئيسي (بدل 50px) */
    right: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: none;
    min-width: 160px;
    z-index: 1000;       /* للتأكد أنه يظهر فوق كل شيء */
}

/* SHOW DROPDOWN - Hover + Click fallback */
.sp-user-menu:hover .sp-user-dropdown,
.sp-user-menu.active .sp-user-dropdown {
    display: block;
}

.sp-user-dropdown a {
    display: block;
    padding: 10px 14px;
    text-decoration: none;
    color: #111827;
}

.sp-user-dropdown a:hover {
    background: #f3f4f6;
}

/* SHOW DROPDOWN */
.sp-user-menu:hover .sp-user-dropdown {
    display: block;
}

/* ===============================
   FILTER CHIPS (Premium Glass)
   =============================== */
.sp-filters{margin:0;padding:0;display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.sp-chip-group{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.sp-chip{position:relative;cursor:pointer}
.sp-chip input{position:absolute;opacity:0;pointer-events:none}

.sp-chip-ui{
  display:flex;align-items:center;gap:10px;
  padding:8px 14px;border-radius:999px;
  font-weight:800;font-size:.92rem;color:#1f2937;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.88));
  border:1px solid #e5e7eb;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 6px 18px rgba(0,0,0,.08);
  transition:all .25s ease;
}
.sp-chip-ui::before{content:"";width:10px;height:10px;border-radius:50%;background:#9ca3af;transition:.25s}

@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))){
  .sp-chip-ui{
    background: rgba(255,255,255,.78);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.sp-chip:hover .sp-chip-ui{transform:translateY(-1px)}

/* ==================== COLOR RULES FOR CHIPS ==================== */
/* SELECTED (checked) */
.sp-chip.national  input:checked + .sp-chip-ui,
.sp-chip.religious input:checked + .sp-chip-ui,
.sp-chip.school    input:checked + .sp-chip-ui,
.sp-chip.personal  input:checked + .sp-chip-ui{     /* ← NEW */
  color:#fff; 
  background:linear-gradient(135deg, var(--sp-color-national), var(--sp-color-national));
  box-shadow:0 8px 24px rgba(0,0,0,.20);
}
.sp-chip.religious input:checked + .sp-chip-ui{ background:linear-gradient(135deg,var(--sp-color-religious),var(--sp-color-religious)); }
.sp-chip.school    input:checked + .sp-chip-ui{ background:linear-gradient(135deg,var(--sp-color-school),var(--sp-color-school)); }
.sp-chip.personal  input:checked + .sp-chip-ui{ background:linear-gradient(135deg,var(--sp-color-personal),var(--sp-color-personal)); } /* ← NEW */

/* Dot becomes white when selected */
.sp-chip.national  input:checked + .sp-chip-ui::before,
.sp-chip.religious input:checked + .sp-chip-ui::before,
.sp-chip.school    input:checked + .sp-chip-ui::before,
.sp-chip.personal  input:checked + .sp-chip-ui::before{ background:#fff; }

/* UNSELECTED — colored border + dot */
.sp-chip.national  input:not(:checked) + .sp-chip-ui{ border-color: var(--sp-color-national); color: var(--sp-color-national); }
.sp-chip.religious input:not(:checked) + .sp-chip-ui{ border-color: var(--sp-color-religious); color: var(--sp-color-religious); }
.sp-chip.school    input:not(:checked) + .sp-chip-ui{ border-color: var(--sp-color-school); color: var(--sp-color-school); }
.sp-chip.personal  input:not(:checked) + .sp-chip-ui{ border-color: var(--sp-color-personal); color: var(--sp-color-personal); } /* ← NEW */

.sp-chip.national  input:not(:checked) + .sp-chip-ui::before{ background: var(--sp-color-national); }
.sp-chip.religious input:not(:checked) + .sp-chip-ui::before{ background: var(--sp-color-religious); }
.sp-chip.school    input:not(:checked) + .sp-chip-ui::before{ background: var(--sp-color-school); }
.sp-chip.personal  input:not(:checked) + .sp-chip-ui::before{ background: var(--sp-color-personal); } /* ← NEW */

/* "All" button */
.sp-all-btn{
  background:#111827;color:#fff;border:none;
  padding:8px 14px;border-radius:999px;
  font-weight:800;font-size:.92rem;cursor:pointer;
  transition:background .25s, transform .2s;
  box-shadow:0 8px 24px rgba(17,24,39,.18);
}
.sp-all-btn:hover{background:#1e293b;transform:translateY(-1px)}

/* Accessibility focus */
.sp-chip-ui:focus-visible{
  outline:3px solid #9333EA;
  outline-offset:3px;
}

/* ===============================
   CALENDAR WRAP + FULLCALENDAR
   =============================== */
.sp-calendar-wrap{width:100%;max-width:1100px;margin:20px auto 8px; padding:0 10px}

/* (your FullCalendar styles unchanged — they are perfect) */
.fc .fc-toolbar.fc-header-toolbar{padding:8px}
.fc .fc-toolbar-title{font-weight:800;color:#111827}
.fc-theme-standard .fc-scrollgrid{border:0; height: auto;}
.fc .fc-col-header-cell{background:#f9fafb;border-bottom:1px solid #e5e7eb}
.fc .fc-daygrid-day{background:#fff}
.fc .fc-daygrid-day-frame{padding:2px}
.fc-theme-standard td, .fc-theme-standard th{border:1px solid #e5e7eb}
.fc .fc-button{
  background:#fff;border:1px solid #e5e7eb;color:#111827;
  border-radius:6px;box-shadow:0 1px 2px rgba(0,0,0,.03)
}
.fc .fc-button:hover{background:#f3f4f6}
.fc .fc-button-primary{background:#fff}
.fc .fc-button-active{background:#e5e7eb}
.fc .fc-daygrid-day.fc-day-sat .fc-daygrid-day-frame,
.fc .fc-daygrid-day.fc-day-sun .fc-daygrid-day-frame { background-color:#f3f4f6; }
.fc-event{border:0;border-radius:6px;padding:2px 6px;font-weight:600;display:flex;align-items:center;gap:6px}
.fc-event .sp-ico{width:14px;height:14px;display:inline-flex;align-items:center;justify-content:center}
.fc-event .fc-event-title{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}


/* ===============================
   MODERN EVENT BARS (AR)
   =============================== */

.sp-event-bar {
  background: color-mix(in srgb, var(--sp-ev-color) 20%, white);
  color: #111827;

  border-inline-start: 4px solid var(--sp-ev-color);
  border-radius: 8px;

  padding: 4px 6px;
  font-size: .78rem;
  font-weight: 700;

  display: block;
  line-height: 1.2;
}

.fc .fc-daygrid-event {
  margin: 2px 0;
}

/* Multi-day events cleaner */
.fc-daygrid-event-harness {
  pointer-events: auto;
}

/* ===============================
   MODAL
   =============================== */
.sp-modal{position:fixed;inset:0;background:rgba(17,24,39,.35);display:none;align-items:center;justify-content:center;z-index:9999}
.sp-modal.active{display:flex}
.sp-modal-card{background:#fff;border:1px solid #e5e7eb;border-radius:10px;max-width:560px;width:92vw;color:#0f172a;box-shadow:0 20px 50px rgba(0,0,0,.15)}
.sp-modal-header{padding:12px 16px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center}
.sp-modal-body{padding:12px 16px}
.sp-close{background:#111827;border:0;color:#fff;border-radius:8px;padding:.4rem .6rem;font-weight:700;cursor:pointer}
.sp-event-item{display:flex;align-items:center;gap:.55rem;padding:.4rem .55rem;background:#f9fafb;border:1px solid #e5e7eb;border-radius:8px;margin:.35rem 0}
.sp-color-swatch{width:12px;height:12px;border-radius:50%;border:1px solid #d1d5db}

/* ===============================
   FOOTER
   =============================== */
.sp-footer{
  max-width:1100px;margin:12px auto 24px;
  padding:0 10px; display:flex; flex-direction:column; gap:10px;
}
.sp-banner-ui{
  display:flex; align-items:center; gap:12px;
  padding:12px 18px; border-radius:14px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(255,255,255,.88));
  border:1px solid #e5e7eb;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 10px 28px rgba(0,0,0,.10);
  font-weight:800; color:#1f2937;
  justify-content:center;
}
@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))){
  .sp-banner-ui{
    background: rgba(255,255,255,.78);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}
.sp-month-banner{display:flex; align-items:center; justify-content:center;}
.sp-banner-dot{width:10px;height:10px;border-radius:50%;background:var(--sp-color-national);}
.sp-banner-text{font-size:.95rem}
.sp-banner-count{
  min-width:34px; height:26px; line-height:26px; text-align:center;
  border-radius:999px; background:#111827; color:#fff;
  padding:0 10px; box-shadow:0 8px 20px rgba(17,24,39,.18);
  font-size:.95rem; margin-inline-start:8px;
}

/* Footer labels — now with personal */
.sp-label.national {background:linear-gradient(135deg,var(--sp-color-national),var(--sp-color-national)) !important}
.sp-label.religious{background:linear-gradient(135deg,var(--sp-color-religious),var(--sp-color-religious)) !important}
.sp-label.school   {background:linear-gradient(135deg,var(--sp-color-school),var(--sp-color-school)) !important}
.sp-label.personal {background:linear-gradient(135deg,var(--sp-color-personal),var(--sp-color-personal)) !important} /* ← NEW */

/* WP block margin neutralizer */
.wp-block-shortcode, .wp-block-paragraph{
  margin-top: 0; margin-bottom: 8px;
}

/* MOBILE */
@media (max-width:640px){
  .sp-header{padding:14px 10px !important; gap:10px}
  .sp-head-content{gap:10px}
  .sp-chip-ui{
    padding:6px 10px;font-size:.85rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 5px 16px rgba(0,0,0,.08);
  }
  .sp-all-btn{padding:6px 10px;font-size:.85rem;box-shadow:0 6px 18px rgba(17,24,39,.16)}
  .sp-banner-ui{padding:10px 14px;border-radius:12px}
  .sp-banner-text{font-size:.9rem}
  .sp-banner-count{min-width:30px;height:24px;line-height:24px;font-size:.9rem}
}

/* =========================================
   🔧 BUTTON ALIGNMENT FIX (PIXEL PERFECT)
   ========================================= */

/* Align right section perfectly */
.sp-personal-action {
    display: flex !important;
    align-items: center !important;
    gap: 12px;
}

/* Force all buttons same vertical baseline */
.sp-personal-action > * {
    display: flex;
    align-items: center;
}

/* Fix purple button height */
.sp-fab-btn {
    height: 42px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    border-radius: 999px;
}

/* Fix plus icon alignment */
.sp-fab-plus {
    width: 26px;
    height: 26px;
    font-size: 1.2rem;
}

/* Fix login/register buttons */
.sp-auth-btn {
    height: 40px;
    display: flex;
    align-items: center;
}

/* Ensure auth wrapper aligns */
.sp-auth-wrap {
    align-items: center !important;
}
