﻿/* ==================== MODAL — MOBILE-FIRST (Bottom Sheet) ==================== */

/* Overlay */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(10,18,28,0.7);  
  display: flex; align-items: flex-end; /* Bottom sheet by default (mobile) */
  justify-content: center;
  opacity: 0; visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s cubic-bezier(0.16,1,0.3,1), visibility 0.4s;
}
.modal-overlay:not(.open):not(.is-active) {
  display: none !important;
}
.modal-overlay.open,
.modal-overlay.is-active {
  display: flex !important;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Modal card — bottom sheet by default */
.modal {
  position: relative; width: 100%; max-width: 100%;
  background: var(--color-white);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  max-height: 95vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
  transform: translateY(100%);
  transition: transform 0.5s cubic-bezier(0.16,1,0.3,1);
}
.modal-overlay.open .modal { transform: translateY(0); }

/* Drag handle */
.modal::before {
  content: ''; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 4px; background: #d0d5db; border-radius: 100px; z-index: 2;
}
/* Accent strip removed */

/* Close */
.modal-close {
  position: absolute; top: clamp(12px,2vw,16px); right: clamp(12px,2vw,16px);
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: var(--color-gray-bg); color: var(--color-primary); font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease; z-index: 1;
}
.modal-close:hover { background: var(--color-primary); color: var(--color-white); }

/* Body */
.modal-body { padding: clamp(32px,5vw,40px) clamp(20px,4vw,32px) clamp(24px,4vw,32px); }
.modal-title { font-size: clamp(20px,4vw,24px); font-weight: 500; color: var(--color-primary); margin-bottom: 8px; line-height: 1.3; }
.modal-subtitle { font-size: var(--fs-small); color: #6b7b8d; margin-bottom: clamp(20px,4vw,32px); line-height: 1.5; }

/* Form */
.modal-form { display: flex; flex-direction: column; gap: clamp(12px,2vw,16px); }

.field-input {
  width: 100%; padding: clamp(14px,2vw,16px) clamp(16px,3vw,20px);
  font-size: 16px; /* Prevents iOS zoom */ font-family: inherit; font-weight: 400;
  color: var(--color-primary); background: var(--color-gray-bg);
  border: 2px solid transparent; border-radius: var(--radius-input);
  outline: none; transition: all 0.25s ease; -webkit-appearance: none;
}
.field-input::placeholder { color: #9aa8b6; }
.field-input:focus { border-color: var(--color-accent); background: var(--color-white); box-shadow: 0 0 0 4px rgba(169,210,211,0.15); }

/* Phone with prefix */
.field-phone {
  display: flex; align-items: center; background: var(--color-gray-bg);
  border: 2px solid transparent; border-radius: var(--radius-input); transition: all 0.25s ease; overflow: hidden;
}
.field-phone:focus-within { border-color: var(--color-accent); background: var(--color-white); box-shadow: 0 0 0 4px rgba(169,210,211,0.15); }
.phone-prefix { padding: clamp(14px,2vw,16px) 0 clamp(14px,2vw,16px) clamp(16px,3vw,20px); font-size: 16px; font-weight: 500; color: var(--color-primary); white-space: nowrap; }
.field-phone .field-input { background: transparent; border: none; border-radius: 0; padding-left: 8px; box-shadow: none !important; }

/* Consent */
.consent { display: flex; align-items: flex-start; gap: clamp(8px,2vw,12px); cursor: pointer; padding: 4px 0; }
.consent-checkbox {
  position: relative; width: 22px; height: 22px; min-width: 22px;
  border: 2px solid #c8d1da; border-radius: 6px; background: var(--color-white);
  transition: all 0.2s ease; appearance: none; -webkit-appearance: none; cursor: pointer; margin-top: 2px;
}
.consent-checkbox:checked { background: var(--color-accent); border-color: var(--color-accent); }
.consent-checkbox:checked::after {
  content: ''; position: absolute; top: 3px; left: 6px; width: 6px; height: 10px;
  border: solid var(--color-primary); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.consent-text { font-size: clamp(12px,2.5vw,13px); line-height: 1.5; color: #6b7b8d; }
.consent-text a { color: var(--color-accent); text-decoration: underline; }

/* Submit */
.btn-submit {
  width: 100%; padding: clamp(16px,3vw,20px); font-size: clamp(15px,3vw,17px);
  font-weight: 500; font-family: inherit; color: var(--color-primary);
  background: var(--color-accent); border: none; border-radius: var(--radius-pill);
  cursor: pointer; transition: all 0.3s ease; margin-top: 8px;
}
.btn-submit:hover { background: #8cc4c5; transform: translateY(-2px); box-shadow: 0 8px 24px rgba(169,210,211,0.4); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* Success */
.modal-success { display: none; flex-direction: column; align-items: center; text-align: center; padding: clamp(32px,6vw,48px) clamp(20px,4vw,32px) clamp(28px,5vw,40px); }
.modal-success.show { display: flex; animation: fadeScale 0.5s cubic-bezier(0.16,1,0.3,1) forwards; }
@keyframes fadeScale { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

.success-icon { width: clamp(56px,10vw,72px); height: clamp(56px,10vw,72px); border-radius: 50%; background: linear-gradient(135deg,var(--color-accent),#7ec8c8); display: flex; align-items: center; justify-content: center; margin-bottom: clamp(16px,3vw,24px); }
.success-icon svg { width: clamp(24px,5vw,32px); height: clamp(24px,5vw,32px); color: var(--color-primary); }
.success-title { font-size: clamp(18px,4vw,22px); font-weight: 500; color: var(--color-primary); margin-bottom: 12px; }
.success-text { font-size: var(--fs-small); color: #6b7b8d; line-height: 1.6; margin-bottom: clamp(16px,3vw,28px); }
.success-close-btn { padding: 14px 36px; font-size: var(--fs-small); font-weight: 500; font-family: inherit; color: var(--color-primary); background: var(--color-gray-bg); border: none; border-radius: var(--radius-pill); cursor: pointer; transition: all 0.2s ease; }
.success-close-btn:hover { background: var(--color-primary); color: var(--color-white); }

/* ==================== DESKTOP: center modal ==================== */
@media (min-width: 600px) {
  .modal-overlay { align-items: center; }
  .modal {
    max-width: 460px; border-radius: var(--radius-card);
    transform: translateY(40px) scale(0.96);
  }
  .modal-overlay.open .modal { transform: translateY(0) scale(1); }
  .modal::before { display: none; } /* No drag handle on desktop */
  .modal::after { border-radius: var(--radius-card) var(--radius-card) 0 0; }
}

/* ==================== SPLIT MODAL (DESKTOP) ==================== */
.modal-photo { display: none; }
.modal-inner { display: flex; flex-direction: column; width: 100%; }
.modal-form-side { width: 100%; display: flex; flex-direction: column; }

@media (min-width: 900px) {
  .modal.modal--split { max-width: 880px; overflow: hidden; }
  .modal-inner { flex-direction: row; min-height: 500px; }
  
  .modal-photo {
    display: block; width: 45%; position: relative;
    background: linear-gradient(135deg, var(--color-accent), #8acbc5);
  }
  .modal-photo img {
    width: 100%; height: 100%; object-fit: cover;
    object-position: center bottom;
  }
  
  .modal-form-side {
    width: 55%;
    display: flex; flex-direction: column; justify-content: center;
  }
}

/* ==================== GALLERY MODAL ==================== */
#galleryModal.is-active {
  display: flex;
}

.modal--gallery {
  max-width: 95vw;
  height: 95vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
  box-shadow: none;
}

.modal--gallery .modal-close {
  top: 0;
  right: 0;
  background: rgba(11, 19, 29, 0.8);
  color: #fff;
  z-index: 10;
  position: absolute;
}

.gallery-slider-container {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.gallery-slide-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 60px;
}

.gallery-slide-wrapper img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  user-select: none;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 5;
}

.gallery-nav:hover {
  background: var(--color-accent);
  color: var(--color-primary);
  border-color: var(--color-accent);
  transform: translateY(-50%) scale(1.05);
}

.gallery-nav.prev {
  left: 0;
}

.gallery-nav.next {
  right: 0;
}

.gallery-counter {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.7);
  font-size: 14px;
  letter-spacing: 2px;
}

@media (max-width: 768px) {
  .modal--gallery {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
  
  .gallery-slide-wrapper {
    padding: 0;
  }
  
  .gallery-slide-wrapper img {
    border-radius: 0;
  }
  
  .gallery-nav {
    width: 48px;
    height: 48px;
  }
  
  .gallery-nav.prev { left: 16px; }
  .gallery-nav.next { right: 16px; }
  
  .gallery-counter {
    bottom: 24px;
  }
}


