:root {
  --bg: #07070f;
  --bg-2: #0e0e1a;
  --bg-3: #13131f;
  --card: #111120;
  --card-hover: #17172a;
  --border: rgba(255,255,255,0.07);
  --border-glow: rgba(100,220,180,0.3);

  --accent: #3dffc0;
  --accent-dim: rgba(61,255,192,0.12);
  --accent-glow: rgba(61,255,192,0.25);
  --purple: #9d6eff;
  --purple-dim: rgba(157,110,255,0.12);
  --pink: #ff6eb4;
  --pink-dim: rgba(255,110,180,0.12);
  --amber: #ffcf5c;
  --amber-dim: rgba(255,207,92,0.1);

  --text: #e8e8f0;
  --text-muted: #6b6b8a;
  --text-dim: #3a3a52;

  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow: 0 4px 32px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 40px rgba(61,255,192,0.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 20px;
  /* subtle noise texture */
  background-image:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(61,255,192,0.03) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(157,110,255,0.04) 0%, transparent 60%);
}

.app-container { max-width: 1360px; margin: 0 auto; }

/* ===================== HEADER ===================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
  padding: 18px 24px;
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

.logo-area { display: flex; align-items: center; gap: 14px; }
.logo-icon {
  font-size: 36px;
  filter: drop-shadow(0 0 10px rgba(61,255,192,0.4));
  animation: pulse-icon 3s ease-in-out infinite;
}
@keyframes pulse-icon {
  0%, 100% { filter: drop-shadow(0 0 8px rgba(61,255,192,0.3)); }
  50% { filter: drop-shadow(0 0 18px rgba(61,255,192,0.6)); }
}

.app-header h1 {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

/* Status Badge */
.status-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid;
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; }
.status-badge.checking { background: rgba(255,255,255,0.03); border-color: var(--border); color: var(--text-muted); }
.status-badge.checking .status-dot { background: var(--text-dim); }
.status-badge.ready { background: rgba(61,255,192,0.08); border-color: rgba(61,255,192,0.3); color: var(--accent); }
.status-badge.ready .status-dot { background: var(--accent); box-shadow: 0 0 6px var(--accent); animation: blink 2s infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.4} }
.status-badge.warning { background: rgba(255,207,92,0.08); border-color: rgba(255,207,92,0.3); color: var(--amber); }
.status-badge.warning .status-dot { background: var(--amber); }

.btn-guide {
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 20px;
  cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-muted);
  transition: all 0.2s; white-space: nowrap;
}
.btn-guide:hover { background: rgba(255,255,255,0.08); color: var(--text); border-color: rgba(255,255,255,0.15); }

/* Google Login & User Profile Pill */
.btn-google-login {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 16px; border-radius: 20px;
  background: #ffffff; color: #1f2937;
  font-size: 12px; font-weight: 700; text-decoration: none;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  transition: transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn-google-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(61,255,192,0.25);
}

.user-profile-pill {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 6px; border-radius: 24px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
}
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  border: 1px solid rgba(61,255,192,0.4);
}
.user-info {
  display: flex; flex-direction: column; line-height: 1.15;
  max-width: 170px;
}
.user-name {
  font-size: 12px; font-weight: 700; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-email {
  font-size: 10px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-logout {
  background: rgba(255,110,180,0.12);
  border: 1px solid rgba(255,110,180,0.3);
  color: var(--pink);
  padding: 5px 11px; border-radius: 16px;
  font-size: 11px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all 0.2s;
  white-space: nowrap;
}
.btn-logout:hover { background: rgba(255,110,180,0.22); }

.auth-required-box {
  text-align: center; padding: 36px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 13px;
}
.hidden { display: none !important; }

/* Alert */
.config-alert {
  background: rgba(255,207,92,0.06);
  border: 1px solid rgba(255,207,92,0.2);
  color: var(--amber);
  padding: 12px 18px; border-radius: var(--radius-md);
  margin-bottom: 20px;
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; flex-wrap: wrap; gap: 10px;
}
.config-alert code { background: rgba(255,207,92,0.1); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.btn-link { background: none; border: none; color: var(--accent); text-decoration: underline; cursor: pointer; font-weight: 600; font-size: 13px; }

/* ===================== TABS ===================== */
.tab-nav {
  display: flex; gap: 4px; margin-bottom: 20px;
  background: var(--card);
  padding: 5px; border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  width: fit-content;
}
.tab-btn {
  padding: 9px 20px; border: none; background: none;
  border-radius: var(--radius-md); font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: all 0.2s;
  letter-spacing: 0.1px;
}
.tab-btn:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.tab-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(61,255,192,0.2);
  box-shadow: 0 0 20px rgba(61,255,192,0.08);
}

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

/* ===================== BENTO GRID ===================== */
.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1024px) { .main-content { grid-template-columns: 1fr; } }

/* Bento card base */
.card-box {
  background: var(--card);
  border-radius: var(--radius-xl);
  padding: 24px;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s;
}
.card-box:hover { border-color: rgba(255,255,255,0.12); }

/* Decorative corner accent */
.card-box::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at top right, var(--accent-dim), transparent 70%);
  pointer-events: none;
}
.preview-section.card-box::after {
  background: radial-gradient(circle at top right, var(--purple-dim), transparent 70%);
}

