/* =========================
   Base / Layout (modern UI)
   (Brand colors: purple + yellow)
   ========================= */

:root{
  --bg: #FAF8F8;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;

  /* Brand palette */
  --brand: #A71B71;
  --brand-2: #B82585;
  --accent: #FDC333;
  --accent-2: #FBBA00;

  --primary: var(--brand);
  --primary-2: var(--brand-2);

  --focus-ring: rgba(167,27,113,0.18);
  --accent-ring: rgba(253,195,51,0.22);

  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
  --shadow-sm: 0 6px 18px rgba(17, 24, 39, 0.06);

  --radius: 16px;
  --radius-sm: 12px;
}

*{ box-sizing: border-box; }

body{
  margin: 0;
  padding: 24px 20px 60px;
  background: var(--bg);
  color: var(--text);
  font-family: Roboto, Arial, sans-serif;
  line-height: 1.5;

  width: min(1800px, 96vw);
  margin-left: auto;
  margin-right: auto;
}

h1{
  font-size: 28px;
  margin: 6px 0 18px;
  letter-spacing: -0.02em;
}

h2{
  font-size: 20px;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

/* Forms */
#frameForm,
#userForm{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

#frameForm{
  margin-bottom: 18px;
}

#userForm{
  margin-top: 28px !important;
}

.form-group{
  margin-bottom: 14px;
}

label{
  display: block;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text);
}

.form-hint{
  display:block;
  margin-top:6px;
  color: var(--muted);
  font-size: 13px;
}

/* Inputs */
.large-input{
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, box-shadow .2s ease, transform .02s ease;
  font-family: inherit;
}

.large-input:focus{
  outline: none;
  border-color: rgba(167,27,113,0.65);
  box-shadow: 0 0 0 4px var(--focus-ring), var(--shadow-sm);
}

#userForm > div{
  margin-bottom: 14px;
}

#userForm input[type="text"],
#userForm input[type="email"],
#userForm input[type="date"],
#userForm textarea{
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s ease, box-shadow .2s ease;
  font-family: inherit;
}

#userForm textarea{
  resize: vertical;
  min-height: 110px;
}

#userForm input:focus,
#userForm textarea:focus{
  outline: none;
  border-color: rgba(167,27,113,0.65);
  box-shadow: 0 0 0 4px var(--focus-ring), var(--shadow-sm);
}

::placeholder{
  color: #9ca3af;
}

/* Buttons */
button[type="submit"]{
  appearance: none;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 16px;
  font-weight: 800;

  background: var(--primary);
  color: #fff;

  box-shadow:
    0 10px 20px rgba(167,27,113,0.22),
    0 0 0 0 rgba(0,0,0,0);

  transition: transform .08s ease, background-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}

button[type="submit"]:hover{
  background: var(--primary-2);
  box-shadow:
    0 12px 26px rgba(167,27,113,0.26),
    0 0 0 3px var(--accent-ring);
}

button[type="submit"]:active{
  transform: translateY(1px);
}

button[type="submit"]:focus{
  outline: none;
  box-shadow:
    0 0 0 4px var(--focus-ring),
    0 12px 26px rgba(167,27,113,0.20);
}

button[type="submit"]:disabled{
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

/* Font cards */
.centered-input-container{
  max-width: 740px;
  margin: 0 auto;
}

.font-cards-container{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.font-card{
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
  cursor: pointer;
  min-width: 0;
}

.font-card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.font-card.selected{
  border-color: rgba(167,27,113,0.65);
  box-shadow: 0 0 0 4px var(--focus-ring), var(--shadow);
}

.font-sample{
  font-size: 18px;
  margin-bottom: 10px;
  text-align: center;
  padding: 8px 0;
}

.font-checkboxes{
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.checkbox-label{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 10px;
  transition: background .2s ease;
  user-select: none;
}

.checkbox-label:hover{
  background: rgba(17,24,39,0.04);
}

.font-checkbox{
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.checkbox-label span{
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.frame-filters{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top: 10px;
  margin-bottom: 6px;
}

.filter-btn{
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.filter-btn.is-active{
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.frame-preview.is-hidden{
  display:none !important;
}

/* Preview grid */
#preview{
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  width: 100%;
  gap: 16px;
  margin-top: 18px;
}

.frame-preview{
  width: calc(25% - 12px);
  position: relative;
  border-radius: 0 !important;
  overflow: visible;
  cursor: pointer;

  background: #eef1f5;

  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.frame-preview img{
  width: 100%;
  height: auto;
  display: block;

  border-radius: 0 !important;

  outline: 1px solid #d8dde6;
  outline-offset: -1px;
}

/* Fixed print zone (do not change) */
.event-info{
  position: absolute;
  left: calc(var(--zone-left, 15) * 1%);
  width: calc(var(--zone-width, 70) * 1%);
  bottom: calc(var(--zone-bottom, 3) * 1%);
  height: calc(var(--zone-height, 9) * 1%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--name-date-gap, 0px);
  text-align: center;
  margin: 0;
  padding: 5px;
  padding-top: 2px;
  overflow: visible;
}

.event-name,
.event-date{
  display: block;
  width: 100%;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow-x: visible;
  overflow-y: visible;
}

.event-date{
  font-size: 0.8em;
}

.event-info.is-script-font .event-date{
  margin-top: 2%;
}

/* Logo inside name area */
.event-logo{
  display:block;
  max-width: 100%;
  max-height: 62%;
  object-fit: contain;
  margin: 0 auto;
}

.event-info.logo-full .event-logo{
  max-height: 100%;
}

/*.frame-preview:nth-child(2) .event-info,
.frame-preview:nth-child(4) .event-info,
.frame-preview:nth-child(10) .event-info{
  color: #f7c972;
}*/

.frame-preview.is-selected{
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.frame-preview:focus{
  outline: 3px solid rgba(167,27,113,0.35);
  outline-offset: 2px;
}

.event-info, .event-name, .event-date{
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

/* Responsive */
@media (max-width: 1024px){
  .frame-preview{ width: calc(50% - 8px); }
}

@media (max-width: 768px){
  body{ padding: 14px 12px 40px; width: 96vw; }
  h1{ font-size: 24px; }
  #frameForm, #userForm{ padding: 16px; }

  .font-sample{ font-size: 14px; }
  .checkbox-label{ padding: 6px 8px; }
  .checkbox-label span{ font-size: 11px; }
}

@media (max-width: 600px){
  .frame-preview{ width: 100%; }

  .font-cards-container{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .font-card{
    padding: 10px;
  }

  .font-checkboxes{
    gap: 6px;
    flex-direction: column;
    align-items: flex-start;
  }

  .checkbox-label{
    padding: 6px 8px;
    width: 100%;
    justify-content: flex-start;
  }
}

/* Language switch (simple) */
.lang-switch{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.lang-btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  width: 44px;
  height: 44px;

  background: #FDC333;
  color: #111827;
  text-decoration: none;

  border: 0;
  border-radius: 0;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.lang-btn.is-active{
  background: #851761;
  color: #fff;
}