/* ============================================================
   ChemLysis — modern stylesheet (orange accent) — v2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --orange-500: #f97316;
  --orange-400: #fb923c;
  --orange-300: #fdba74;
  --orange-600: #ea580c;
  --orange-700: #c2410c;
  --ink: #1c1917;
  --ink-soft: #44403c;
  --muted: #78716c;
  --line: #e7e5e4;
  --surface: #ffffff;
  --surface-2: #fafaf9;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.05);
  --shadow-md: 0 4px 20px rgba(28, 25, 23, 0.08);
  --shadow-lg: 0 16px 48px rgba(120, 53, 15, 0.16);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --card-bg: #1c1917;
  --card-border: #292524;
  --accent: #f97316;
  --accent-light: #fdba74;
  --text-main: #e7e5e4;
  --text-dim: #a8a29e;
  --green: #4ade80;
  --blue: #60a5fa;
  --yellow: #facc15;
}

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

html { scroll-behavior: smooth; height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, #FDC830 0%, #F37335 100%) fixed;
  min-height: 100vh;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  letter-spacing: -0.01em;
}

a { color: var(--orange-600); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--orange-700); text-decoration: underline; }

img { display: block; max-width: 100%; }

::selection { background: rgba(249, 115, 22, 0.25); }

/* =====================  MENU / HEADER  ===================== */

#menu {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(28, 25, 23, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

#menu .phymly_icon button,
#main_menu, #profile_button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  transition: transform 0.15s ease;
}
#menu .phymly_icon button:hover,
#main_menu:hover, #profile_button:hover { transform: scale(1.08); }

.phymly_icon img, #account {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

#about_adm { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.about_adm, form.about_adm { margin: 0; }

.abt_adm {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all 0.18s ease;
}
.abt_adm:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}

#menu_text {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  opacity: 0.95;
  text-align: center;
  flex: 1;
  min-width: 200px;
}

#acc { display: flex; align-items: center; gap: 12px; }
#acc form { margin: 0; }

.acc_button {
  background: linear-gradient(180deg, var(--orange-400), var(--orange-600));
  color: #fff;
  border: none;
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4);
}
.acc_button:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(249, 115, 22, 0.5);
}
.acc_button:active { transform: translateY(0); }
.acc_button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

#acc_text { font-size: 14px; color: #fff; }

#account {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(253, 186, 116, 0.6);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
#account:hover { border-color: var(--accent-light); }

/* =====================  MAIN  ===================== */

#main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px;
  flex: 1 0 auto;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
  position: relative;
}

#srch_dscr {
  flex: 1;
  width: 100%;
  max-width: 740px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 32px;
  padding-top: 40px;
  gap: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

#tasks_list {
  flex: 0 0 300px;
  max-width: 350px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.6);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 84px;
}

#profile_info {
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 22px;
  border-radius: 18px;
  position: fixed;
  top: 75px;
  right: 15px;
  max-width: 300px;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#greeting {
  color: var(--accent-light);
  position: relative;
  margin: 0;
  padding-bottom: 10px;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
}

#greeting::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-light), transparent);
  border-radius: 2px;
}

.row { display: flex; flex-direction: row; align-items: center; gap: 8px; }

.profile_text { color: var(--text-main); font-size: 16px; font-weight: 500; }

.profile_buttons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  padding: 0;
  background-color: var(--accent);
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.45);
}
.profile_buttons:hover {
  background-color: var(--orange-600);
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.6);
}
.profile_buttons:active { transform: translateY(0) scale(0.96); }

.diagram_title {
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
  text-align: center;
  text-transform: uppercase;
}

.chart_wrap { display: flex; justify-content: center; margin: 4px 0; }

.column_info { display: flex; flex-direction: column; gap: 8px; }

.legend_item {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  font-size: 14px;
}

.legend_swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* ---- Formula input ---- */

#enter {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
  align-items: center;
}

#explain_enter {
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  letter-spacing: -0.02em;
}

.submit {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 650px;
}

#enter_formula {
  flex: 1;
  width: 100%;
  min-width: 240px;
  max-width: 450px;
  padding: 13px 18px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: var(--font);
  background: var(--surface-2);
  color: var(--ink);
  transition: all 0.18s ease;
}
#enter_formula::placeholder { color: var(--muted); }
#enter_formula:focus {
  outline: none;
  border-color: var(--orange-500);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.14);
}

.send_the_formula,
#add_formula,
.change,
.do_task,
#goto_tasks,
#send_text,
#send_new_description button {
  background: linear-gradient(180deg, var(--orange-400), var(--orange-600));
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 14px rgba(249, 115, 22, 0.35);
  white-space: nowrap;
}
.send_the_formula:hover,
#add_formula:hover,
.change:hover,
.do_task:hover,
#goto_tasks:hover,
#send_text:hover,
#send_new_description button:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.45);
}
.send_the_formula:active,
#add_formula:active,
.change:active,
.do_task:active,
#goto_tasks:active,
#send_text:active { transform: translateY(0); }

/* =====================  DESCRIPTION  ===================== */

#descript {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 8px;
  padding: 26px;
  width: 100%;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

#image_box {
  width: 220px;
  height: 220px;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

#image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: var(--radius);
}

