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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

header {
  background: #fff;
  padding: 20px;
  margin-bottom: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1 {
  font-size: 2rem;
  color: #2c3e50;
  margin: 0;
}

#user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

#user-email {
  font-size: 0.9rem;
  color: #7f8c8d;
}

/* Tabs */
.tabs {
  background: #fff;
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e0e0e0;
  padding: 0 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 15px 25px;
  cursor: pointer;
  font-size: 1rem;
  color: #7f8c8d;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  margin-bottom: -2px;
}

.tab-btn:hover {
  color: #2c3e50;
  background: #f8f9fa;
  transform: none;
}

.tab-btn.active {
  color: #3498db;
  border-bottom-color: #3498db;
  font-weight: 600;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

main {
  margin-top: 30px;
}

h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #2c3e50;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.section-header h2 {
  margin-bottom: 0;
}

.refresh-btn {
  background: transparent;
  border: none;
  padding: 6px;
  cursor: pointer;
  color: #7f8c8d;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.refresh-btn:hover {
  color: #3498db;
  background: #f0f0f0;
  transform: none;
}

.refresh-btn:active {
  transform: rotate(180deg);
}

section {
  background: #fff;
  padding: 30px;
  margin-bottom: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

label {
  font-weight: 600;
  margin-bottom: 5px;
  display: block;
}

input[type="url"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

input[type="url"]:focus {
  outline: none;
  border-color: #3498db;
}

button {
  padding: 10px 20px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

button:hover {
  background: #2980b9;
}

button:active {
  transform: translateY(1px);
}


.campaign-card {
  border: 1px solid #e0e0e0;
  padding: 20px;
  margin-bottom: 15px;
  border-radius: 8px;
  background: #fff;
  position: relative;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.campaign-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.campaign-card.scheduled {
  border-left: 4px solid #27ae60;
  background: linear-gradient(to right, #f0fdf4, #fff 20px);
}

.campaign-card.sent {
  border-left: 4px solid #3498db;
  background: linear-gradient(to right, #ebf5fb, #fff 20px);
}

.campaign-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.campaign-status-badge {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 3px;
  margin-right: 8px;
}

.campaign-status-badge.draft {
  background: #f0f0f0;
  color: #7f8c8d;
}

.campaign-status-badge.scheduled {
  background: #d5f5e3;
  color: #1e8449;
}

.campaign-status-badge.sent {
  background: #d6eaf8;
  color: #1a5276;
}

.campaign-card h3 {
  margin: 0;
  color: #2c3e50;
  padding: 4px 0;
  border-radius: 4px;
  transition: all 0.2s;
  display: inline-block;
  min-width: 100px;
  max-width: 100%;
  font-size: 1.25rem;
  font-weight: 600;
}

.campaign-card h3.editing {
  padding: 4px 8px;
  background: #fff;
  border: 2px solid #3498db;
  outline: none;
}

.edit-title-btn {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #95a5a6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  min-width: 24px;
  height: 24px;
}

.edit-title-btn:hover {
  color: #3498db;
  background: transparent;
  transform: none;
}

.cancel-edit-btn {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #e74c3c;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  min-width: 24px;
  height: 24px;
}

.cancel-edit-btn:hover {
  color: #c0392b;
  background: transparent;
  transform: none;
}

.campaign-card p {
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: #666;
}

.campaign-card a {
  color: #3498db;
  text-decoration: none;
}

.campaign-card a:hover {
  text-decoration: underline;
}

/* Campaign meta info */
.campaign-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 0.85rem;
  color: #7f8c8d;
}

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

.campaign-meta-item strong {
  color: #95a5a6;
  font-weight: 500;
}

.campaign-id-hint {
  cursor: help;
  color: #95a5a6;
  font-size: 0.85rem;
}

/* Campaign links */
.campaign-links {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.campaign-links a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #3498db;
  font-size: 0.9rem;
}

.campaign-links a:hover {
  text-decoration: underline;
}

/* Campaign footer with actions */
.campaign-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.campaign-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Actions menu (kebab) */
.actions-menu-container {
  position: relative;
}

.actions-menu-btn {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  border-radius: 4px;
  color: #666;
  transition: all 0.2s;
}

.actions-menu-btn:hover {
  background: #eee;
  color: #333;
}

.actions-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  min-width: 180px;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all 0.2s;
}

.actions-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.actions-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  color: #333;
  transition: background 0.15s;
}

.actions-menu-item:first-child {
  border-radius: 6px 6px 0 0;
}

.actions-menu-item:last-child {
  border-radius: 0 0 6px 6px;
}

.actions-menu-item:hover {
  background: #f5f5f5;
}

.actions-menu-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 4px 0;
}

.actions-menu-item.danger {
  color: #e74c3c;
}

.actions-menu-item.danger:hover {
  background: #fdf2f2;
}

.delete-btn {
  background: #e74c3c !important;
}

.delete-btn:hover {
  background: #c0392b !important;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #95a5a6;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 1rem;
  margin-bottom: 8px;
}

.empty-state-hint {
  font-size: 0.85rem;
  color: #bdc3c7;
}

/* Skeleton loading */
.skeleton-card {
  border: 1px solid #e0e0e0;
  padding: 20px;
  margin-bottom: 15px;
  border-radius: 8px;
  background: #fff;
}

.skeleton-line {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
}

.skeleton-badge {
  width: 60px;
  height: 20px;
  display: inline-block;
  margin-right: 10px;
}

.skeleton-title {
  width: 200px;
  height: 24px;
  display: inline-block;
}

.skeleton-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.skeleton-meta {
  width: 120px;
  height: 14px;
  margin-bottom: 12px;
}

.skeleton-links {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}

.skeleton-link {
  width: 100px;
  height: 16px;
}

.skeleton-schedule {
  width: 180px;
  height: 16px;
  margin-bottom: 16px;
}

.skeleton-footer {
  display: flex;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid #eee;
}

.skeleton-btn {
  width: 90px;
  height: 38px;
}

.skeleton-menu-btn {
  width: 40px;
  height: 38px;
}

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

/* Fade in animation for cards */
.campaign-card {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger animation for multiple cards */
.campaign-card:nth-child(1) { animation-delay: 0ms; }
.campaign-card:nth-child(2) { animation-delay: 50ms; }
.campaign-card:nth-child(3) { animation-delay: 100ms; }
.campaign-card:nth-child(4) { animation-delay: 150ms; }
.campaign-card:nth-child(5) { animation-delay: 200ms; }

.success {
  color: #27ae60;
  font-weight: 600;
}

.error {
  color: #e74c3c;
  font-weight: 600;
}

#create-status, #drafts-list {
  margin-top: 20px;
}

/* Stats Grid (used in sent campaign cards) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 15px;
  margin-top: 20px;
}

.stat-card {
  background: #fff;
  padding: 15px;
  border-radius: 4px;
  text-align: center;
  border: 1px solid #e0e0e0;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: #2c3e50;
  margin-bottom: 5px;
}

.stat-label {
  font-size: 0.9rem;
  color: #7f8c8d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-detail {
  font-size: 0.85rem;
  color: #95a5a6;
  margin-top: 5px;
}

/* Notification System */
#notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  max-width: 400px;
}

.notification {
  background: #fff;
  padding: 16px 20px;
  margin-bottom: 10px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border-left: 4px solid #3498db;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease;
}

.notification.show {
  opacity: 1;
  transform: translateX(0);
}

.notification-success {
  border-left-color: #27ae60;
}

.notification-error {
  border-left-color: #e74c3c;
}

.notification-info {
  border-left-color: #3498db;
}

/* Modal System */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  opacity: 1;
}

