/* ============================================
  ПЕРЕМЕННЫЕ ТЕМЫ (светлая/тёмная)
============================================ */
:root{
  /* Основные цвета */
  --primary-1: #667eea;
  --primary-2: #764ba2;
  --accent: #00d4ff;
  --success: #00e676;
  --error: #ff5252;
  --warning: #ffb300;

  /* Светлая тема */
  --bg-glass: rgba(255,255,255,.78);
  --bg-input: rgba(245,247,252,.85);
  --bg-hover: rgba(102,126,234,.08);
  --text-main: #1c1e21;
  --text-muted: #7a8599;
  --border: rgba(102,126,234,.18);
  --shadow: rgba(102,126,234,.25);

  /* Анимации */
  --spring: cubic-bezier(.34,1.56,.64,1);
  --smooth: cubic-bezier(.4,0,.2,1);
}

/* Тёмная тема */
[data-theme="dark"]{
  --bg-glass: rgba(20,22,34,.82);
  --bg-input: rgba(30,33,48,.9);
  --bg-hover: rgba(0,212,255,.1);
  --text-main: #e8ecf4;
  --text-muted: #8b95a8;
  --border: rgba(0,212,255,.2);
  --shadow: rgba(0,0,0,.5);
}


/* ============================================
   OVERLAY — ЖИВОЙ ФОН
   display:none — jQuery fadeIn/fadeOut сам управляет
============================================ */
#publOverlay{
  position:fixed;
  inset:0;
  background:
    radial-gradient(circle at 20% 30%, rgba(102,126,234,.35), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(118,75,162,.35), transparent 50%),
    rgba(10,12,20,.65);
  display:none;  /* ← ВАЖНО: jQuery сам переключит */
  z-index:999999;
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
}

#publOverlay::before{
  content:'';
  position:absolute;
  inset:-50%;
  background:
    radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,.6), transparent),
    radial-gradient(2px 2px at 60% 70%, rgba(255,255,255,.4), transparent),
    radial-gradient(1px 1px at 50% 50%, rgba(255,255,255,.5), transparent),
    radial-gradient(1px 1px at 80% 10%, rgba(255,255,255,.3), transparent);
  background-size: 200px 200px;
  animation: stars 60s linear infinite;
  opacity:.4;
}

@keyframes stars{
  from{ transform: translate(0,0); }
  to{ transform: translate(-200px,-200px); }
}


  #publModal{
  position:fixed !important;
  left:auto !important;
  top:auto !important;
  right:20px !important;
  bottom:20px !important;
  transform-origin: right bottom;

  width:460px;
  max-height:92vh;

  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);

  border-radius:24px;
  display:flex;
  flex-direction:column;
  overflow:hidden;

  transform: scale(.2) rotate(15deg);
  opacity: 0;
  visibility: hidden;
  filter: blur(20px);
  pointer-events: none;

  transition:
    transform .9s var(--spring),
    opacity .6s ease-out,
    visibility .6s,
    filter .8s ease-out,
    pointer-events 0s linear .6s;

  will-change: transform, opacity, filter;

  border: 1px solid transparent;
  background-clip: padding-box;
  position:relative;

  box-shadow:
    0 30px 80px rgba(0,0,0,.35),
    0 10px 30px rgba(102,126,234,.25),
    inset 0 1px 0 rgba(255,255,255,.5);

  color: var(--text-main);
  cursor: default;
  z-index: 999999;
}

#publModal.is-open{
  transform: scale(1) rotate(0deg);
  opacity: 1;
  visibility: visible;
  filter: blur(0);
  pointer-events: auto;
}


  /* Анимированная градиентная рамка */
  #publModal::before{
  content:'';
  position:absolute;
  inset:-2px;
  border-radius:26px;
  padding:2px;
  background: linear-gradient(
    135deg,
    var(--primary-1),
    var(--accent),
    var(--primary-2),
    var(--primary-1)
  );
  background-size: 300% 300%;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderFlow 6s linear infinite;
  pointer-events:none;
  z-index:-1;
}

