/* Bryntum Google Calendar Viewer Styles */
:root {
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --bg-main: #f8fafd;
  --bg-surface: #ffffff;
  --border-color: #dadce0;
  --text-main: #202124;
  --text-secondary: #5f6368;
  --sidebar-width: 280px;
  --topbar-height: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-main);
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
}

/* Header Topbar */
.app-header {
  height: var(--topbar-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #4285f4 0%, #1a73e8 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  box-shadow: 0 2px 6px rgba(66, 133, 244, 0.3);
}

.brand-title {
  font-size: 18px;
  font-weight: 600;
  color: #3c4043;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  background: #e8f0fe;
  color: #1a73e8;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-btn {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-btn:hover {
  background: #f1f3f4;
  border-color: #c6c9cc;
}

.current-range-text {
  font-size: 15px;
  font-weight: 600;
  color: #3c4043;
  min-width: 140px;
  text-align: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-primary {
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: #1557b0;
}

.sync-status {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34a853;
}

.status-dot.syncing {
  background: #fbbc05;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.9); opacity: 0.6; }
}

/* App Body Layout */
.app-container {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--topbar-height));
  overflow: hidden;
}

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 18px 16px;
  gap: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.search-input-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  outline: none;
  background: #f8f9fa;
  transition: all 0.15s ease;
}

.search-input:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.15);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 13px;
}

/* Calendar Filter List */
.calendar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.calendar-item:hover {
  background: #f1f3f4;
}

.calendar-checkbox {
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 2px solid #ccc;
  outline: none;
  cursor: pointer;
  display: grid;
  place-content: center;
  transition: all 0.15s ease;
}

.calendar-checkbox:checked {
  background-color: var(--cal-color, #1a73e8);
  border-color: var(--cal-color, #1a73e8);
}

.calendar-checkbox:checked::before {
  content: "✓";
  color: white;
  font-size: 11px;
  font-weight: bold;
}

.calendar-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}

.calendar-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-count {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Stats Box */
.stats-card {
  background: #f8fafd;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-top: auto;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}

.stats-row:last-child {
  margin-bottom: 0;
}

.stats-label {
  color: var(--text-secondary);
}

.stats-value {
  font-weight: 600;
  color: var(--text-main);
}

/* Main Calendar Container */
.calendar-view-container {
  flex: 1;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: white;
}

#bryntum-calendar-container {
  width: 100%;
  height: 100%;
}

/* Override / Harmonize Bryntum defaults */
.b-calendar {
  height: 100% !important;
  font-family: inherit !important;
}

/* Event Detail Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
  z-index: 99999;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-card {
  background: white;
  width: 440px;
  max-width: 90vw;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  animation: popIn 0.18s ease-out;
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 20px;
  background: #f8fafd;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-detail-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.modal-icon {
  width: 20px;
  color: var(--text-secondary);
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 2px;
}

.modal-detail-content {
  flex: 1;
}

.modal-detail-label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 2px;
}

.modal-detail-text {
  font-size: 14px;
  color: var(--text-main);
  line-height: 1.4;
}

.meet-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1a73e8;
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  margin-top: 6px;
  transition: background 0.15s ease;
}

.meet-action-btn:hover {
  background: #1557b0;
}

/* Connect Prompt Overlay for External Viewers */
.connect-overlay {
  position: absolute;
  inset: 0;
  background: rgba(248, 250, 253, 0.95);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.connect-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 36px 32px;
  max-width: 460px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.connect-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.connect-card h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 10px;
}

.connect-card p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 24px;
}

.btn-primary-large {
  background: #1a73e8;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(26, 115, 232, 0.25);
}

.btn-primary-large:hover {
  background: #1557b0;
  box-shadow: 0 4px 12px rgba(26, 115, 232, 0.35);
  transform: translateY(-1px);
}
