/* =====================================================
   ADMIN LOGIN
   ===================================================== */

.admin-login-modal {
  position: fixed;
  inset: 0;

  display: none;

  justify-content: center;
  align-items: center;

  background: rgba(0, 0, 0, 0.72);

  backdrop-filter: blur(12px);

  z-index: 9999;

  opacity: 0;

  transition: opacity 0.3s ease;
}


.admin-login-modal.active {
  display: flex;

  opacity: 1;
}


/* =====================================================
   ADMIN LOGIN CONTENT
   ===================================================== */

.admin-login-content {
  width: min(380px, calc(100% - 30px));

  background:
    linear-gradient(
      180deg,
      #191919 0%,
      #141414 100%
    );

  border: 1px solid
    rgba(199, 164, 106, 0.3);

  border-radius: 18px;

  padding: 32px;

  position: relative;

  display: flex;

  flex-direction: column;

  gap: 18px;

  box-shadow:
    0 25px 70px rgba(0, 0, 0, 0.55);

  animation:
    adminModalShow 0.35s ease;
}


@keyframes adminModalShow {

  from {
    opacity: 0;

    transform:
      translateY(20px)
      scale(0.97);
  }

  to {
    opacity: 1;

    transform:
      translateY(0)
      scale(1);
  }

}


.admin-login-content h2 {
  color: #f3f1ee;

  text-align: center;

  font-size: 30px;

  font-weight: 500;

  margin: 0 0 5px;
}


/* =====================================================
   ADMIN LOGIN INPUTS
   ===================================================== */

.admin-login-content input {
  width: 100%;

  height: 48px;

  border: 1px solid #333;

  border-radius: 10px;

  padding: 0 15px;

  background: #1d1d1d;

  color: #f3f1ee;

  font-family:
    "Cormorant Garamond",
    serif;

  font-size: 17px;

  outline: none;

  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}


.admin-login-content input::placeholder {
  color: #707070;
}


.admin-login-content input:focus {
  border-color: #c7a46a;

  background: #202020;

  box-shadow:
    0 0 0 3px
    rgba(199, 164, 106, 0.08);
}


/* =====================================================
   ADMIN LOGIN BUTTON
   ===================================================== */

.admin-login-content button:not(.admin-close-btn) {
  height: 48px;

  border: 1px solid #c7a46a;

  border-radius: 10px;

  background: transparent;

  color: #c7a46a;

  font-family:
    "Cormorant Garamond",
    serif;

  font-size: 17px;

  cursor: pointer;

  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.2s ease;
}


.admin-login-content button:not(.admin-close-btn):hover {
  background: #c7a46a;

  color: #141414;

  transform: translateY(-2px);
}


/* =====================================================
   CLOSE ADMIN LOGIN
   ===================================================== */

.admin-close-btn {
  position: absolute;

  right: 15px;

  top: 12px;

  width: 38px !important;

  height: 38px !important;

  padding: 0;

  background: transparent !important;

  border: none !important;

  color: #999;

  font-size: 27px;

  cursor: pointer;

  display: flex;

  justify-content: center;

  align-items: center;

  transition:
    color 0.25s ease,
    transform 0.25s ease;
}


.admin-close-btn:hover {
  color: #c7a46a;

  transform: rotate(90deg);
}


/* =====================================================
   EDIT BUTTON
   ===================================================== */

.edit-button {
  position: absolute;

  top: 20px;

  right: 20px;

  width: 42px;

  height: 42px;

  border-radius: 50%;

  border: 1px solid
    rgba(199, 164, 106, 0.45);

  display: flex;

  justify-content: center;

  align-items: center;

  cursor: pointer;

  font-size: 18px;

  background:
    rgba(20, 20, 20, 0.82);

  backdrop-filter: blur(8px);

  color: #c7a46a;

  opacity: 0;

  transition:
    opacity 0.25s ease,
    transform 0.25s ease,
    background 0.25s ease,
    color 0.25s ease;
}


.section1 .edit-button {
  top: 200px;
}


.admin-mode [data-edit]:hover .edit-button {
  opacity: 1;
}


