/* ============================================================
   CALENDAR GENERATOR — DARK THEME UI
   ============================================================ */

:root {
  --bg:          #080a11;
  --bg-2:        #0d111a;
  --panel:       #10151f;
  --panel-2:     #151b27;
  --border:      rgba(255,255,255,.07);
  --border-2:    rgba(255,255,255,.12);
  --text:        #e8ecf6;
  --text-dim:    #8b95ad;
  --text-faint:  #5d6679;
  --accent:      #6ea8fe;
  --accent-2:    #8bbcff;
  --danger:      #ff7a7a;
  --radius:      12px;
  --radius-lg:   18px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 348px;
  flex: 0 0 348px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.logo {
  width: 40px; height: 40px;
  flex: 0 0 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #4f8bff, #8b5cf6);
  box-shadow: 0 6px 18px rgba(79,139,255,.35);
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.2px;
}
.brand-text p {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 2px;
}

.scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 20px 20px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
.scroll::-webkit-scrollbar { width: 8px; }
.scroll::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.1);
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.scroll::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.18); background-clip: padding-box; }

/* ---------- Groups ---------- */
.group {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.group:last-child { border-bottom: none; }

.group h2 {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .9px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 11px;
}

/* ---------- Rows ---------- */
.row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.row.two { margin-top: 8px; }
.row.two > * { flex: 1; min-width: 0; }

/* ---------- Inputs ---------- */
input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 11px;
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, background .15s;
  -webkit-appearance: none;
  appearance: none;
}
input[type="text"]::placeholder { color: var(--text-faint); }
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
  border-color: rgba(110,168,254,.55);
  background: #182030;
}
input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(.7);
  cursor: pointer;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b95ad' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 30px;
  cursor: pointer;
}

.group input[type="text"] + input[type="text"] { margin-top: 8px; }

input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 7px; }

label.mini {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
}

/* ---------- Segmented ---------- */
.segmented {
  display: flex;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 3px;
  gap: 3px;
}
.segmented button {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .16s ease;
  white-space: nowrap;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: linear-gradient(180deg, rgba(110,168,254,.22), rgba(110,168,254,.12));
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(110,168,254,.3);
}

/* ---------- Buttons ---------- */
.icon-btn {
  flex: 0 0 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s;
}
.icon-btn:hover { color: var(--accent); border-color: rgba(110,168,254,.4); }

.ghost-btn {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  border-radius: 10px;
  border: 1px dashed var(--border-2);
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
.ghost-btn:hover { color: var(--text); border-color: rgba(110,168,254,.5); background: rgba(110,168,254,.05); }

/* ---------- Dropzone ---------- */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 20px 12px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--border-2);
  background: rgba(255,255,255,.012);
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
  cursor: pointer;
  transition: all .18s;
}
.dropzone:hover,
.dropzone.dragover {
  border-color: rgba(110,168,254,.6);
  background: rgba(110,168,254,.07);
  color: var(--accent-2);
}
.dropzone.has-image {
  border-style: solid;
  border-color: rgba(110,168,254,.45);
  color: var(--accent-2);
}

/* ---------- Sliders ---------- */
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 11px;
}
.slider-row label {
  flex: 0 0 88px;
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 500;
}
input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,.1);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #0f1420;
  box-shadow: 0 0 0 1px rgba(110,168,254,.5);
  cursor: pointer;
  transition: transform .12s;
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #0f1420;
  cursor: pointer;
}

/* ---------- Switch ---------- */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-dim);
  user-select: none;
}
.switch input { display: none; }
.switch span { transition: color .15s; }
.switch:hover span { color: var(--text); }
.switch input:checked + span { color: var(--text); }
.switch::before {
  content: '';
  flex: 0 0 36px;
  width: 36px; height: 21px;
  border-radius: 99px;
  background: rgba(255,255,255,.1);
  position: relative;
  transition: background .18s;
  background-image: radial-gradient(circle at 10.5px 10.5px, #6b7280 0, #6b7280 5.5px, transparent 6px);
  background-repeat: no-repeat;
}
.switch::before {
  background-image: radial-gradient(circle at 10.5px 10.5px, #7b8496 0, #7b8496 5.5px, transparent 6.2px);
}
.switch input:checked::before { }
.switch input:checked + span { }
.switch:has(input:checked)::before {
  background-color: rgba(110,168,254,.85);
  background-image: radial-gradient(circle at 25.5px 10.5px, #0b1220 0, #0b1220 5.5px, transparent 6.2px);
}

/* ---------- Footer actions ---------- */
.footer-actions {
  display: flex;
  gap: 9px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,.18);
}
.footer-actions .primary {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(135deg, #4f8bff, #7c6cff);
  color: #fff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(79,139,255,.3);
  transition: transform .14s, box-shadow .14s, filter .14s;
}
.footer-actions .primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(79,139,255,.42);
  filter: brightness(1.06);
}
.footer-actions .primary:active { transform: translateY(0); }

.footer-actions .secondary {
  flex: 0 0 76px;
  padding: 12px;
  border-radius: 11px;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.footer-actions .secondary:hover { color: var(--text); border-color: rgba(110,168,254,.45); }

/* ---------- Preview ---------- */
.preview {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(900px 600px at 70% -10%, rgba(79,139,255,.09), transparent 60%),
    radial-gradient(700px 500px at 10% 110%, rgba(139,92,246,.08), transparent 60%),
    var(--bg);
  position: relative;
}

.preview-inner {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 28px;
  overflow: hidden;
  min-height: 0;
}

#calendar {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.07),
    0 30px 70px rgba(0,0,0,.6);
  display: block;
}

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px;
  font-size: 11.5px;
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,.2);
  letter-spacing: .3px;
}
.preview-bar .dot {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--text-faint);
  opacity: .6;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 20px);
  background: rgba(20,26,38,.97);
  border: 1px solid rgba(110,168,254,.35);
  color: var(--text);
  padding: 11px 20px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 100;
  box-shadow: 0 14px 40px rgba(0,0,0,.6);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  body { overflow: auto; }
  .app { flex-direction: column-reverse; height: auto; min-height: 100dvh; }
  .sidebar {
    width: 100%;
    flex: none;
    border-right: none;
    border-top: 1px solid var(--border);
  }
  .scroll { max-height: none; overflow: visible; }
  .preview { min-height: 52vh; }
  .preview-inner { padding: 16px; }
  .footer-actions { position: sticky; bottom: 0; }
}