.modal {
  background: #fff;
  padding: 30px;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal p {
  margin-bottom: 20px;
  font-size: 1.1rem;
  color: #2c3e50;
}

.modal-input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  margin-bottom: 20px;
}

.modal-input:focus {
  outline: none;
  border-color: #3498db;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn-cancel {
  background: #95a5a6;
  color: white;
}

.modal-btn-cancel:hover {
  background: #7f8c8d;
}

.modal-btn-confirm {
  background: #3498db;
  color: white;
}

.modal-btn-confirm:hover {
  background: #2980b9;
}

.modal-btn-danger {
  background: #e74c3c;
}

.modal-btn-danger:hover {
  background: #c0392b;
}

.modal-btn-success {
  background: #27ae60;
}

.modal-btn-success:hover {
  background: #219a52;
}

/* Schedule Row */
.schedule-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 8px 0;
}

.schedule-display {
  padding: 4px 8px;
  border-radius: 4px;
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: 500;
}

.schedule-display.not-scheduled {
  background: #f5f5f5;
  color: #95a5a6;
  font-weight: normal;
}

.schedule-input-container {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.schedule-datetime,
.schedule-tz {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.9rem;
  background: #fff;
}

.schedule-datetime {
  width: 200px;
}

.schedule-tz {
  width: 180px;
}

.schedule-datetime:focus,
.schedule-tz:focus {
  outline: none;
  border-color: #3498db;
}

.edit-schedule-btn {
  background: transparent;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #95a5a6;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  min-width: 24px;
  height: 24px;
}

.edit-schedule-btn:hover {
  color: #3498db;
  background: transparent;
  transform: none;
}

.clear-schedule-btn {
  background: transparent;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  color: #e74c3c;
  font-size: 1.2rem;
  font-weight: bold;
  line-height: 1;
  transition: color 0.2s;
}

.clear-schedule-btn:hover {
  color: #c0392b;
  background: transparent;
  transform: none;
}

/* Send Now Button */
.send-btn {
  background: #27ae60 !important;
}

.send-btn:hover {
  background: #219a52 !important;
}

/* Scheduled Button */
.scheduled-btn {
  background: #95a5a6 !important;
  cursor: default;
}

.scheduled-btn:hover {
  background: #7f8c8d !important;
}