.admin-mode .edit-button {
  display: flex;

  align-items: center;

  justify-content: center;
}


.admin-mode .edit-button:hover {
  background: #c7a46a;

  color: #141414;

  transform: scale(1.08);
}


/* =====================================================
   EDITOR PANEL
   ===================================================== */

.editor-panel {
  position: fixed;

  top: 0;

  right: -420px;

  width: min(400px, 100vw);

  height: 100dvh;

  background:
    linear-gradient(
      180deg,
      #191919 0%,
      #141414 100%
    );

  border-left:
    1px solid
    rgba(199, 164, 106, 0.22);

  box-shadow:
    -20px 0 60px
    rgba(0, 0, 0, 0.5);

  transition:
    right 0.4s
    cubic-bezier(
      0.22,
      1,
      0.36,
      1
    );

  z-index: 99999;

  display: flex;

  flex-direction: column;

  overflow: hidden;
}


.editor-panel.active {
  right: 0;
}


/* =====================================================
   EDITOR HEADER
   ===================================================== */

.editor-header {
  flex-shrink: 0;

  min-height: 70px;

  padding: 18px 22px;

  display: flex;

  justify-content: space-between;

  align-items: center;

  color: #f3f1ee;

  background:
    rgba(23, 23, 23, 0.92);

  border-bottom:
    1px solid
    rgba(255, 255, 255, 0.07);

  backdrop-filter: blur(12px);
}


.editor-header h2,
.editor-header h3 {
  margin: 0;

  color: #f3f1ee;

  font-size: 25px;

  font-weight: 500;

  letter-spacing: 0.3px;
}


.editor-header button {
  width: 38px;

  height: 38px;

  display: flex;

  justify-content: center;

  align-items: center;

  padding: 0;

  background: transparent;

  border: none;

  border-radius: 50%;

  color: #999;

  font-size: 23px;

  cursor: pointer;

  transition:
    color 0.25s ease,
    background 0.25s ease,
    transform 0.25s ease;
}


.editor-header button:hover {
  color: #c7a46a;

  background:
    rgba(199, 164, 106, 0.08);

  transform: rotate(90deg);
}


/* =====================================================
   EDITOR BODY
   ===================================================== */

.editor-body {
  flex: 1;

  min-height: 0;

  padding: 24px 22px 30px;

  display: flex;

  flex-direction: column;

  gap: 18px;

  overflow-y: auto;

  color: #f3f1ee;

  scrollbar-width: thin;

  scrollbar-color:
    rgba(199, 164, 106, 0.45)
    transparent;
}


/* =====================================================
   EDITOR SCROLLBAR
   ===================================================== */

.editor-body::-webkit-scrollbar {
  width: 4px;
}


.editor-body::-webkit-scrollbar-track {
  background: transparent;
}


.editor-body::-webkit-scrollbar-thumb {
  background:
    rgba(199, 164, 106, 0.45);

  border-radius: 20px;
}


.editor-body::-webkit-scrollbar-thumb:hover {
  background: #c7a46a;
}


/* =====================================================
   EDITOR LABELS
   ===================================================== */

.editor-body label {
  display: block;

  margin-bottom: -9px;

  color: #c7c1b9;

  font-family:
    "Cormorant Garamond",
    serif;

  font-size: 16px;

  letter-spacing: 0.2px;
}


/* =====================================================
   EDITOR INPUTS
   ===================================================== */

.editor-body input,
.editor-body textarea {
  width: 100%;

  padding: 13px 14px;

  background: #1d1d1d;

  border: 1px solid #3a3a3a;

  border-radius: 12px;

  color: #f3f1ee;

  font-family:
    "Cormorant Garamond",
    serif;

  font-size: 17px;

  line-height: 1.4;

  outline: none;

  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    box-shadow 0.25s ease;
}


.editor-body textarea {
  min-height: 120px;

  resize: vertical;
}


.editor-body input::placeholder,
.editor-body textarea::placeholder {
  color: #707070;
}


.editor-body input:hover,
.editor-body textarea:hover {
  border-color: #555;
}


