/* ===== PowerMail plugin styles ===== */

/* ---- 左側 task menu 圖示 ---- */
#taskmenu a.button-powermail::before { content: "\1F4CB"; font-size: 18px; display: block; line-height: 1; }
#taskmenu a.button-pmcal::before     { content: "\1F4C5"; font-size: 18px; display: block; line-height: 1; }
#taskmenu a.button-powermail,
#taskmenu a.button-pmcal { text-align: center; }
#taskmenu a.button-powermail .inner,
#taskmenu a.button-pmcal .inner { display: block; }

/* ---- 功能中心頁 ---- */
#layout-content .pm-section-title { margin-top: 22px; padding-top: 12px; border-top: 1px solid #ddd; font-size: 15px; }
#layout-content .pm-cal-empty, #layout-content .pm-cal-meta { color: #888; margin-top: 6px; }

/* ---- 公佈欄跑馬燈 ---- */
#pm-marquee {
  position: fixed; top: 0; left: 0; right: 0; height: 30px; z-index: 100000;
  background: linear-gradient(90deg, #1e3a5f, #2563eb); color: #fff;
  overflow: hidden; white-space: nowrap; display: flex; align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.3); font-size: 14px; font-weight: 600;
}
#pm-marquee .pm-marquee-track {
  display: inline-block; padding-left: 100%; white-space: nowrap;
  animation: pm-marquee-scroll 30s linear infinite;
}
#pm-marquee .pm-marquee-track[aria-hidden] { padding-left: 0; }
@keyframes pm-marquee-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}
#pm-marquee:hover .pm-marquee-track { animation-play-state: paused; }
/* 跑馬燈出現時把 Roundcube 版面整體往下推（不依賴 Elastic 內部定位方式）*/
body.pm-has-marquee #layout { margin-top: 30px; height: calc(100% - 30px); }

/* ---- 行事曆元件 ---- */
#pmcal { padding: 8px; }
#pmcal .pmcal-loading { color: #888; padding: 20px; }
#pmcal .pmcal-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
#pmcal .pmcal-nav, #pmcal .pmcal-views { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
#pmcal .pmcal-title { font-size: 16px; font-weight: 700; margin-left: 8px; }
#pmcal .btn { padding: 5px 12px; border: 1px solid #ccc; background: #f7f7f7; border-radius: 6px; cursor: pointer; font-size: 13px; }
#pmcal .btn:hover { background: #ececec; }
#pmcal .btn.active { background: #2563eb; color: #fff; border-color: #2563eb; }
#pmcal .btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
#pmcal .btn.danger { background: #e74c3c; color: #fff; border-color: #e74c3c; }

#pmcal .pmcal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
#pmcal .pmcal-grid th { background: #f2f4f8; border: 1px solid #e0e0e0; padding: 6px; font-size: 13px; }
#pmcal .pmcal-cell { border: 1px solid #e8e8e8; vertical-align: top; height: 92px; padding: 3px; cursor: pointer; transition: background .15s; }
#pmcal .pmcal-cell:hover { background: #f5f9ff; }
#pmcal .pmcal-cell.off { background: #fafafa; color: #bbb; }
#pmcal .pmcal-cell.today { background: #fff7e6; }
#pmcal .pmcal-cell.today .pmcal-daynum { color: #e67e22; font-weight: 700; }
#pmcal .pmcal-daynum { font-size: 12px; color: #666; margin-bottom: 2px; }
#pmcal .pmcal-wd .pmcal-cell.wd { height: 360px; }
#pmcal .pmcal-ev {
  color: #fff; font-size: 12px; border-radius: 4px; padding: 2px 5px; margin: 2px 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
#pmcal .pmcal-ev:hover { opacity: .85; }

/* 年曆 */
#pmcal .pmcal-year { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
#pmcal .pmcal-ymonth { border: 1px solid #e6e6e6; border-radius: 8px; padding: 8px; cursor: pointer; }
#pmcal .pmcal-ymonth:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
#pmcal .pmcal-ymonth-h { font-weight: 700; margin-bottom: 4px; }
#pmcal .pmcal-mini { width: 100%; border-collapse: collapse; }
#pmcal .pmcal-mini th { font-size: 10px; color: #999; padding: 1px; font-weight: 400; }
#pmcal .pmcal-mini td { text-align: center; font-size: 11px; padding: 2px; cursor: pointer; border-radius: 3px; }
#pmcal .pmcal-mini td.off { color: #ccc; }
#pmcal .pmcal-mini td.today { background: #ffe0b2; font-weight: 700; }
#pmcal .pmcal-mini td.has { background: #2563eb; color: #fff; }
#pmcal .pmcal-ycount { margin-top: 4px; font-size: 11px; color: #2563eb; }

/* Modal */
.pmcal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 100001; display: flex; align-items: center; justify-content: center; }
.pmcal-modal { background: #fff; border-radius: 10px; padding: 20px; width: 420px; max-width: 92vw; max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.pmcal-modal h3 { margin: 0 0 12px; }
.pmcal-modal label { display: block; margin: 8px 0; font-size: 13px; color: #444; }
.pmcal-modal label.pmcal-inline { display: flex; align-items: center; gap: 6px; }
.pmcal-modal input[type=text], .pmcal-modal input[type=datetime-local], .pmcal-modal textarea {
  width: 100%; box-sizing: border-box; padding: 6px 8px; border: 1px solid #ccc; border-radius: 6px; margin-top: 3px;
}
.pmcal-modal .pmcal-actions { display: flex; gap: 8px; margin-top: 14px; }
.pmcal-modal .btn { padding: 7px 14px; border: 1px solid #ccc; background: #f7f7f7; border-radius: 6px; cursor: pointer; }
.pmcal-modal .btn.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.pmcal-modal .btn.danger { background: #e74c3c; color: #fff; border-color: #e74c3c; }

/* RWD */
@media (max-width: 640px) {
  #pmcal .pmcal-year { grid-template-columns: repeat(2, 1fr); }
  #pmcal .pmcal-cell { height: 64px; }
}