@keyframes borderFlow{
  0%{ background-position: 0% 50%; }
  50%{ background-position: 100% 50%; }
  100%{ background-position: 0% 50%; }
}

/* Декоративные блики */
#publModal::after{
  content:'';
  position:absolute;
  top:-50%;
  left:-50%;
  width:200%;
  height:200%;
  background:
    radial-gradient(circle at 30% 20%, rgba(0,212,255,.08), transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(118,75,162,.08), transparent 40%);
  pointer-events:none;
  animation: shineMove 8s ease-in-out infinite;
}

@keyframes shineMove{
  0%,100%{ transform: translate(0,0); }
  50%{ transform: translate(10px,-10px); }
}


/* ============================================
   HEADER — С АВАТАРКОЙ И АНИМАЦИЕЙ
============================================ */
.publHeader{
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color:#fff;

  padding:18px 20px;

  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:0px;

  position:relative;
  overflow:hidden;

  cursor: move; /* для drag */
}

/* Анимированные волны на фоне */
.publHeader::before{
  content:'';
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 20% 50%, rgba(255,255,255,.15), transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(0,212,255,.2), transparent 50%);
  animation: headerShine 4s ease-in-out infinite;
}

@keyframes headerShine{
  0%,100%{ opacity:.6; transform: translateX(0); }
  50%{ opacity:1; transform: translateX(10px); }
}

/* Левая часть с аватаркой */
.headerLeft{
  display:flex;
  align-items:center;
  gap:12px;
  z-index:2;
}

/* Аватарка с пульсацией */
.headerAvatar{
  width:42px;
  height:42px;
  border-radius:50%;
  background: linear-gradient(135deg, #fff, #e0e7ff);
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  box-shadow:
    0 0 0 3px rgba(255,255,255,.3),
    0 4px 12px rgba(0,0,0,.2);
  animation: avatarPulse 2.5s ease-in-out infinite;
  position:relative;
}

@keyframes avatarPulse{
  0%,100%{ box-shadow: 0 0 0 3px rgba(255,255,255,.3), 0 4px 12px rgba(0,0,0,.2); }
  50%{ box-shadow: 0 0 0 6px rgba(255,255,255,.15), 0 4px 18px rgba(0,0,0,.25); }
}

/* Статус-индикатор онлайн */
.headerAvatar::after{
  content:'';
  position:absolute;
  bottom:2px;
  right:2px;
  width:6px;
  height:6px;
  border-radius:50%;
  background: var(--success);
  border:2px solid #fff;
  box-shadow: 0 0 8px var(--success);
  animation: statusBlink 2s ease-in-out infinite;
}

@keyframes statusBlink{
  0%,100%{ opacity:1; }
  50%{ opacity:.5; }
}

.headerInfo{
  display:flex;
  flex-direction:column;
  gap:2px;
}

.headerTitle{
  font-weight:700;
  font-size:15px;
  letter-spacing:.3px;
  display:flex;
  align-items:center;
  gap:6px;
}

/* Typing dots */
.typingDots{
  display:inline-flex;
  gap:2px;
}

.typingDots span{
  width:4px;
  height:4px;
  border-radius:50%;
  background:#fff;
  animation: typing 1.4s ease-in-out infinite;
}

.typingDots span:nth-child(2){ animation-delay:.2s; }
.typingDots span:nth-child(3){ animation-delay:.4s; }

@keyframes typing{
  0%,60%,100%{ transform: translateY(0); opacity:.4; }
  30%{ transform: translateY(-4px); opacity:1; }
}


.headerSubtitle{
  font-size:11px;
  opacity:.85;
  font-weight:400;
  display:flex;
  align-items:center;
  gap:4px;
}

.headerSubtitle::before{
  content:'';
  font-size:10px;
}


/* ============================================
   CLOSE BUTTON — ULTRA
============================================ */
#closePubl{
  width:32px;
  height:32px;
  border-radius:50%;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.2);
  color:#fff;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: all .3s var(--spring);
  z-index:2;
  position:relative;
  overflow:hidden;
}

