/* Daily Habits - Share Preview Styles */

:root {
  --primary-gradient: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
  --primary-color: #4CAF50;
  --primary-dark: #388E3C;
  --background: #f5f7fa;
  --card-background: #ffffff;
  --text-primary: #2d3748;
  --text-secondary: #718096;
  --text-muted: #a0aec0;
  --border-color: #e2e8f0;
  --success-color: #48bb78;
  --error-color: #f56565;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --icon-size: 28px;
  --icon-border-radius: 5px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 5px 20px 20px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 20px;
}

.app-logo {
  width: var(--icon-size);
  height: var(--icon-size);
  border-radius: var(--icon-border-radius);
  margin-right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  overflow: hidden;
  flex-shrink: 0;
}

.app-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.app-tagline {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Loading State */
.loading-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-text {
  margin-top: 20px;
  font-size: 16px;
  color: var(--text-secondary);
}

/* Preview Content */
.preview-container {
  flex: 0 1 auto;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-align: center;
  word-wrap: break-word;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  text-align: center;
  line-height: 1.5;
}

.list-card {
  background: var(--card-background);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.list-header {
  display: flex;
  align-items: center;
  margin-bottom: 0;
}

.list-icon {
  width: var(--icon-size);
  height: var(--icon-size);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-right: 12px;
}

.list-info {
  flex: 1;
  min-width: 0;
}

.list-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0;
  word-wrap: break-word;
}

.list-description {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
}

.list-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.meta-icon {
  font-size: 14px;
}

/* Tasks List */
.tasks-card {
  background: var(--card-background);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.tasks-header {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.task-count {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--background);
  padding: 4px 12px;
  border-radius: 12px;
}

.task-list {
  list-style: none;
}

.task-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.task-item:last-child {
  border-bottom: none;
}

.task-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-right: 12px;
}

.task-content {
  flex: 1;
  min-width: 0;
}

.task-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
  word-wrap: break-word;
}

.task-schedule {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(76, 175, 80, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
}

.schedule-icon {
  font-size: 12px;
  margin-right: 2px;
}

.day-active {
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
}

.day-inactive {
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: line-through;
  opacity: 0.5;
}

.day-comma {
  font-weight: 400;
  color: var(--text-secondary);
  text-decoration: none;
}

/* Action Buttons */
.actions-container {
  position: sticky;
  bottom: 0;
  background: var(--background);
  padding: 10px 0 5px 0;
  margin-top: 20px;
}

.button-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
  align-items: stretch;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 52px;
  width: 100%;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  border: none;
  padding: 16px 24px;
  box-shadow: var(--shadow);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--card-background);
  color: var(--primary-dark);
  border: 2px solid var(--primary-color);
  padding: 14px 22px;
}

.btn-secondary:hover {
  background: rgba(76, 175, 80, 0.05);
}

.btn-store {
  flex: 1;
  min-width: 0;
}

/* Desktop Install Message */
.desktop-install-message {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  background: var(--card-background);
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.install-icon {
  font-size: 20px;
  line-height: 1;
}

.install-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1;
}

/* Store Badges Container */
.store-badges-container {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* Store Badge Links (for desktop) */
.store-badge-link {
  display: inline-block;
  text-decoration: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.store-badge-link:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

.store-badge-link:active {
  transform: translateY(0);
  opacity: 0.8;
}

.store-badge {
  height: 54px;
  width: auto;
  display: block;
  border-radius: 8px;
}

/* Error State */
.error-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.error-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.error-icon.not-found {
  color: var(--text-muted);
}

.error-icon.expired {
  color: #f6ad55;
}

.error-icon.server-error {
  color: var(--error-color);
}

.error-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.error-message {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 24px;
  max-width: 400px;
}

.error-details {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
}

.btn-retry {
  background: var(--primary-gradient);
  color: white;
  padding: 12px 32px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  border: none;
  cursor: pointer;
  margin-top: 8px;
}

.btn-retry:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.error-store-badges {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Footer */
.footer {
  text-align: center;
  padding: 6px 0;
  color: var(--text-muted);
  font-size: 13px;
}

.footer a {
  color: var(--primary-color);
  text-decoration: none;
}

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

/* Desktop badges - keep vertical layout */
.button-group-desktop {
  flex-direction: column;
  align-items: stretch;
}

/* Responsive Design */
@media (min-width: 480px) {
  .container {
    padding: 5px 30px 30px 30px;
  }

  .list-card,
  .tasks-card {
    padding: 28px;
  }

  /* Mobile buttons - horizontal layout */
  .button-group:not(.button-group-desktop) {
    flex-direction: row;
  }

  .btn {
    flex: 1;
  }

  .store-badge {
    height: 60px;
  }
}

@media (min-width: 768px) {
  .container {
    padding: 5px 40px 40px 40px;
  }

  .app-name {
    font-size: 20px;
  }

  .page-title {
    font-size: 22px;
  }

  .list-title {
    font-size: 20px;
  }

  .task-name {
    font-size: 16px;
  }

  .install-text {
    font-size: 15px;
  }

  .store-badge {
    height: 64px;
  }
}

/* Safe area for notched devices */
@supports (padding: max(0px)) {
  .container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
  }

  .actions-container {
    padding-bottom: max(5px, env(safe-area-inset-bottom));
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --primary-dark: #764ba2;
    --background: #1a202c;
    --card-background: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --border-color: #4a5568;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
  }

  .btn-secondary {
    background: var(--background);
    color: white;
  }
}