.editor-body input:focus,
.editor-body textarea:focus {
  border-color: #c7a46a;

  background: #202020;

  box-shadow:
    0 0 0 3px
    rgba(199, 164, 106, 0.07);
}


/* =====================================================
   EDITOR BUTTONS
   ===================================================== */

.editor-body button {
  font-family:
    "Cormorant Garamond",
    serif;
}


.editor-body
button:not(.delete-message):not(.drag-handle) {
  min-height: 44px;

  padding: 9px 17px;

  border:
    1px solid
    rgba(199, 164, 106, 0.55);

  border-radius: 10px;

  background: transparent;

  color: #c7a46a;

  font-size: 17px;

  cursor: pointer;

  transition:
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease,
    transform 0.2s ease;
}


.editor-body
button:not(.delete-message):not(.drag-handle):hover {
  background: #c7a46a;

  border-color: #c7a46a;

  color: #141414;

  transform: translateY(-1px);
}


.editor-body
button:not(.delete-message):not(.drag-handle):active {
  transform: translateY(0);
}


/* =====================================================
   SAVE / BACK BUTTONS
   ===================================================== */

#saveContacts,
#backContacts,
#saveHero {
  min-height: 48px;

  background: #141414;

  border:
    1px solid
    #9e8462;

  color: #c7a46a;

  font-size:
    clamp(
      16px,
      1.2vw,
      20px
    );

  padding: 10px 18px;

  border-radius: 12px;

  cursor: pointer;

  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.2s ease;
}


#saveContacts:hover,
#backContacts:hover,
#saveHero:hover {
  background: #c7a46a;

  color: #141414;

  transform: translateY(-2px);
}


/* =====================================================
   SERVICE ADMIN ITEMS
   ===================================================== */

.service-admin-item {
  display: flex;

  justify-content: space-between;

  align-items: center;

  padding: 13px 0;

  border-bottom:
    1px solid
    rgba(255, 255, 255, 0.08);

  transition:
    transform 0.2s ease,
    opacity 0.2s ease;
}


.service-admin-item button {
  margin-left: 10px;

  cursor: pointer;
}


.service-admin-left {
  display: flex;

  align-items: center;

  gap: 12px;

  min-width: 0;
}


/* =====================================================
   DRAG HANDLE
   ===================================================== */

.drag-handle {
  cursor: grab;

  font-size: 20px;

  color: #777;

  user-select: none;

  transition:
    color 0.2s ease,
    transform 0.2s ease;
}


.drag-handle:hover {
  color: #c7a46a;

  transform: scale(1.1);
}


.drag-handle:active {
  cursor: grabbing;
}


.service-admin-item.dragging {
  opacity: 0.45;

  transform: scale(0.98);
}


.drag-ghost {
  opacity: 0.25;
}


.drag-chosen {
  transform: scale(1.02);

  cursor: grabbing;
}


/* =====================================================
   SERVICE PREVIEW
   ===================================================== */

.service-preview {
  position: relative;

  width: 100%;

  margin: 0 auto 10px;

  overflow: hidden;

  border-radius: 16px;

  border:
    1px solid
    rgba(255, 255, 255, 0.07);

  background: #1b1b1b;
}


.service-preview img {
  display: block;

  width: 100%;

  max-height: 260px;

  object-fit: cover;

  border-radius: 16px;
}


.service-preview-overlay {
  position: absolute;

  inset: 0;

  background:
    rgba(0, 0, 0, 0.58);

  display: flex;

  justify-content: center;

  align-items: center;

  opacity: 0;

  transition:
    opacity 0.3s ease;
}


.service-preview:hover
.service-preview-overlay {
  opacity: 1;
}


#changeServiceImage {
  border:
    1px solid
    #c7a46a;

  padding: 11px 20px;

  border-radius: 10px;

  cursor: pointer;

  font-family:
    "Cormorant Garamond",
    serif;

  font-size: 16px;

  color: #c7a46a;

  background:
    rgba(20, 20, 20, 0.9);

  transition:
    background 0.25s ease,
    color 0.25s ease,
    transform 0.25s ease;
}


#changeServiceImage:hover {
  background: #c7a46a;

  color: #141414;

  transform: translateY(-2px);
}