#closePubl::before{
  content:'';
  position:absolute;
  inset:0;
  background: linear-gradient(135deg, var(--error), #ff8a80);
  opacity:0;
  transition: opacity .3s;
}

#closePubl:hover{
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 0 20px rgba(255,82,82,.5);
}

#closePubl:hover::before{ opacity:1; }

#closePubl svg{
  width:14px;
  height:14px;
  position:relative;
  z-index:1;
  transition: transform .3s;
}


/* ============================================
   BODY — ФОРМА
============================================ */
.publBody{
  padding:20px;
  display:flex;
  flex-direction:column;
  gap:14px;
  overflow-y:auto;
  flex:1;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-1) transparent;
}

.publBody::-webkit-scrollbar{ width:6px; }
.publBody::-webkit-scrollbar-track{ background: transparent; }
.publBody::-webkit-scrollbar-thumb{
  background: linear-gradient(var(--primary-1), var(--primary-2));
  border-radius:10px;
}


/* ============================================
   FIELD — FLOATING LABELS 2.0
============================================ */
.field{
  position:relative;
  margin-bottom:4px;
}

.field input,
.field textarea,
.field select{
  width:100%;
  padding:14px 14px 14px 44px;
  border-radius:14px;
  border: 1.5px solid var(--border);
  font-size:13px;
  background: var(--bg-input);
  transition: all .3s var(--smooth);
  font-family:inherit;
  color: var(--text-main);
  outline:none;
}

.field textarea{
  min-height:140px;
  resize:vertical;
  padding-left:14px;
  line-height:1.5;
}

/* Иконка слева */
.fieldIcon{
  position:absolute;
  left:14px;
  top:50%;
  transform: translateY(-50%);
  font-size:16px;
  color: var(--text-muted);
  pointer-events:none;
  transition: all .3s var(--spring);
  z-index:2;
}

/* Hover */
.field input:hover,
.field textarea:hover,
.field select:hover{
  border-color: var(--primary-1);
  background: var(--bg-hover);
}

/* Focus — GLOW эффект */
.field input:focus,
.field textarea:focus,
.field select:focus{
  border-color: var(--primary-1);
  background: #fff;
  box-shadow:
    0 0 0 4px rgba(102,126,234,.15),
    0 8px 24px rgba(102,126,234,.2);
  transform: translateY(-1px);
}

.field input:focus ~ .fieldIcon,
.field textarea:focus ~ .fieldIcon{
  color: var(--primary-1);
  transform: translateY(-50%) scale(1.15) rotate(-8deg);
}


/* Float label */
.field label{
  position:absolute;
  left:44px;
  top:50%;
  transform: translateY(-50%);
  font-size:13px;
  color: var(--text-muted);
  pointer-events:none;
  transition: all .25s var(--smooth);
  background: transparent;
  padding:0 4px;
  z-index:1;
}

.field textarea ~ label{
  top:18px;
  transform: none;
  left:14px;
}

/* Active label — поднимается вверх */
.field input:focus ~ label,
.field input:not(:placeholder-shown) ~ label{
  top:0;
  left:10px;
  font-size:11px;
  font-weight:600;
  color: var(--primary-1);
  background: var(--bg-input);
  border-radius:4px;
  padding:2px 6px;
  letter-spacing:.3px;
  transform: translateY(-50%);
}

.field textarea:focus ~ label,
.field textarea:not(:placeholder-shown) ~ label{
  top:0;
  left:10px;
  font-size:11px;
  font-weight:600;
  color: var(--primary-1);
  background: var(--bg-input);
  border-radius:4px;
  padding:2px 6px;
}


/* ============================================
   СЧЁТЧИК СИМВОЛОВ
============================================ */
  .charCounter{
  position:absolute;
  right:14px;
  bottom:10px;
  font-size:11px;
  color: var(--text-muted);
  font-weight:600;
  pointer-events:none;
  transition: all .3s;
  background: var(--bg-input);
  padding:2px 8px;
  border-radius:10px;
}

