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

:root {
  --background: #ffffff;
  --foreground: #111111;
  --card: #ffffff;
  --card-foreground: #111111;
  --primary: #1a1a1a;
  --primary-foreground: #ffffff;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --border: #e5e5e5;
  --input: #e5e5e5;
  --destructive: #dc2626;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #0a0a0a;
    --foreground: #fafafa;
    --card: #0a0a0a;
    --card-foreground: #fafafa;
    --primary: #fafafa;
    --primary-foreground: #0a0a0a;
    --muted: #262626;
    --muted-foreground: #a3a3a3;
    --border: #262626;
    --input: #262626;
    --destructive: #ef4444;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
}

.container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.wrapper {
  width: 100%;
  max-width: 448px;
}

.header {
  text-align: center;
  margin-bottom: 32px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.calendar-icon {
  width: 32px;
  height: 32px;
  color: var(--primary);
}

h1 {
  font-size: 30px;
  font-weight: 700;
  color: var(--foreground);
}

.subtitle {
  font-size: 14px;
  color: var(--muted-foreground);
}

.templates-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}

.template-btn {
  padding: 8px 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  background-color: var(--background);
  color: var(--foreground);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}

.template-btn:hover {
  background-color: var(--muted);
  border-color: var(--foreground);
}

.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  space: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.input {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid var(--input);
  border-radius: 6px;
  background-color: var(--background);
  color: var(--foreground);
  font-family: inherit;
  transition: border-color 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--primary);
}

textarea.input {
  resize: vertical;
  min-height: 80px;
}

.required {
  color: var(--destructive);
}

.form-divider {
  height: 1px;
  background-color: var(--border);
  margin: 16px 0;
}

.btn {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-outline {
  background-color: transparent;
  color: var(--foreground);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  background-color: var(--muted);
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.alarm-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.alarms-list {
  margin-bottom: 12px;
}

.alarm-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background-color: var(--muted);
  border-radius: 6px;
  margin-bottom: 8px;
  font-size: 14px;
}

.alarm-delete {
  background: none;
  border: none;
  color: var(--muted-foreground);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alarm-delete:hover {
  color: var(--foreground);
}

.custom-alarm {
  display: flex;
  gap: 8px;
}

.custom-alarm .input {
  flex: 1;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-note {
  font-size: 12px;
  color: var(--muted-foreground);
  text-align: center;
  margin-top: 24px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  z-index: 51;
  background-color: var(--card);
  border-radius: var(--radius);
  max-width: 400px;
  width: 100%;
  padding: 0;
  overflow: hidden;
}

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--foreground);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted-foreground);
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--foreground);
}

.modal-body {
  padding: 20px 24px;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  gap: 8px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}

.modal-footer .btn {
  flex: 1;
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.radio-label,
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
}

.radio-label input,
.checkbox-label input {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.days-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hidden {
  display: none !important;
}

/* Add timezone helper modal styles */
.timezone-search {
  margin-bottom: 16px;
}

.timezone-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.timezone-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.timezone-checkbox-label:hover {
  background-color: var(--muted);
}

.timezone-checkbox-label input {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.timezone-comparisons {
  display: grid;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.timezone-comparison-card {
  padding: 12px 16px;
  background-color: var(--muted);
  border-radius: 8px;
  border-left: 3px solid var(--primary);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tz-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tz-time {
  font-size: 16px;
  font-weight: 600;
  color: var(--foreground);
  font-family: 'Courier New', monospace;
}

.tz-offset {
  font-size: 12px;
  color: var(--muted-foreground);
}

.no-selection {
  margin-top: 20px;
}

/* QR code and decode page styles */
.qr-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding: 20px;
  background-color: var(--muted);
  border-radius: var(--radius);
}

.qr-code {
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code img {
  border-radius: 8px;
}

.qr-label {
  font-size: 14px;
  color: var(--muted-foreground);
  text-align: center;
}

.share-link-section {
  margin-top: 16px;
}

.share-link-section label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 8px;
}

.share-link-input-group {
  display: flex;
  gap: 8px;
}

.share-link-input-group .input {
  flex: 1;
  font-size: 12px;
}

.share-link-input-group .btn {
  flex-shrink: 0;
}

/* Added embed code section styles */
.embed-code-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.embed-code-section label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 8px;
}

.embed-description {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: 12px;
  line-height: 1.4;
}

.embed-code-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.embed-textarea {
  font-family: 'Courier New', monospace !important;
  font-size: 12px !important;
  padding: 12px !important;
  min-height: 100px;
  background-color: var(--background) !important;
  color: var(--foreground) !important;
  border: 1px solid var(--input) !important;
  line-height: 1.4;
  resize: vertical;
}

.embed-code-input-group .btn {
  width: 100%;
}

.embed-help {
  margin-top: 12px;
  padding: 0;
  border: none;
}

.embed-help summary {
  padding: 8px 0;
  color: var(--primary);
  font-weight: 500;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}

.embed-help summary:hover {
  text-decoration: underline;
}

.embed-help-content {
  margin-top: 12px;
  padding: 12px;
  background-color: var(--muted);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--foreground);
}

.embed-help-content p {
  margin: 0 0 8px 0;
}

.embed-help-content p:last-child {
  margin-bottom: 0;
}

.embed-help-content strong {
  color: var(--foreground);
  font-weight: 600;
}

.embed-help-content em {
  color: var(--muted-foreground);
  font-style: italic;
}

/* Decode page styles */
.loading-state,
.error-state {
  text-align: center;
  padding: 40px 20px;
}

.loading-state p {
  color: var(--muted-foreground);
}

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.error-state.hidden,
.loading-state.hidden,
.eventState.hidden {
  display: none;
}

.error-message {
  color: var(--destructive);
  margin-bottom: 20px;
  font-size: 14px;
}

.event-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.detail-row.hidden {
  display: none;
}

.detail-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-size: 14px;
  color: var(--foreground);
  word-break: break-word;
}

/* Added timezone buddy timeline interface styles */

.timeline-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 1200px;
}

.timezone-add-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timezone-add-input-group {
  display: flex;
  gap: 8px;
}

.timezone-add-input-group .input {
  flex: 1;
  font-size: 14px;
}

.timezone-add-input-group .btn {
  flex-shrink: 0;
}

.help-text {
  font-size: 12px;
  color: var(--muted-foreground);
}

/* Timeline Grid Container */
.timeline-container {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  background-color: var(--card);
  display: flex;
  flex-direction: column;
}

.timeline-header {
  display: flex;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background-color: var(--card);
  z-index: 10;
}

.timezone-name-cell {
  min-width: 150px;
  padding: 12px;
  border-right: 1px solid var(--border);
  background-color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
}

.hour-headers {
  display: grid;
  grid-template-columns: repeat(24, 60px);
  gap: 0;
  flex: 1;
}

.hour-header {
  padding: 12px 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted-foreground);
  border-right: 1px solid var(--border);
  background-color: var(--muted);
  text-transform: uppercase;
}

.hour-header:last-child {
  border-right: none;
}

/* Timezone Rows */
.timezone-rows-container {
  display: flex;
  flex-direction: column;
}

.timezone-row {
  display: flex;
  border-bottom: 1px solid var(--border);
  align-items: stretch;
  position: relative;
}

.timezone-row.your-timezone {
  background-color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid var(--primary);
}

.timezone-row:last-child {
  border-bottom: none;
}

.timezone-row .timezone-name-cell {
  min-width: 150px;
  padding: 12px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  background-color: var(--background);
}

.timezone-row.your-timezone .timezone-name-cell {
  background-color: var(--muted);
}

.tz-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--foreground);
}

.tz-offset {
  font-size: 11px;
  color: var(--muted-foreground);
}

.hours-cell {
  display: grid;
  grid-template-columns: repeat(24, 60px);
  gap: 0;
  flex: 1;
}