#swap_add {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  align-items: center;
}

.row_photos {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row_formulas {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.column_photos {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.column_photos form { width: 100%; max-width: 280px; display: flex; justify-content: center; }
.column_photos .change { width: 100%; }

#photos_manipulate {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.conditions_chdl { margin: 0; }
.conditions { position: relative; width: 100%; }
.file_input { display: none; }

#descriptions { width: 100%; display: flex; flex-direction: column; gap: 18px; }
#descriptions_ { display: flex; flex-direction: column; gap: 16px; }

.descript {
  display: flex;
  flex-direction: column;
  margin-bottom: 5px;
  font-size: 15px;
  width: 100%;
  color: rgba(0, 0, 0, 0.85);
  gap: 4px;
}

#moving_formulas {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

.descript label { font-weight: 600; color: var(--ink-soft); font-size: 13px; letter-spacing: 0.03em; text-transform: uppercase; }

.description_ {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font);
  background: #fff;
  color: var(--ink);
  transition: all 0.18s ease;
}
.description_:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.14);
}

/* ---- Footer buttons ---- */

#some_buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  padding-top: 18px;
  margin-top: 6px;
  border-top: 1px solid var(--line);
  width: 100%;
}

#send_new_description, #show_tasks, #add_tasks { margin: 0; }

/* ---- Text task ---- */

#text_task { display: flex; flex-direction: column; gap: 10px; width: 100%; }

#text_task textarea {
  width: 100%;
  min-height: 80px;
  max-height: 180px;
  resize: vertical;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font);
  background: #fff;
  color: var(--ink);
  transition: all 0.18s ease;
}
#text_task textarea:focus {
  outline: none;
  border-color: var(--orange-500);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.14);
}

/* ---- Tasks list ---- */

.box_url {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  width: 100%;
  transition: all 0.18s ease;
}
.box_url:hover {
  border-color: var(--orange-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.box_url input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--orange-500);
  cursor: pointer;
}

.task_shown_link {
  font-size: 14px;
  font-weight: 500;
  color: var(--orange-600);
}

#add_tasks {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
}

/* ---- Hint / empty states ---- */

#hint {
  font-size: 18px;
  font-weight: 700;
  color: var(--orange-600);
  margin-bottom: 8px;
}

.hint_tag {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hint { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* =====================  FLASH TOASTS  ===================== */

#flash-container {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.flash-toast {
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  animation: slideIn 0.28s cubic-bezier(0.21, 1.02, 0.73, 1);
}
.flash-toast.success { background: linear-gradient(180deg, #22c55e, #16a34a); }
.flash-toast.error { background: linear-gradient(180deg, #ef4444, #dc2626); }
.flash-toast.info { background: linear-gradient(180deg, var(--orange-400), var(--orange-500)); }
.flash-toast.warning { background: linear-gradient(180deg, #f59e0b, #d97706); }

/* =====================  FOOTER  ===================== */

.footer {
  flex-shrink: 0;
  background: #1c1917;
  color: rgba(255, 255, 255, 0.75);
  text-align: center;
  width: 100%;
  font-size: 13px;
  padding: 18px 20px;
  font-family: var(--font);
  letter-spacing: 0.02em;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* =====================  NON-ADMIN: photo left, text right  ===================== */

#image-modal {
  border: none;
  padding: 0;
  background: transparent;
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  border-radius: 12px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}

#image-modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
}

.modal-wrap {
  position: relative;
  display: block;
  line-height: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #0c0a09;
}

#modal-img {
  display: block;
  width: 100vw;
  height: 100vh;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  margin: 0 auto;
}

/* Водяний знак на збільшеному фото */
.modal-watermark {
  font-size: clamp(2.5rem, 8vw, 6rem);
  letter-spacing: 3px;
}

#image-modal .close-btn {
  z-index: 2;
}

#close-btn {
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  font-size: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  font-size: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
}

.close-btn:hover,
#close-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: rotate(90deg);
  text-decoration: none;
}

.row_formula_input {
  display: flex;
  gap: 10px;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  width: 100%;
}

#descript.user-view {
  flex-direction: row;
  align-items: flex-start;
  gap: 28px;
  margin-top: 20px;
}

#image_side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

#text_side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  flex: 1;
  min-width: 0;
}

#descript.user-view #image {
  max-width: 340px;
  max-height: 380px;
  object-fit: contain;
  border-radius: var(--radius);
}

/* =====================  RESPONSIVE  ===================== */

@media (max-width: 850px) {
  #main { flex-direction: column; align-items: center; }
  #tasks_list { max-width: 700px; width: 100%; position: static; }
  #descript.user-view { flex-direction: column; align-items: center; }
}

@media (max-width: 640px) {
  #menu { padding: 12px 16px; justify-content: center; }
  #menu_text { font-size: 14px; order: 3; flex-basis: 100%; text-align: center; }
  #main { padding: 16px 10px; }
  #srch_dscr { padding: 18px; }
  #image_box { width: 160px; height: 160px; }
  .acc_button { padding: 7px 14px; font-size: 13px; }
  .submit { flex-direction: column; align-items: stretch; }
  #enter_formula, .send_the_formula, #add_formula { max-width: 100%; }
}