.charCounter.warning{ color: var(--warning); }
.charCounter.danger{
  color: var(--error);
  animation: shake .4s;
}

@keyframes shake{
  0%,100%{ transform: translateX(0); }
  25%{ transform: translateX(-3px); }
  75%{ transform: translateX(3px); }
}

/* Прогресс-бар под textarea */
.charProgress{
  height:3px;
  background: rgba(102,126,234,.1);
  border-radius:10px;
  margin-top:6px;
  overflow:hidden;
}

.charProgressFill{
  height:100%;
  background: linear-gradient(90deg, var(--success), var(--primary-1), var(--error));
  background-size: 200% 100%;
  border-radius:10px;
  transition: width .3s var(--smooth);
  width:0%;
}


/* ============================================
   OPTIONS — PILL С RIPPLE
============================================ */
.publOptions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:4px 0;
}

.opt{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:8px 16px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  border-radius:50px;
  cursor:pointer;
  font-size:12px;
  font-weight:500;
  color: var(--text-main);
  transition: all .25s var(--spring);
  user-select:none;
  overflow:hidden;
}

.opt input{ display:none; }

/* Ripple эффект */
.opt::before{
  content:'';
  position:absolute;
  top:50%;
  left:50%;
  width:0;
  height:0;
  border-radius:50%;
  background: radial-gradient(circle, var(--primary-1), transparent);
  transform: translate(-50%,-50%);
  transition: width .5s, height .5s;
  opacity:0;
}

.opt:hover{
  border-color: var(--primary-1);
  background: var(--bg-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(102,126,234,.15);
}

.opt:active::before{
  width:200px;
  height:200px;
  opacity:.3;
}

/* Active state */
.opt.active{
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color:#fff;
  border-color: transparent;
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    0 8px 20px rgba(102,126,234,.35),
    inset 0 1px 0 rgba(255,255,255,.3);
}

.opt.active:hover{
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 12px 28px rgba(102,126,234,.45),
    inset 0 1px 0 rgba(255,255,255,.4);
}

/* Галочка в активном */
.opt.active::after{
  content:'✓';
  margin-left:4px;
  font-weight:700;
  animation: checkPop .4s var(--spring);
}

@keyframes checkPop{
  0%{ transform: scale(0) rotate(-180deg); }
  100%{ transform: scale(1) rotate(0); }
}


/* ============================================
   NOTIFY OPTION
============================================ */
.notifyOpt{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 14px;
  border-radius:50px;
  background: var(--bg-input);
  border: 1.5px solid var(--border);
  cursor:pointer;
  transition: all .2s ease;
  user-select:none;
  font-size:12px;
  font-weight:500;
  color: var(--text-main);
}

.notifyOpt:hover{
  background: var(--bg-hover);
  border-color: var(--primary-1);
  transform: scale(0.99) translateY(1px);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.08);
}

.notifyOpt:active{
  transform: scale(0.97) translateY(2px);
  box-shadow: inset 0 2px 5px rgba(0,0,0,.15);
}

.notifyOpt.active{
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color:#fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(102,126,234,.25);
}

.notifyOpt.active:hover{
  transform: scale(0.99) translateY(1px);
  box-shadow: 0 2px 8px rgba(102,126,234,.2), inset 0 1px 3px rgba(0,0,0,.1);
}

.notifyOpt.active:active{
  transform: scale(0.97) translateY(2px);
  box-shadow: 0 1px 4px rgba(102,126,234,.15), inset 0 2px 5px rgba(0,0,0,.2);
}

.notifyOpt .bell{
  font-size:15px;
  transition: transform .2s ease;
}

.notifyOpt:active .bell{
  transform: translateX(1px);
}

.notifyOpt.active .bell{
  animation: bellRing .6s ease-in-out infinite;
  filter: drop-shadow(0 0 6px gold);
}

@keyframes bellRing{
  0%,100%{ transform: rotate(0); }
  25%{ transform: rotate(-15deg); }
  75%{ transform: rotate(15deg); }
}