.section-title {
  font-size: 15px; font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.2px;
}
.section-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }

/* ===================== FORM ===================== */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 11px; font-weight: 700;
  color: var(--text-muted); margin-bottom: 7px;
  text-transform: uppercase; letter-spacing: 0.8px;
}

.label-with-hint { display: flex; justify-content: space-between; align-items: center; margin-bottom: 7px; }
.hint-text { font-size: 11px; color: var(--text-dim); }

input[type="text"],
input[type="email"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  transition: all 0.2s;
  appearance: none;
  -webkit-appearance: none;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(61,255,192,0.4);
  background: var(--bg-3);
  box-shadow: 0 0 0 3px rgba(61,255,192,0.07), 0 0 20px rgba(61,255,192,0.05);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b8a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
select option { background: #1a1a2e; color: var(--text); }

textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.field-hint { font-size: 11px; color: var(--text-dim); margin-top: 5px; line-height: 1.4; }

/* Schedule time box */
.schedule-time-box {
  display: flex; align-items: flex-start; gap: 14px;
  background: rgba(61,255,192,0.04);
  border: 1px solid rgba(61,255,192,0.15);
  border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 4px;
}
.schedule-time-icon { font-size: 26px; margin-top: 4px; }

/* ===================== SAMPLE WISHES ===================== */
.sample-wishes-container {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 150px; overflow-y: auto; padding: 8px;
  background: var(--bg-2);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.sample-wishes-container::-webkit-scrollbar { width: 4px; }
.sample-wishes-container::-webkit-scrollbar-track { background: transparent; }
.sample-wishes-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.wish-item {
  padding: 8px 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer; line-height: 1.5; color: var(--text-muted);
  transition: all 0.2s;
}
.wish-item:hover {
  border-color: rgba(61,255,192,0.3);
  background: var(--accent-dim);
  color: var(--text);
  transform: translateX(3px);
}
.empty-hint { font-size: 12px; color: var(--text-dim); font-style: italic; padding: 12px; text-align: center; }

/* ===================== THEME SELECTOR ===================== */
.theme-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-option {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}
.theme-option .color-preview { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.theme-option.active {
  border-color: rgba(61,255,192,0.4);
  background: var(--accent-dim);
  color: var(--accent);
  box-shadow: 0 0 12px rgba(61,255,192,0.1);
}
.theme-option:hover { border-color: rgba(255,255,255,0.15); color: var(--text); }

/* ===================== BUTTONS ===================== */
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

.btn {
  padding: 12px 20px; border-radius: var(--radius-md);
  font-weight: 700; font-size: 13px; cursor: pointer; border: none;
  transition: all 0.2s; display: inline-flex; align-items: center;
  justify-content: center; gap: 7px; letter-spacing: 0.1px;
}
.btn-primary {
  background: var(--accent);
  color: #000;
  flex: 2;
  box-shadow: 0 4px 20px rgba(61,255,192,0.2);
}
.btn-primary:hover:not(:disabled) {
  background: #5fffd0;
  box-shadow: 0 4px 30px rgba(61,255,192,0.4);
  transform: translateY(-1px);
}
.btn-secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--text-muted);
  flex: 1;
}
.btn-secondary:hover:not(:disabled) { background: rgba(255,255,255,0.08); color: var(--text); border-color: rgba(255,255,255,0.15); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ===================== PREVIEW ===================== */
.preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.preview-tag {
  font-size: 11px; color: var(--purple);
  background: var(--purple-dim);
  border: 1px solid rgba(157,110,255,0.2);
  padding: 4px 10px; border-radius: 20px; font-weight: 600;
}
.preview-window {
  width: 100%; height: 560px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.preview-window iframe { width: 100%; height: 100%; border: none; display: block; }

/* ===================== HISTORY / LIST ===================== */
.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.schedule-list { display: flex; flex-direction: column; gap: 10px; }

.schedule-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start;
  transition: all 0.2s;
}
.schedule-card:hover { background: var(--bg-3); border-color: rgba(255,255,255,0.1); }

.schedule-card.status-sent   { border-left: 3px solid var(--accent); }
.schedule-card.status-failed { border-left: 3px solid #ff5555; }
.schedule-card.status-cancelled { border-left: 3px solid var(--text-dim); opacity: 0.5; }
.schedule-card.status-pending { border-left: 3px solid var(--amber); }

.schedule-info h4 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.schedule-meta { font-size: 12px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }

.status-pill { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; border: 1px solid; }
.status-pill.pending  { background: rgba(255,207,92,0.1);  color: var(--amber);  border-color: rgba(255,207,92,0.2); }
.status-pill.sent     { background: rgba(61,255,192,0.1);  color: var(--accent); border-color: rgba(61,255,192,0.2); }
.status-pill.failed   { background: rgba(255,85,85,0.1);   color: #ff5555;       border-color: rgba(255,85,85,0.2); }
.status-pill.cancelled{ background: rgba(255,255,255,0.05);color: var(--text-muted); border-color: var(--border); }

.schedule-actions { display: flex; gap: 6px; }
.btn-icon {
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 12px; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  transition: all 0.2s; white-space: nowrap;
}
.btn-icon:hover { background: rgba(255,255,255,0.08); color: var(--text); border-color: rgba(255,255,255,0.15); }
.btn-icon.danger:hover { background: rgba(255,85,85,0.1); border-color: rgba(255,85,85,0.3); color: #ff5555; }

.empty-list { text-align: center; padding: 48px; color: var(--text-dim); font-size: 14px; }

/* ===================== WAVE DECORATION ===================== */
.wave-deco {
  position: absolute;
  bottom: -10px; left: 0; right: 0;
  height: 40px;
  opacity: 0.08;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    90deg,
    var(--accent) 0px, var(--accent) 2px,
    transparent 2px, transparent 20px
  );
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 40'%3E%3Cpath d='M0 20 Q15 5 30 20 Q45 35 60 20 Q75 5 90 20 Q105 35 120 20 Q135 5 150 20 Q165 35 180 20 Q195 5 210 20 Q225 35 240 20 Q255 5 270 20 Q285 35 300 20' stroke='white' fill='none' stroke-width='2'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 300 40'%3E%3Cpath d='M0 20 Q15 5 30 20 Q45 35 60 20 Q75 5 90 20 Q105 35 120 20 Q135 5 150 20 Q165 35 180 20 Q195 5 210 20 Q225 35 240 20 Q255 5 270 20 Q285 35 300 20' stroke='white' fill='none' stroke-width='2'/%3E%3C/svg%3E");
}

/* ===================== MODAL ===================== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 580px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6), var(--shadow-glow);
  animation: modalFade 0.25s ease-out;
}
@keyframes modalFade { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; color: var(--text); font-weight: 700; }
.btn-close { background: rgba(255,255,255,0.05); border: 1px solid var(--border); border-radius: 8px; width: 32px; height: 32px; font-size: 18px; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.btn-close:hover { background: rgba(255,85,85,0.1); color: #ff5555; border-color: rgba(255,85,85,0.3); }
.modal-body { padding: 20px 24px; font-size: 13px; line-height: 1.7; color: var(--text-muted); }
.guide-steps { margin: 14px 0; padding-left: 18px; }
.guide-steps li { margin-bottom: 10px; color: var(--text-muted); }
.guide-steps strong { color: var(--text); }
.guide-steps code, .guide-steps pre {
  background: var(--bg-2); border: 1px solid var(--border);
  padding: 2px 7px; border-radius: 5px; color: var(--accent); font-size: 12px;
}
.guide-steps pre { padding: 12px; margin-top: 8px; display: block; overflow-x: auto; }
.guide-steps a { color: var(--accent); text-decoration: none; }
.guide-steps a:hover { text-decoration: underline; }
.guide-note { background: rgba(61,255,192,0.05); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 6px; color: var(--accent); font-size: 12px; margin-top: 12px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

/* ===================== TOAST ===================== */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px; border-radius: var(--radius-md);
  background: var(--card); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 2000; transition: all 0.3s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.success { border-color: rgba(61,255,192,0.3); color: var(--accent); background: rgba(61,255,192,0.07); }
.toast.error   { border-color: rgba(255,85,85,0.3);  color: #ff5555; background: rgba(255,85,85,0.07); }

.hidden { display: none !important; }

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }
