/* ==========================================================================
   Add to Calendar Widget - Styles
   ========================================================================== */

/* CSS Custom Properties for theming */
:root {
  --atc-accent: #2563EB;
  --atc-accent-hover: #1d4ed8;
  --atc-accent-text: #ffffff;
  --atc-bg: #ffffff;
  --atc-text: #1a1a2e;
  --atc-text-secondary: #6b7280;
  --atc-border: #e5e7eb;
  --atc-radius: 12px;
  --atc-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --atc-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --atc-max-width: 480px;
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--atc-font);
  background: transparent;
  color: var(--atc-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Widget Container */
.atc-widget {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 24px 16px;
}

/* Card */
.atc-card {
  width: 100%;
  max-width: var(--atc-max-width);
  background: var(--atc-bg);
  border-radius: var(--atc-radius);
  box-shadow: var(--atc-shadow);
  border: 1px solid var(--atc-border);
}

/* Card body needs extra bottom padding to make room for the dropdown */
.atc-card__body {
  padding-bottom: 24px;
}

/* Hero Image */
.atc-card__image {
  width: 100%;
  max-height: 200px;
  overflow: hidden;
  border-radius: var(--atc-radius) var(--atc-radius) 0 0;
}

.atc-card__image img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

/* Card Body */
.atc-card__body {
  padding: 24px;
}

/* Title */
.atc-card__title {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--atc-text);
  line-height: 1.3;
  margin-bottom: 16px;
}

/* Meta Section */
.atc-card__meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.atc-card__meta-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.9375rem;
  color: var(--atc-text-secondary);
}

.atc-card__meta-row svg {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: var(--atc-accent);
}

.atc-card__meta-row time,
.atc-card__meta-row span {
  flex: 1;
  min-width: 0;
  white-space: pre-line;
}

/* Description */
.atc-card__description {
  font-size: 0.9375rem;
  color: var(--atc-text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  white-space: pre-line;
}

/* Actions */
.atc-card__actions {
  position: relative;
  padding-bottom: 4px;
}

/* Add to Calendar Button */
.atc-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 24px;
  font-family: var(--atc-font);
  font-size: 1rem;
  font-weight: 600;
  color: var(--atc-accent-text);
  background: var(--atc-accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  min-height: 48px;
  line-height: 1;
}

.atc-button:hover {
  background: var(--atc-accent-hover);
}

.atc-button:focus-visible {
  outline: 2px solid var(--atc-accent);
  outline-offset: 2px;
}

.atc-button svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.atc-button__chevron {
  transition: transform 0.2s ease;
}

.atc-button[aria-expanded="true"] .atc-button__chevron {
  transform: rotate(180deg);
}

/* Dropdown */
.atc-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--atc-bg);
  border: 1px solid var(--atc-border);
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 50;
  overflow: hidden;
  transform-origin: top center;
  transform: scaleY(0);
  opacity: 0;
  transition: transform 0.15s ease, opacity 0.15s ease;
  pointer-events: none;
}

.atc-dropdown--open {
  transform: scaleY(1);
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .atc-dropdown {
    transition: none;
  }
  .atc-button__chevron {
    transition: none;
  }
}

.atc-dropdown__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  font-family: var(--atc-font);
  font-size: 0.9375rem;
  color: var(--atc-text);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  min-height: 48px;
  transition: background-color 0.1s ease;
}

.atc-dropdown__item:hover {
  background: #f3f4f6;
}

.atc-dropdown__item:focus-visible {
  outline: 2px solid var(--atc-accent);
  outline-offset: -2px;
  background: #f3f4f6;
}

.atc-dropdown__item + .atc-dropdown__item {
  border-top: 1px solid var(--atc-border);
}

.atc-dropdown__item svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.atc-dropdown__item span {
  flex: 1;
}

/* Error State */
.atc-error {
  width: 100%;
  max-width: var(--atc-max-width);
  background: var(--atc-bg);
  border-radius: var(--atc-radius);
  box-shadow: var(--atc-shadow);
  border: 1px solid var(--atc-border);
  padding: 32px 24px;
  text-align: center;
}

.atc-error__icon {
  width: 48px;
  height: 48px;
  color: #ef4444;
  margin: 0 auto 16px;
}

.atc-error__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--atc-text);
  margin-bottom: 8px;
}

.atc-error__message {
  font-size: 0.875rem;
  color: var(--atc-text-secondary);
}

/* Powered By Footer */
.atc-powered-by {
  text-align: center;
  padding: 12px 24px 4px;
  font-size: 0.75rem;
  color: var(--atc-text-secondary);
}

.atc-powered-by a {
  color: var(--atc-text-secondary);
  text-decoration: none;
}

.atc-powered-by a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
  .atc-widget {
    padding: 16px 12px;
  }

  .atc-card__body {
    padding: 20px 16px;
  }

  .atc-card__title {
    font-size: 1.25rem;
  }
}

/* Screen reader only utility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