/* ============================================
   BB-PANEL — С ИКОНКАМИ
============================================ */
.bbWrap{
  display:flex;
  flex-direction:column;
  gap:8px;
  width:100%;
}

  .bbPanel{
  display:flex;
  flex-wrap:wrap;
  gap:4px;
  padding:8px;
  background: linear-gradient(135deg, rgba(102,126,234,.05), rgba(118,75,162,.05));
  border: 0px solid var(--border);
  border-radius:50px;
  order:-1;
}

  .bbPanel button{
  width:32px;
  height:32px;
  border:none;
  background: #fff;
  border-radius:9px;
  cursor:pointer;
  font-size:13px;
  font-weight:700;
  color: var(--primary-1);
  transition: all .2s var(--spring);
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  overflow:hidden;
}

.bbPanel button:hover{
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color:#fff;
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 6px 14px rgba(102,126,234,.3);
}

.bbPanel button:active{
  transform: scale(.92);
}

/* Tooltip */
.bbPanel button::after{
  content: attr(data-tip);
  position:absolute;
  bottom:calc(100% + 6px);
  left:50%;
  transform: translateX(-50%) translateY(4px);
  background: rgba(20,22,34,.95);
  color:#fff;
  padding:4px 8px;
  border-radius:6px;
  font-size:10px;
  font-weight:500;
  white-space:nowrap;
  opacity:0;
  pointer-events:none;
  transition: all .2s;
}

.bbPanel button:hover::after{
  opacity:1;
  transform: translateX(-50%) translateY(0);
}

.bbEditor{
  flex:1;
  width:100%;
}


/* ============================================
   EMOJI PICKER — МИНИМАЛИЗМ
============================================ */

#emojiToggle{
  width:36px;
  height:36px;
  border:none;
  border-radius:50%;
  background: transparent;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  transition: filter .2s ease;
  box-shadow: none;
  position:relative;
  padding:0;
}

#emojiToggle:hover{
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.15));
}

#emojiToggle:active{
  filter: drop-shadow(0 1px 3px rgba(0,0,0,.1));
}


#emojiPopup{
  position:absolute;
  right:0;
  bottom:46px;
  width:280px;
  padding:14px;
  display:none;
  flex-direction:column;
  gap:10px;
  border-radius:18px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  z-index:100;
  animation: popupIn .3s var(--spring);
}

#emojiPopup.active{ display:flex; }

@keyframes popupIn{
  from{ opacity:0; transform: translateY(10px) scale(.9); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}

/* Категории */
.emojiCategories{
  display:flex;
  gap:4px;
  padding-bottom:8px;
  border-bottom: 1px solid var(--border);
}

.emojiCat{
  flex:1;
  padding:6px;
  border:none;
  background: transparent;
  border-radius:8px;
  cursor:pointer;
  font-size:16px;
  transition: all .2s;
}

.emojiCat:hover{ background: var(--bg-hover); }
.emojiCat.active{
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  transform: scale(1.1);
}

.emojiGrid{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap:4px;
  max-height:200px;
  overflow-y:auto;
}

.emojiItem{
  aspect-ratio:1;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  cursor:pointer;
  font-size:20px;
  transition: background .2s ease;
}

.emojiItem:hover{
  background: var(--bg-hover);
}

.emojiItem:active{
  background: var(--bg-hover);
}
/* ============================================
   CALENDAR POPUP
============================================ */
.dateWrap{ position:relative; }

.calendarIcon{
  position:absolute;
  right:12px;
  top:50%;
  transform:translateY(-50%);
  font-size:18px;
  color: var(--primary-1);
  cursor:pointer;
  transition: all .3s var(--spring);
  z-index:2;
}

.calendarIcon:hover{
  transform: translateY(-50%) scale(1.2) rotate(10deg);
  filter: drop-shadow(0 4px 8px rgba(102,126,234,.4));
}

.calendarPopup{
  position:absolute;
  top:calc(100% + 8px);
  right:0;
  width:280px;
  padding:16px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border);
  border-radius:18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display:none;
  z-index:9999;
  animation: popupIn .3s var(--spring);
}

.calendarPopup.active{ display:block; }

.calHeader{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:12px;
  font-weight:700;
  color: var(--primary-1);
  font-size:14px;
}

.calNav{
  width:28px;
  height:28px;
  border:none;
  background: var(--bg-hover);
  border-radius:50%;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  transition: all .2s;
  color: var(--primary-1);
}

.calNav:hover{
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color:#fff;
  transform: scale(1.1);
}

.calGrid{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap:4px;
}

.calDay{
  aspect-ratio:1;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:8px;
  cursor:pointer;
  font-size:12px;
  font-weight:500;
  transition: all .2s;
  color: var(--text-main);
}

.calDay:hover{
  background: var(--bg-hover);
  transform: scale(1.1);
}

.calDay.active{
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color:#fff;
  box-shadow: 0 4px 12px rgba(102,126,234,.4);
}

.calDay.today{
  border: 2px solid var(--accent);
}


/* ============================================
   SEND BUTTON — ULTRA
============================================ */
.publishActions{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-top:8px;
  padding-top:16px;
  border-top: 1px solid var(--border);
}

#p_send{
  position:relative;
  padding:12px 28px;
  border:none;
  border-radius:50px;
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color:#fff;
  font-weight:700;
  cursor:pointer;
  font-size:13px;
  letter-spacing:.5px;
  display:inline-flex;
  align-items:center;
  gap:8px;
  overflow:hidden;
  transition: all .3s var(--spring);
  box-shadow:
    0 8px 20px rgba(102,126,234,.35),
    inset 0 1px 0 rgba(255,255,255,.3);
}

/* Shimmer */
#p_send::before{
  content:'';
  position:absolute;
  top:0;
  left:-100%;
  width:100%;
  height:100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,.3),
    transparent
  );
  animation: shimmer 3s infinite;
}

@keyframes shimmer{
  0%{ left:-100%; }
  100%{ left:100%; }
}

#p_send:hover{
  transform: scale(0.99) translateY(2px);
  box-shadow:
    0 3px 10px rgba(102,126,234,.2),
    inset 0 1px 3px rgba(0,0,0,.1);
}

#p_send:active{
  transform: scale(0.96) translateY(2px);
  box-shadow:
    0 1px 4px rgba(102,126,234,.1),
    inset 0 2px 5px rgba(0,0,0,.2);
}

#p_send .sendIcon{
  transition: transform .2s ease;
}

#p_send:hover .sendIcon{
  transform: translateX(2px);
}

#p_send:active .sendIcon{
  transform: translateX(3px);
}

/* Loading state */
#p_send.loading{
  pointer-events:none;
  background: linear-gradient(135deg, var(--text-muted), var(--text-muted));
}


#p_send.loading::after{
  content:'';
  width:14px;
  height:14px;
  border:2px solid rgba(255,255,255,.3);
  border-top-color:#fff;
  border-radius:50%;
  animation: spin .8s linear infinite;
}

@keyframes spin{
  to{ transform: rotate(360deg); }
}

/* Success state */
#p_send.success{
  background: linear-gradient(135deg, var(--success), #00c853);
  animation: successPulse .6s;
}

@keyframes successPulse{
  0%,100%{ transform: scale(1); }
  50%{ transform: scale(1.1); }
}


/* ============================================
  ПРОГРЕСС ОТПРАВКИ
============================================ */
.sendProgress{
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  height:3px;
  background: rgba(255,255,255,.2);
  overflow:hidden;
  opacity:0;
  transition: opacity .3s;
}

.sendProgress.active{ opacity:1; }

.sendProgressFill{
  height:100%;
  background: linear-gradient(90deg, var(--accent), #fff);
  width:0%;
  transition: width .3s;
  box-shadow: 0 0 10px var(--accent);
}


/* ============================================
  STATUS С АНИМАЦИЯМИ
============================================ */
#p_status{
  text-align:center;
  font-weight:600;
  min-height:20px;
  font-size:12px;
  margin-top:4px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  transition: all .3s;
}

#p_status.error{
  color: var(--error);
  animation: slideIn .4s var(--spring);
}

