/* LogCal — Styles */
/* Adapted from prototype + settings panel, topbar, status indicators */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
  background: #f5f5f5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Topbar ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  z-index: 20;
}

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

.topbar h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Status Banner ── */
.status-banner {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #fef3cd;
  border-bottom: 1px solid #ffc107;
  font-size: 13px;
  flex-shrink: 0;
}

.status-banner.visible {
  display: flex;
}

.status-banner .error-text {
  color: #c62828;
}

/* ── Main Layout ── */
.main-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

#app {
  flex: 1;
  overflow: auto;
  background: #fff;
  padding: 0;
}

/* ── Empty State ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: #666;
}

.empty-state h2 {
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.empty-state p {
  font-size: 14px;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e0e0e0;
  border-top-color: #4a90d9;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Buttons ── */
.btn {
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.btn-primary {
  background: #4a90d9;
  color: #fff;
}

.btn-primary:hover {
  background: #3a7bc8;
}

.btn-secondary {
  background: #e8e8e8;
  color: #333;
}

.btn-secondary:hover {
  background: #ddd;
}

.btn-small {
  padding: 4px 8px;
  font-size: 12px;
}

.btn-danger {
  background: #f5e5e5;
  color: #c62828;
}

.btn-danger:hover {
  background: #f0d0d0;
}

.btn-icon {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.btn-icon:hover {
  background: #f0f0f0;
}

/* ── Settings Panel ── */
.settings-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  background: #fff;
  border-left: 1px solid #e0e0e0;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.08);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-panel.open {
  transform: translateX(0);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.settings-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.settings-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #888;
  line-height: 1;
  padding: 0 4px;
}

.settings-close:hover {
  color: #333;
}

.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section h3 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  margin-bottom: 12px;
}

.settings-hint {
  font-size: 12px;
  color: #999;
  margin-bottom: 8px;
}

.settings-empty {
  font-size: 13px;
  color: #bbb;
  font-style: italic;
  padding: 8px 0;
}

/* ── Account Items ── */
.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.account-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-connected { background: #4caf50; }
.status-expired { background: #ff9800; }
.status-error { background: #f44336; }

.account-email {
  font-size: 13px;
}

.account-actions {
  display: flex;
  gap: 4px;
}

/* ── Calendar Items ── */
.calendar-group {
  margin-bottom: 12px;
}

.calendar-group-header {
  font-size: 12px;
  font-weight: 600;
  color: #888;
  padding: 4px 0;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: 4px;
}

.calendar-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.calendar-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.calendar-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.cal-column {
  font-size: 12px;
  padding: 2px 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
}

/* ── Rule Items ── */
.rule-item {
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

.rule-row {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.rule-row select,
.rule-row input {
  font-size: 12px;
  padding: 4px 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
}

.rule-row input {
  width: 80px;
}

.rule-field { width: 100px; }
.rule-operator { width: 100px; }
.rule-category { width: 100px; }

.rule-reorder {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

/* ── Timeline (from prototype) ── */
.continuous-controls {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  padding: 8px 12px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 13px;
}

.continuous-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.continuous-controls input[type="range"] {
  width: 200px;
}

.continuous-hint {
  color: #999;
  font-size: 12px;
}

.continuous-layout {
  position: relative;
  margin-left: 0;
}

.continuous-fit {
  height: calc(100vh - 90px) !important;
  overflow: hidden;
}

.continuous-fit::after,
.two-col-timeline::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, #fff);
  pointer-events: none;
  z-index: 10;
}

/* ── Time Markers ── */
.time-marker {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid #eee;
  height: 0;
  pointer-events: none;
  z-index: 1;
}

.time-marker .marker-label {
  position: absolute;
  left: 4px;
  top: -8px;
  font-size: 10px;
  color: #bbb;
  white-space: nowrap;
  background: #fff;
  padding: 0 4px;
}

.marker-now {
  border-top: 2px solid #e44;
}

.marker-now .marker-label {
  color: #e44;
  font-weight: 600;
  font-size: 11px;
}

.marker-day {
  border-top-color: #ccc;
}

.marker-day .marker-label {
  color: #888;
  font-weight: 500;
  font-size: 11px;
}

.marker-week .marker-label {
  font-size: 11px;
  color: #999;
}

.marker-month {
  border-top: 1px dashed #ccc;
}

.marker-month .marker-label {
  color: #888;
  font-weight: 500;
  font-size: 11px;
}

.marker-quarter {
  border-top: 2px solid #a8b5e0;
}

.marker-quarter .marker-label {
  color: #4a5a99;
  font-weight: 600;
  font-size: 12px;
}

.marker-year {
  border-top: 3px solid #333;
}

.marker-year .marker-label {
  color: #111;
  font-weight: 700;
  font-size: 14px;
}

.marker-subtitle {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: #999;
}

/* ── Event Chips ── */
.continuous-event {
  position: absolute;
  padding: 4px 8px;
  background: #e8f4fd;
  border-left: 3px solid #4a90d9;
  border-radius: 0 4px 4px 0;
  font-size: 13px;
  overflow: hidden;
  cursor: default;
  transition: box-shadow 0.15s;
  z-index: 2;
}

.continuous-event:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  z-index: 5;
}

.continuous-event.recurring {
  background: #f0f0f0;
  border-left-color: #bbb;
}

.continuous-event.all-day {
  background: #fdf8e8;
  border-left-color: #d4a017;
}

.continuous-event.compact {
  font-size: 11px;
  padding: 2px 6px;
}

.continuous-event .time {
  font-size: 11px;
  color: #666;
}

.continuous-event .location {
  font-size: 10px;
  color: #7a6b3a;
  font-style: italic;
}

/* ── Two-Column Layout ── */
.two-col-header-bar {
  display: flex;
  border-bottom: 1px solid #ddd;
}

.two-col-header-spacer {
  width: 120px;
  flex-shrink: 0;
}

.two-col-header {
  flex: 1;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.two-col-timeline {
  height: calc(100vh - 120px) !important;
}

.two-col-events {
  position: absolute;
  top: 0;
  bottom: 0;
  overflow: hidden;
}

.two-col-left {
  left: 120px;
  right: 50%;
}

.two-col-right {
  left: 50%;
  right: 0;
}

/* ── Tooltip ── */
.event-tooltip {
  position: fixed;
  z-index: 100;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-size: 13px;
  max-width: 280px;
  pointer-events: none;
  display: none;
}

.event-tooltip.visible {
  display: block;
}

.event-tooltip .tooltip-calendar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

.event-tooltip .tooltip-title {
  font-weight: 600;
  margin-bottom: 4px;
}

.event-tooltip .tooltip-time {
  color: #555;
  font-size: 12px;
}

.event-tooltip .tooltip-duration {
  color: #888;
  font-size: 11px;
}

.event-tooltip .tooltip-location {
  color: #7a6b3a;
  font-style: italic;
  font-size: 11px;
  margin-top: 2px;
}

.event-tooltip .tooltip-recurrence {
  color: #999;
  font-size: 11px;
  margin-top: 2px;
}

.event-tooltip .tooltip-attendees {
  color: #999;
  font-size: 11px;
  margin-top: 2px;
}
