.gcal-card {
  position: relative;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08), 0 0 0 1px rgba(0,0,0,.06);
  overflow: hidden;
}

.gcal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  padding: .75rem 1.25rem;
  background: var(--primary, #185FA5);
  color: #fff;
}

.gcal-header-left { min-width: 0; }
.gcal-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcal-subtitle { font-size: .75rem; opacity: .8; margin-top: 2px; }

.gcal-header-right { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }

.gcal-view-tabs {
  display: flex;
  gap: 3px;
  background: rgba(0,0,0,.15);
  border-radius: 20px;
  padding: 3px;
}

.gcal-view-tab {
  background: transparent;
  border: none;
  color: rgba(255,255,255,.75);
  font-size: .7rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-transform: uppercase;
}
.gcal-view-tab:hover { color: #fff; background: rgba(255,255,255,.15); }
.gcal-view-tab.active { background: rgba(255,255,255,.92); color: #185FA5; font-weight: 600; }

.gcal-nav-group { display: flex; align-items: center; gap: 2px; }
.gcal-nav-btn {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  min-width: 30px;
  height: 30px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
  padding: 0 6px;
}
.gcal-nav-btn:hover { background: rgba(255,255,255,.28); }
.gcal-today-btn { font-size: .7rem; font-weight: 600; text-transform: uppercase; }

.gcal-body { 
  display: grid; 
  align-items: start;
  min-height: 420px; 
}
.gcal-body.has-sidebar { grid-template-columns: 1fr 270px; }
.gcal-body.no-sidebar  { grid-template-columns: 1fr; }

.gcal-main {
  min-width: 0;
  border-right: 1px solid #e8e8e8;
}
.gcal-main .fc-toolbar { display: none !important; }

.gcal-main .fc-col-header-cell { background: #f7f7f7; font-size: .7rem; font-weight: 600; text-transform: uppercase; color: #888; padding: 6px 0; border-color: #e8e8e8; }
.gcal-main .fc-daygrid-day-number { font-size: .75rem; font-weight: 500; color: #555; padding: 4px 6px; text-decoration: none; }
.gcal-main .fc-day-today { background: rgba(24,95,165,.05) !important; }
.gcal-main .fc-day-today .fc-daygrid-day-number { background: #185FA5; color: #fff; border-radius: 50%; width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; padding: 0; margin: 4px; }
.gcal-main .fc-daygrid-day-frame { min-height: 80px; }
.gcal-main .fc-event { border: none !important; border-radius: 3px !important; font-size: .7rem !important; font-weight: 500 !important; padding: 1px 5px !important; cursor: pointer; transition: opacity .1s; }
.gcal-main .fc-event:hover { opacity: .85; }
.gcal-main .fc-daygrid-more-link { font-size: .68rem; font-weight: 600; color: #888; text-decoration: none; }
.gcal-main .fc-daygrid-more-link:hover { color: #185FA5; text-decoration: underline; }
.gcal-main .fc-timegrid-slot { height: 32px; }
.gcal-main .fc-timegrid-slot-label { font-size: .68rem; color: #aaa; }
.gcal-main .fc-scrollgrid, .gcal-main td, .gcal-main th { border-color: #e8e8e8; }
.gcal-main .fc-popover { border-color: #e8e8e8; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.gcal-main .fc-popover-header { background: #f7f7f7; font-size: .75rem; padding: 6px 8px; }

.gcal-agenda-view { padding: 1rem; overflow-y: auto; max-height: 520px; }
.gcal-agenda-month-group { margin-bottom: 1.5rem; }
.gcal-agenda-month-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; color: #aaa; padding-bottom: 6px; border-bottom: 1px solid #eee; margin-bottom: .5rem; }
.gcal-agenda-row { display: flex; gap: 12px; padding: 8px 4px; border-bottom: 1px solid #f2f2f2; cursor: pointer; transition: background .1s; border-radius: 4px; }
.gcal-agenda-row:hover { background: #f7f9fc; }
.gcal-agenda-date-col { flex-shrink: 0; width: 48px; text-align: center; }
.gcal-agenda-date-day { font-size: 1.25rem; font-weight: 500; line-height: 1; color: #333; }
.gcal-agenda-date-dow { font-size: .65rem; font-weight: 600; text-transform: uppercase; color: #aaa; }
.gcal-agenda-date-col.is-today .gcal-agenda-date-day { background: #185FA5; color: #fff; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; margin: 0 auto; font-size: .9rem; }
.gcal-agenda-event-col { flex: 1; min-width: 0; }
.gcal-agenda-event-item { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; cursor: pointer; }
.gcal-agenda-bar { width: 3px; border-radius: 2px; flex-shrink: 0; align-self: stretch; min-height: 28px; margin-top: 2px; }
.gcal-agenda-event-name { font-size: .85rem; font-weight: 500; color: #333; }
.gcal-agenda-event-time { font-size: .72rem; color: #999; }
.gcal-agenda-span-badge { display: inline-block; font-size: .65rem; font-weight: 600; background: #e8f0fb; color: #185FA5; border-radius: 3px; padding: 1px 5px; margin-left: 5px; vertical-align: middle; }

.gcal-sidebar { 
  display: flex; 
  flex-direction: column; 
  max-height: 750px;
}
@media (max-height: 900px) {
    .gcal-sidebar { max-height: calc(100vh - 4rem); }
}
.gcal-event-list { 
  flex: 1;
  overflow-y: auto;
}

.gcal-sidebar-header { padding: .75rem 1rem; border-bottom: 1px solid #e8e8e8; background: #fafafa; display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.gcal-sidebar-label { font-size: .68rem; font-weight: 700; text-transform: uppercase; color: #888; }
.gcal-sidebar-hint  { font-size: .68rem; color: #bbb; }
.gcal-event-date-header { font-size: .7rem; font-weight: 600; color: #888; padding: 6px 1rem 4px; background: #f7f7f7; border-bottom: 1px solid #eee; border-top: 1px solid #eee; }
.gcal-event-item { display: flex; gap: 10px; padding: 10px 1rem; border-bottom: 1px solid #f2f2f2; cursor: pointer; transition: background .1s; align-items: flex-start; }
.gcal-event-item:hover { background: #f5f8fd; }
.gcal-event-bar { width: 3px; border-radius: 2px; flex-shrink: 0; align-self: stretch; min-height: 36px; }
.gcal-event-info { flex: 1; min-width: 0; }
.gcal-event-name { font-size: .8rem; font-weight: 500; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcal-event-meta { font-size: .7rem; color: #999; margin-top: 2px; }
.gcal-no-events { padding: 2rem 1rem; text-align: center; color: #aaa; font-size: .8rem; }
.gcal-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; padding: 2rem; color: #aaa; font-size: .8rem; }
.gcal-spinner { width: 24px; height: 24px; border: 2px solid #e0e0e0; border-top-color: #185FA5; border-radius: 50%; animation: gcal-spin .7s linear infinite; }
@keyframes gcal-spin { to { transform: rotate(360deg); } }
.gcal-error-msg { padding: 1rem; color: #c0392b; font-size: .8rem; background: #fdf3f2; border-left: 3px solid #e74c3c; margin: .5rem; border-radius: 0 4px 4px 0; }

.gcal-footer { padding: .6rem 1.25rem; border-top: 1px solid #e8e8e8; background: #fafafa; display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.gcal-legend { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.gcal-legend-item { display: flex; align-items: center; gap: 5px; }
.gcal-legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.gcal-legend-label { font-size: .68rem; color: #999; }
.gcal-subscribe-wrap { position: relative; }
.gcal-subscribe-btn { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; color: #185FA5; background: none; border: 1px solid currentColor; border-radius: 4px; padding: 3px 10px; cursor: pointer; transition: background .15s, color .15s; text-decoration: none; }
.gcal-subscribe-btn:hover { background: #185FA5; color: #fff; }
.gcal-subscribe-popover { display: none; position: absolute; bottom: calc(100% + 6px); right: 0; background: #fff; border: 1px solid #e0e0e0; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.12); min-width: 200px; z-index: 200; overflow: hidden; }
.gcal-subscribe-popover.open { display: block; }
.gcal-subscribe-popover-header { font-size: .65rem; font-weight: 700; text-transform: uppercase; color: #aaa; padding: 8px 12px 4px; }
.gcal-subscribe-popover-item { display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: .8rem; font-weight: 500; color: #333; text-decoration: none; transition: background .1s; border-top: 1px solid #f2f2f2; }
.gcal-subscribe-popover-item:hover { background: #f5f8fd; color: #185FA5; }
.gcal-subscribe-popover-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.gcal-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; z-index: 100; border-radius: 6px; }
.gcal-modal-card { background: #fff; border-radius: 6px; width: 340px; max-width: 90%; box-shadow: 0 8px 32px rgba(0,0,0,.18); overflow: hidden; position: relative; }
.gcal-modal-color-bar { height: 5px; }
.gcal-modal-close { position: absolute; top: 10px; right: 12px; background: none; border: none; font-size: 1.2rem; color: #aaa; cursor: pointer; line-height: 1; padding: 0; transition: color .1s; }
.gcal-modal-close:hover { color: #555; }
.gcal-modal-body { padding: 1.25rem; }
.gcal-modal-cal-name { font-size: .68rem; font-weight: 600; text-transform: uppercase; color: #aaa; margin-bottom: 4px; }
.gcal-modal-title { font-size: 1rem; font-weight: 600; color: #222; margin-bottom: .4rem; padding-right: 1.5rem; }
.gcal-modal-meta { font-size: .78rem; color: #888; margin-bottom: .4rem; }
.gcal-modal-location { font-size: .75rem; color: #aaa; margin-bottom: .4rem; }
.gcal-modal-location:not(:empty)::before { content: "📍 "; }
.gcal-modal-desc { font-size: .8rem; color: #555; line-height: 1.6; white-space: pre-line; }
.gcal-modal-desc a { color: #185FA5; text-decoration: underline; }

@media (max-width: 768px) {
  .gcal-body.has-sidebar { grid-template-columns: 1fr; }
  
  .gcal-sidebar { display: none !important; } 
  
  .gcal-main { 
    border-right: none; 
    border-bottom: 1px solid #e8e8e8; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch;
  }
  
  .gcal-main .fc-timegrid-view { min-width: 500px; }
  
  .gcal-header { flex-direction: column; align-items: flex-start; }
  .gcal-header-left,
  .gcal-header-right { width: 100%; text-align: center; justify-content: space-between; }
  .gcal-legend { display: none; }
  
  .gcal-footer { justify-content: center; }
  .gcal-subscribe-popover { right: auto; left: 50%; transform: translateX(-50%); width: max-content; max-width: 90vw; }
}