/* =====================================================
   CERTIFICATES EDITOR
   ===================================================== */

.certificates-editor {
  display: grid;

  grid-template-columns:
    repeat(2, 1fr);

  gap: 16px;
}


.certificate-item {
  position: relative;

  overflow: hidden;

  border-radius: 12px;

  border:
    1px solid
    rgba(255, 255, 255, 0.08);

  background: #1b1b1b;
}


.certificate-item img {
  width: 100%;

  height: 180px;

  display: block;

  object-fit: cover;

  border-radius: 12px;

  transition:
    transform 0.35s ease;
}


.certificate-item:hover img {
  transform: scale(1.04);
}


.certificate-item button {
  position: absolute;

  inset: 0;

  border: none;

  background:
    rgba(0, 0, 0, 0.55);

  color: white;

  font-size: 22px;

  opacity: 0;

  transition:
    opacity 0.3s ease,
    background 0.3s ease;

  cursor: pointer;
}


.certificate-item:hover button {
  opacity: 1;
}


/* =====================================================
   MOBILE EDITOR
   ===================================================== */

@media (max-width: 768px) {

  .admin-login-content {
    width:
      calc(100% - 30px);

    padding: 25px 18px;
  }


  .editor-panel {
    width: 100vw;

    right: -100vw;

    border-left: none;
  }


  .editor-header {
    min-height: 62px;

    padding: 14px 16px;
  }


  .editor-header h2,
  .editor-header h3 {
    font-size: 22px;
  }


  .editor-body {
    padding:
      18px 16px 24px;

    gap: 16px;
  }


  .edit-button {
    opacity: 1;

    width: 38px;

    height: 38px;

    top: 12px;

    right: 12px;
  }


  .certificates-editor {
    grid-template-columns:
      repeat(2, 1fr);

    gap: 10px;
  }


  .certificate-item img {
    height: 140px;
  }


  .certificate-item button {
    opacity: 1;
  }

}


/* =====================================================
   SMALL PHONES
   ===================================================== */

@media (max-width: 480px) {

  .admin-login-content {
    width:
      calc(100% - 20px);

    padding: 22px 15px;
  }


  .editor-header {
    padding: 13px;
  }


  .editor-body {
    padding:
      16px 13px 22px;
  }


  .editor-body input,
  .editor-body textarea {
    font-size: 16px;
  }


  .certificates-editor {
    gap: 8px;
  }


  .certificate-item img {
    height: 115px;
  }

}

/* =====================================================
   HERO EDITOR PREVIEW
   ===================================================== */

.hero-editor-preview {
  position: relative;

  width: 100%;

  margin-bottom: 8px;

  overflow: hidden;

  border-radius: 16px;

  border: 1px solid
    rgba(199, 164, 106, 0.2);

  background: #1b1b1b;
}


.hero-editor-preview img {
  display: block;

  width: 100%;

  height: 240px;

  object-fit: cover;

  border-radius: 16px;
}


.hero-editor-preview-overlay {
  position: absolute;

  inset: 0;

  display: flex;

  align-items: center;

  justify-content: center;

  background:
    rgba(0, 0, 0, 0.55);

  opacity: 0;

  transition: opacity 0.3s ease;
}


.hero-editor-preview:hover
.hero-editor-preview-overlay {
  opacity: 1;
}


.hero-editor-preview-overlay button {
  width: auto !important;

  min-height: 44px;

  padding: 10px 18px;

  background:
    rgba(20, 20, 20, 0.9);

  border:
    1px solid #c7a46a;

  border-radius: 10px;

  color: #c7a46a;

  cursor: pointer;
}

/* =====================================================
   FIX: CONTENT INSIDE EDITOR
   ===================================================== */

.editor-body > * {
  flex-shrink: 0;
}


/* Превью изображений не должно сжиматься */

.editor-body .service-preview,
.editor-body .hero-editor-preview {
  flex-shrink: 0;
}


/* Само изображение тоже сохраняет размеры */

.editor-body .service-preview img,
.editor-body .hero-editor-preview img {
  flex-shrink: 0;
}

.editor-buttons {
  align-self: center;
}