/* Period Tracker Widget */
.period-widget {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 3vw, 20px);
  width: min(92vw, 350px);
  padding: clamp(20px, 4vw, 24px);
  border-radius: 20px;
  border: 1px solid var(--surface-border);
  background: var(--surface-bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(26px);
  overflow: hidden;
  isolation: isolate;
}

body.app-shell[data-theme='light'] .period-widget {
  backdrop-filter: blur(22px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.period-widget__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.period-widget__title {
  font-size: clamp(1.2rem, 2.5vw, 1.4rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0;
}

.period-widget__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 200ms ease;
}

.period-widget__status.active {
  background: rgba(244, 114, 182, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 114, 182, 0.3);
}

.period-widget__status.inactive {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-secondary);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

body.app-shell[data-theme='light'] .period-widget__status.active {
  background: rgba(244, 114, 182, 0.2);
  color: #ec4899;
}

body.app-shell[data-theme='light'] .period-widget__status.inactive {
  background: rgba(148, 163, 184, 0.15);
}

.period-widget__controls {
  display: flex;
  gap: 10px;
  margin: 8px 0;
}

.period-widget__button {
  flex: 1;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--control-border);
  background: var(--control-bg);
  color: var(--control-text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.period-widget__button:hover {
  background: var(--control-hover-bg);
  border-color: var(--control-hover-border);
  transform: translateY(-1px);
}

.period-widget__button:active {
  transform: translateY(0);
}

.period-widget__button.primary {
  background: rgba(244, 114, 182, 0.18);
  border-color: rgba(244, 114, 182, 0.35);
  color: #fda4af;
}

.period-widget__button.primary:hover {
  background: rgba(244, 114, 182, 0.25);
  border-color: rgba(244, 114, 182, 0.5);
}

body.app-shell[data-theme='light'] .period-widget__button.primary {
  background: rgba(244, 114, 182, 0.2);
  color: #ec4899;
}

body.app-shell[data-theme='light'] .period-widget__button.primary:hover {
  background: rgba(244, 114, 182, 0.28);
}

.period-widget__history {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

body.app-shell[data-theme='light'] .period-widget__history {
  border-top-color: rgba(148, 163, 184, 0.2);
}

.period-widget__history-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 4px 0;
}

.period-widget__history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 140px;
  overflow-y: auto;
}

.period-widget__history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.85rem;
  transition: background 150ms ease;
}

body.app-shell[data-theme='light'] .period-widget__history-item {
  background: rgba(15, 23, 42, 0.04);
}

.period-widget__history-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

body.app-shell[data-theme='light'] .period-widget__history-item:hover {
  background: rgba(15, 23, 42, 0.08);
}

.period-widget__history-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.period-widget__history-icon.start {
  color: #fda4af;
}

.period-widget__history-icon.end {
  color: var(--text-secondary);
}

.period-widget__history-text {
  flex: 1;
  color: var(--text-primary);
}

.period-widget__history-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.period-widget__summary {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.2);
  font-size: 0.85rem;
  color: #bbf7d0;
  text-align: center;
}

body.app-shell[data-theme='light'] .period-widget__summary {
  background: rgba(74, 222, 128, 0.15);
  color: #16a34a;
}

.period-widget__empty {
  padding: 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