#p_status.success{
  color: var(--success);
  animation: slideIn .4s var(--spring);
}

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


/* ============================================
   ПЕРЕКЛЮЧАТЕЛЬ ТЕМЫ
============================================ */
.themeToggle{
  width:32px;
  height:32px;
  border-radius:50%;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:14px;
  transition: all .3s var(--spring);
  z-index:2;
  margin-left: auto;   /* ← ДОБАВИТЬ: прижимает к правому краю */
  margin-right: 10px;   /* ← маленькое расстояние от крестика */
}

.themeToggle:hover{
  transform: rotate(180deg) scale(1.1);
  background: rgba(255,255,255,.25);
}


/* ============================================
  ДОПОЛНИТЕЛЬНЫЕ АНИМАЦИИ
============================================ */
@keyframes fadeInUp{
  from{ opacity:0; transform: translateY(20px); }
  to{ opacity:1; transform: translateY(0); }
}


/* ============================================
  RESPONSIVE
============================================ */
@media (max-width: 500px){
  #publModal{
    width:calc(100vw - 20px);
    right:10px;
    bottom:10px;
    max-height:95vh;
  }
}


/* ============================================
  УТИЛИТЫ
============================================ */
.glow-text{
  background: linear-gradient(135deg, var(--primary-1), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight:700;
}

/* Skeleton loader */
.skeleton{
  background: linear-gradient(
    90deg,
    var(--bg-input) 0%,
    var(--bg-hover) 50%,
    var(--bg-input) 100%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius:8px;
}

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


/* ============================================
  ТЁМНАЯ ТЕМА — ПРАВИЛА ДЛЯ ЭЛЕМЕНТОВ
============================================ */
[data-theme="dark"] #publModal{
  background: rgba(20,22,34,.98) !important;
  box-shadow:
    0 30px 80px rgba(0,0,0,.6) !important,
    0 10px 30px rgba(0,212,255,.15) !important,
    inset 0 1px 0 rgba(255,255,255,.05) !important;
}

[data-theme="dark"] .publBody{
  scrollbar-color: var(--accent) transparent !important;
}

[data-theme="dark"] .field input,
[data-theme="dark"] .field textarea,
[data-theme="dark"] .field select{
  background: var(--bg-input) !important;
  color: var(--text-main) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .field input:hover,
[data-theme="dark"] .field textarea:hover,
[data-theme="dark"] .field select:hover{
  background: var(--bg-hover) !important;
}

[data-theme="dark"] .field input:focus,
[data-theme="dark"] .field textarea:focus,
[data-theme="dark"] .field select:focus{
  background: rgba(40,44,60,.95) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .field label{
  color: var(--text-muted) !important;
}

[data-theme="dark"] .fieldIcon{
  color: var(--text-muted) !important;
}

[data-theme="dark"] .opt:not(.active),
[data-theme="dark"] .notifyOpt:not(.active){
  background: var(--bg-input) !important;
  color: var(--text-main) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .opt:not(.active):hover,
[data-theme="dark"] .notifyOpt:not(.active):hover{
  background: var(--bg-hover) !important;
}

[data-theme="dark"] .bbPanel{
  background: rgba(30,33,48,.5) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .bbPanel button{
  background: rgba(40,44,60,.8) !important;
  color: var(--accent) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .bbPanel button:hover{
  color:#fff !important;
}

[data-theme="dark"] #emojiPopup,
[data-theme="dark"] .emojiPopupAlt,
[data-theme="dark"] .calendarPopup{
  background: rgba(20,22,34,.98) !important;
  border-color: var(--border) !important;
}

[data-theme="dark"] .emojiItem:hover{
  background: var(--bg-hover) !important;
}

[data-theme="dark"] .charCounter{
  background: var(--bg-input) !important;
  color: var(--text-muted) !important;
}

[data-theme="dark"] .charProgress{
  background: rgba(0,212,255,.1) !important;
}

[data-theme="dark"] #p_status{
  color: var(--text-main) !important;
}

[data-theme="dark"] .miniBtn{
  background: rgba(40,44,60,.8) !important;
  color: var(--text-main) !important;
}

[data-theme="dark"] .miniBtn:hover{
  background: rgba(60,64,80,.9) !important;
}

[data-theme="dark"] .headerSubtitle{
  color: rgba(255,255,255,.7) !important;
}

[data-theme="dark"] .typingDots span{
  background: rgba(255,255,255,.8) !important;
}

/* Плавное переключение темы */
#publModal .field input,
#publModal .field textarea,
#publModal .field select,
#publModal .opt,
#publModal .notifyOpt,
#publModal .bbPanel button,
#publModal .miniBtn,
#publModal .charCounter{
  transition: background-color .3s, color .3s, border-color .3s;
}


/* ============================================
  EMOJI — ПРИВЯЗКА К bbEditor
============================================ */
.bbEditor{
  position:relative;
  flex:1;
  width:100%;
}

.emojiWrap{
  position:absolute;
  right:5px;
  bottom:20px;
  z-index:50;
}

.fullTextEditor{
  position:relative;
}


/* ============================================
  RESPONSIVE — ИСПРАВЛЕНИЕ ПОЗИЦИИ
============================================ */
@media (max-width: 500px){
  #publModal{
    width:calc(100vw - 20px);
    right:10px !important;
    bottom:10px !important;
    left:auto !important;
    top:auto !important;
    max-height:95vh;
  }
}


/* ============================================
   КНОПКА "ДОБАВИТЬ ПОЛНЫЙ ТЕКСТ"
============================================ */
.miniBtn{
  position:relative;
  width:100%;
  padding:4px 12px;
  border:none;
  border-radius:100px;
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2));
  color:#fff;
  font-weight:600;
  font-size:12px;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  overflow:hidden;
  transition: all .3s var(--spring);
  box-shadow:
    0 4px 12px rgba(102,126,234,.25),
    inset 0 1px 0 rgba(255,255,255,.2);
  margin-top: -8px;  /* поднимает кнопку выше */
}


/* Shimmer эффект */
.miniBtn::after{
  content:'';
  position:absolute;
  top:0;
  left:-100%;
  width:100%;
  height:100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,.3),
    transparent
  );
  transition: left .6s;
}