.hour-tile {
  aspect-ratio: 1 / 1;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
  background-color: var(--background);
}

.hour-tile:hover {
  opacity: 0.8;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.hour-tile:last-child {
  border-right: none;
}

/* Hour tile color states */
.hour-tile.working-hours {
  background-color: #d4edda;
  color: #155724;
}

@media (prefers-color-scheme: dark) {
  .hour-tile.working-hours {
    background-color: #1a3a1a;
    color: #90ee90;
  }
}

.hour-tile.sleep-hours {
  background-color: #d1d5db;
  color: #374151;
}

@media (prefers-color-scheme: dark) {
  .hour-tile.sleep-hours {
    background-color: #374151;
    color: #d1d5db;
  }
}

.hour-tile.weekend {
  background-color: #fce7f3;
  color: #831843;
}

@media (prefers-color-scheme: dark) {
  .hour-tile.weekend {
    background-color: #500724;
    color: #fce7f3;
  }
}

.hour-tile.current-hour {
  background-color: #3b82f6;
  color: #ffffff;
  font-weight: 700;
  box-shadow: inset 0 0 0 2px #1e40af;
}

@media (prefers-color-scheme: dark) {
  .hour-tile.current-hour {
    background-color: #2563eb;
    color: #ffffff;
  }
}

/* Remove timezone button */
.remove-tz-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.2s;
  background-color: var(--destructive);
  color: #ffffff;
  border-color: var(--destructive);
  z-index: 5;
}

.timezone-row:hover .remove-tz-btn {
  opacity: 1;
}

.remove-tz-btn:hover {
  opacity: 0.8;
}

/* Timeline Legend */
.timeline-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  padding: 16px;
  background-color: var(--muted);
  border-radius: var(--radius);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  flex-shrink: 0;
}

.legend-color.working-hours {
  background-color: #d4edda;
}

@media (prefers-color-scheme: dark) {
  .legend-color.working-hours {
    background-color: #1a3a1a;
  }
}

.legend-color.sleep-hours {
  background-color: #d1d5db;
}

@media (prefers-color-scheme: dark) {
  .legend-color.sleep-hours {
    background-color: #374151;
  }
}

.legend-color.weekend {
  background-color: #fce7f3;
}

@media (prefers-color-scheme: dark) {
  .legend-color.weekend {
    background-color: #500724;
  }
}

.legend-color.current-hour {
  background-color: #3b82f6;
}

@media (prefers-color-scheme: dark) {
  .legend-color.current-hour {
    background-color: #2563eb;
  }
}

/* Timeline Actions */
.timeline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.timeline-actions .btn {
  flex-shrink: 0;
}

/* Meeting Suggestion Styles */
.suggestion-item {
  padding: 12px;
  background-color: var(--muted);
  border-radius: 8px;
  margin-bottom: 12px;
}

.suggestion-item h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 8px;
}

.suggestion-item ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.suggestion-item li {
  font-size: 12px;
  color: var(--muted-foreground);
  margin-bottom: 4px;
}

.suggestion-item li:last-child {
  margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .hour-tile {
    width: 40px;
    height: 40px;
    font-size: 9px;
  }

  .hours-cell {
    grid-template-columns: repeat(24, 40px);
  }

  .hour-headers {
    grid-template-columns: repeat(24, 40px);
  }

  .timezone-name-cell {
    min-width: 100px;
  }

  .timezone-legend {
    grid-template-columns: 1fr;
  }

  .timeline-actions {
    flex-direction: column;
  }

  .timeline-actions .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .wrapper {
    max-width: 100%;
  }

  .hour-tile {
    width: 32px;
    height: 32px;
    font-size: 8px;
  }

  .hours-cell {
    grid-template-columns: repeat(24, 32px);
  }

  .hour-headers {
    grid-template-columns: repeat(24, 32px);
  }

  .timezone-name-cell {
    min-width: 80px;
  }

  .tz-name {
    font-size: 11px;
  }

  .tz-offset {
    font-size: 9px;
  }
}
