/* FerienCalendar Widget Styles - Standalone Version */
/* Last Updated: 2025-01-05 */

:root {
  --widget-primary: #8B5CF6;
  --widget-primary-dark: #7C3AED;
  --widget-secondary: #06B6D4;
  --widget-background: #ffffff;
  --widget-background-dark: #1a1a2e;
  --widget-foreground: #1a1a2e;
  --widget-foreground-dark: #f5f5f5;
  --widget-muted: #f3f4f6;
  --widget-muted-dark: #2d2d44;
  --widget-muted-foreground: #6b7280;
  --widget-border: #e5e7eb;
  --widget-border-dark: #3d3d5c;
  --widget-vacation-bg: rgba(139, 92, 246, 0.1);
  --widget-vacation-bg-dark: rgba(139, 92, 246, 0.2);
  --widget-holiday-bg: rgba(59, 130, 246, 0.1);
  --widget-holiday-bg-dark: rgba(59, 130, 246, 0.2);
  --widget-religious-bg: rgba(168, 85, 247, 0.1);
  --widget-religious-bg-dark: rgba(168, 85, 247, 0.2);
  --widget-bridge-bg: rgba(249, 115, 22, 0.1);
  --widget-bridge-bg-dark: rgba(249, 115, 22, 0.2);
  --widget-radius: 12px;
  --widget-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --widget-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

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

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

body.dark {
  --widget-background: var(--widget-background-dark);
  --widget-foreground: var(--widget-foreground-dark);
  --widget-muted: var(--widget-muted-dark);
  --widget-border: var(--widget-border-dark);
  --widget-vacation-bg: var(--widget-vacation-bg-dark);
  --widget-holiday-bg: var(--widget-holiday-bg-dark);
  --widget-religious-bg: var(--widget-religious-bg-dark);
  --widget-bridge-bg: var(--widget-bridge-bg-dark);
}

/* Widget Container */
.widget-container {
  background: var(--widget-background);
  border-radius: var(--widget-radius);
  box-shadow: var(--widget-shadow);
  overflow: hidden;
  max-width: 480px;
  margin: 0 auto;
}

/* Widget Header */
.widget-header {
  background: linear-gradient(135deg, var(--widget-primary), var(--widget-secondary));
  color: white;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.widget-header-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.widget-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

/* Widget Content */
.widget-content {
  padding: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.widget-content::-webkit-scrollbar {
  width: 6px;
}

.widget-content::-webkit-scrollbar-track {
  background: var(--widget-muted);
  border-radius: 3px;
}

.widget-content::-webkit-scrollbar-thumb {
  background: var(--widget-muted-foreground);
  border-radius: 3px;
}

/* Event Items */
.widget-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  margin-bottom: 8px;
  border-radius: 8px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.widget-item:hover {
  transform: translateX(4px);
  box-shadow: var(--widget-shadow);
}

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

.widget-item.vacation {
  background: var(--widget-vacation-bg);
}

.widget-item.holiday {
  background: var(--widget-holiday-bg);
}

.widget-item.religious {
  background: var(--widget-religious-bg);
}

.widget-item.bridge {
  background: var(--widget-bridge-bg);
}

.widget-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.widget-item-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

.widget-item-badge.vacation {
  background: rgba(139, 92, 246, 0.2);
  color: #7c3aed;
}

.widget-item-badge.holiday {
  background: rgba(59, 130, 246, 0.2);
  color: #2563eb;
}

.widget-item-badge.religious {
  background: rgba(168, 85, 247, 0.2);
  color: #9333ea;
}

.widget-item-badge.bridge {
  background: rgba(249, 115, 22, 0.2);
  color: #ea580c;
}

body.dark .widget-item-badge.vacation {
  color: #a78bfa;
}

body.dark .widget-item-badge.holiday {
  color: #60a5fa;
}

body.dark .widget-item-badge.religious {
  color: #c084fc;
}

body.dark .widget-item-badge.bridge {
  color: #fb923c;
}

.widget-item-name {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--widget-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-item-date {
  font-size: 0.8rem;
  color: var(--widget-muted-foreground);
  flex-shrink: 0;
  text-align: right;
}

/* Loading State */
.widget-loading {
  padding: 20px;
}

.widget-skeleton {
  background: linear-gradient(90deg, var(--widget-muted) 25%, var(--widget-border) 50%, var(--widget-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
  height: 48px;
  margin-bottom: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Empty State */
.widget-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--widget-muted-foreground);
}

.widget-empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  opacity: 0.5;
}

/* Footer */
.widget-footer {
  border-top: 1px solid var(--widget-border);
  background: var(--widget-muted);
  padding: 10px 16px;
}

.widget-footer a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--widget-muted-foreground);
  text-decoration: none;
  transition: color 0.2s ease;
}

.widget-footer a:hover {
  color: var(--widget-primary);
}

.widget-footer a:hover .widget-footer-brand {
  text-decoration: underline;
}

.widget-footer-brand {
  font-weight: 600;
}

.widget-footer-icon {
  width: 12px;
  height: 12px;
}

/* Mini Widget Styles */
.widget-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  background: var(--widget-primary);
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.widget-badge:hover {
  transform: scale(1.05);
  box-shadow: var(--widget-shadow-lg);
}

.widget-badge-icon {
  width: 16px;
  height: 16px;
}

.widget-badge-divider {
  opacity: 0.7;
}

.widget-badge-date {
  opacity: 0.9;
}

/* Countdown Widget */
.widget-countdown {
  display: inline-block;
  padding: 20px;
  background: var(--widget-background);
  border: 1px solid var(--widget-border);
  border-radius: var(--widget-radius);
  text-decoration: none;
  color: var(--widget-foreground);
  transition: box-shadow 0.2s ease;
}

.widget-countdown:hover {
  box-shadow: var(--widget-shadow-lg);
}

.widget-countdown-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--widget-muted-foreground);
  text-align: center;
  margin-bottom: 4px;
}