.miniBtn:hover::after{
  left:100%;
}

.miniBtn:hover{
  transform: translateY(0px);
  box-shadow:
    0 6px 16px rgba(102,126,234,.35),
    inset 0 1px 0 rgba(255,255,255,.3);
}

.miniBtn:active{
  transform: translateY(0) scale(.99);
}

/* Иконка */
.miniBtn .btnIcon{
  font-size:14px;
  transition: transform .4s var(--spring);
  display:inline-block;
  margin-left:8px;
}

.miniBtn.active .btnIcon{
  transform: rotate(180deg);
}

/* Текст */
.miniBtn .btnText{
  transition: opacity .3s;
}

/* Тёмная тема */
[data-theme="dark"] .miniBtn{
  background: linear-gradient(135deg, var(--primary-1), var(--primary-2)) !important;
  box-shadow:
    0 4px 12px rgba(0,212,255,.2),
    inset 0 1px 0 rgba(255,255,255,.1) !important;
}

[data-theme="dark"] .miniBtn:hover{
  box-shadow:
    0 6px 16px rgba(0,212,255,.3),
    inset 0 1px 0 rgba(255,255,255,.2) !important;
}


.emojiGrid{
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.emojiItem{
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  font-size: 20px;
  transition: background 0.2s ease, transform 0.1s ease;
  user-select: none;
}

.emojiItem:hover{
  background: var(--bg-hover);
  transform: scale(1.1);
}

.emojiItem:active{
  transform: scale(0.95);
}


/* Специальное правило для поля даты — label ближе к левому краю */
.dateWrap label{
  left: 24px !important;
}

/* Когда label поднимается вверх (активное состояние) */
.dateWrap input:focus + label,
.dateWrap input:not(:placeholder-shown) + label{
  left: 24px !important;
}