.widget-countdown-name {
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 12px;
  color: var(--widget-primary);
}

.widget-countdown-timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.widget-countdown-days {
  text-align: center;
}

.widget-countdown-days-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.widget-countdown-days-label {
  font-size: 0.7rem;
  color: var(--widget-muted-foreground);
}

.widget-countdown-date {
  font-size: 0.875rem;
  color: var(--widget-muted-foreground);
}

.widget-countdown-footer {
  margin-top: 12px;
  text-align: center;
  font-size: 0.7rem;
  color: var(--widget-muted-foreground);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* Ticker Widget */
.widget-ticker {
  overflow: hidden;
  background: var(--widget-background);
  border-top: 1px solid var(--widget-border);
  border-bottom: 1px solid var(--widget-border);
  padding: 10px 0;
  position: relative;
}

.widget-ticker-track {
  display: flex;
  align-items: center;
  gap: 32px;
  white-space: nowrap;
  animation: ticker 30s linear infinite;
}

@keyframes ticker {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.widget-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--widget-foreground);
  transition: color 0.2s ease;
}

.widget-ticker-item:hover {
  color: var(--widget-primary);
}

.widget-ticker-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.widget-ticker-dot.vacation {
  background: var(--widget-primary);
}

.widget-ticker-dot.holiday {
  background: #3b82f6;
}

.widget-ticker-name {
  font-weight: 500;
}

.widget-ticker-date {
  color: var(--widget-muted-foreground);
}

.widget-ticker-days {
  font-size: 0.75rem;
  padding: 2px 8px;
  background: var(--widget-muted);
  border-radius: 9999px;
}

.widget-ticker-brand {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.65rem;
  color: var(--widget-muted-foreground);
  background: var(--widget-background);
  padding: 2px 8px;
}

/* Compact Grid */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  padding: 16px;
}

.widget-grid-item {
  padding: 10px;
  background: var(--widget-muted);
  border-radius: 8px;
  text-align: center;
}

.widget-grid-date {
  font-size: 0.75rem;
  color: var(--widget-muted-foreground);
  margin-bottom: 4px;
}

.widget-grid-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--widget-foreground);
}

/* Responsive */
@media (max-width: 400px) {
  .widget-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .widget-item-date {
    text-align: left;
    width: 100%;
  }
  
  .widget-header h2 {
    font-size: 1rem;
  }
}