/* ===== Nice Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: grid !important;      /* 👈 force centering layout */
  place-items: center;         
  z-index: 9999;
  padding: 20px;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;  /* Initially hidden */
  transition: opacity 0.6s ease-in-out, visibility 0s linear 0.6s;  /* Transition opacity and visibility */
}

.modal-backdrop.is-open {
  opacity: 1;  /* Make it visible */
  visibility: visible;  /* Ensure visibility is set */
  pointer-events: auto;  /* Enable interaction */
  transition: opacity 0.6s ease-in-out, visibility 0s linear;  /* Transition opacity immediately */
}

.modal-card {
  width: min(var(--modal-w, 420px), 100%);
  max-height: calc(100vh - 40px);
  background: #fff;
  border: 1px solid #e9e9e9;
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
  padding: 2.2rem 1.8rem;
  display: flex;
  flex-direction: column;
  overflow: auto;  
  --ty: 12px;
  --scale: 1;
  transform: translateY(var(--ty)) scale(var(--scale));
  transform-origin: center;
  opacity: 0;  /* Initially invisible */
  transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;  /* Smooth transition for both */
  will-change: transform, opacity;
}

.modal-backdrop.is-open .modal-card {
  --ty: 0;  /* Reset translate */
  --scale: 1;  /* Reset scale */
  opacity: 1;  /* Fade in the modal content */
}

.modal-card.is-zoomed{
  --scale: 1.5;
}

.modal--sm{ --modal-w: 420px; }
.modal--md{ --modal-w: 520px; }
.modal--lg{ --modal-w: 720px; }
.modal--xl{ --modal-w: 920px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 18px 18px 25px 18px;
  border-bottom: 1px solid rgba(0, 0, 0, .12);
  margin-bottom: 20px;
  position: relative; /* Add this to enable absolute positioning */
  flex: 0 0 auto;
}
.modal-icon{
  width:45px;
  height:45px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(163,201,59,.18);
  color:#2b2b2b;
  flex:0 0 auto;
}
.modal-title {
  color: var(--dark-grey);
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.3;
  margin: 0.5rem 0;
  font-family: var(--myFont);
  text-align: left;
}
.modal-title i {
    margin-right: 15px;
}
.modal-close {
  position: absolute; /* Change to absolute positioning */
  top: 0;
  right: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.modal-close i{
    color: var(--dark-grey);
    background-color: transparent;
    border-radius: 50%;
    padding: 8px 10px;
    transition: background-color 0.3s ease, transform 0.3s ease;
    font-size: 22px;
}
.modal-close i:hover{
  background-color: #f1f1f1;
  transform: scale(1.1); 
}
.ticket-meta{
      display:grid;
      grid-template-columns: 2fr 1fr;
      gap:12px;
      margin-top:18px;
    }
  @media(max-width:768px){
      .ticket-meta{ grid-template-columns:1fr; }
    }
.ticket-meta b{ color:#555; }

.ticket-badge{
      display:inline-block;
      padding:6px 10px;
      border-radius:999px;
      font-weight:700;
      font-size:0.9rem;
      border:1px solid #ddd;
      background:#f7f7f7;
      white-space:nowrap;
    }

    .attachments-grid{
      display:flex;
      flex-wrap:wrap;
      gap:12px;
      margin-top:10px;
    }

    .attachment-card{
      position: relative;
      width: 160px;
      border: 1px solid #eee;
      border-radius: 8px;
      overflow: hidden;
      background: #fff;
    }

    .attachment-link{
      display:block;
      text-decoration:none;
      color:inherit;
    }

    .attachment-card img{
      width:100%;
      height:110px;
      object-fit:cover;
      display:block;
    }

    .attachment-name{
      font-size:.85rem;
      padding:8px;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
    }

    .attachment-delete-form{
      position:absolute;
      top:6px;
      right:6px;
      margin:0;
      z-index: 5;
    }

    .attachment-delete-btn{
      width:22px;
      height:22px;
      border-radius:999px;
      border:0;
      background: rgba(0,0,0,0.65);
      color:#fff;
      font-weight:700;
      line-height:22px;
      cursor:pointer;
      opacity:0;
      transform: scale(0.9);
      transition: opacity .15s ease, transform .15s ease;
    }

    .attachment-card:hover .attachment-delete-btn{
      opacity:1;
      transform: scale(1);
    }

    .attachment-delete-btn:hover{
      background: rgba(220, 60, 60, 0.9);
    }

    .ticket-reply-actions{
      display:flex;
      align-items:center;
      gap:12px;
      margin-top:10px;
    }
    .ticket-reply-actions .action-button{
      margin-left:auto;
    }

  .eco-modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}

.eco-modal.is-open{
  display: block;
}

.eco-modal__overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}

.eco-modal__box{
  position: relative;
  width: min(520px, calc(100% - 30px));
  margin: 12vh auto 0;
  background: #fff;
  border-radius: 14px;
  padding: 18px 18px 14px;
  box-shadow: 0 20px 80px rgba(0,0,0,.25);
  border: 1px solid #eee;
  animation: ecoPop .16s ease-out;
}

.eco-modal__title{
  margin: 0 0 20px;
  font-size: 1.05rem;
  font-weight: 600;
}

.eco-modal__title i, i.delete-icon {
  margin-right: 15px;
  color: #e74c3c;;
}

.eco-modal__text{
  margin: 0 0 14px;
  color: #666;
  font-size: .95rem;
  line-height: 1.35;
}

@keyframes ecoPop{
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}

.file-hidden{
  position:absolute;
  left:-9999px;
  width:1px;
  height:1px;
  overflow:hidden;
}
.file-info{
  margin-left:10px;
  font-style: italic;
  color:#616161;
  font-size:0.95rem;
}
.preview-grid{
  margin-top:12px;
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}
.preview-grid img{
  width:90px;
  height:90px;
  object-fit:cover;
  border-radius:8px;
  border:1px solid #eee;
  max-height: 220px;
  overflow: auto;
}
.modal-errors{
  border:1px solid #ffd1d1;
  background:#fff5f5;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0 12px 0;
  color:#a00;
}

.modal-label{
  display:block;
  font-weight: 600;
  margin: 10px 0 6px 0;
  text-align: left;
}
.modal-container {
  position: relative;
  margin: 10px 0;
}
.modal-label-inner {
    position: absolute;
    top: 10px;
    left: 1.2rem;
    font-size: 14px; /* Smaller label font size */
    color: var(--light-grey); /* Light color for label */
    pointer-events: none; /* So label won't interfere with input */
    transition: all 0.2s ease; /* Smooth transition for floating effect */
}

.modal-input-inner{
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 2rem 1.2rem 0.5rem 1.2rem;
  outline: none;
  line-height: 2;
  background: #f8f8f8;
}
.modal-input-inner:focus{
  background: #fff;
}
.modal-input{
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  outline: none;
  line-height: 2;
} 

.modal-body {
  padding: 16px 18px;
  color: var(--medium-grey);
  font-size: .95rem;
  flex: 1 1 auto;
  overflow-y: auto;            /* THIS is the scrolling area */
  -webkit-overflow-scrolling: touch;
}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap: 15px;
  margin-top: 20px;
  padding-top: 20px;
  border-top:1px solid rgba(0,0,0,.08);
  flex: 0 0 auto;
}

.modal-button {
  color: var(--light-grey);
  padding: 12px 14px;
  font-size: .9rem;
  border: none;
  cursor: pointer;
  border-radius: 5px;
  transition: background 0.3s ease, transform 0.3s, box-shadow 0.3s;
}
.modal-actions .modal-button:hover {
  color: var(--medium-grey);
  background: #f0f0f0;
}
.modal-button.secondary{ 
    background:#fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); 
     }
.modal-button.primary{ 
    color: #fff;
    background-color: var(--dark-grey);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-sizing: border-box;
    appearance: none;
}
.modal-button.primary:hover {
    background-color: var(--accent-color); 
    color: #202020; 
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.modal-button i {
    margin-right: 15px;
}
.modal-button.primary:focus {
    background-color: var(--accent-color); 
    color: #fff; 
}

.modal-button.secondary:hover{
    background-color: #f5f5f5; 
    color: #666; 
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); 
}

.modal-button.secondary:hover {
    background:#f8f8f8;
}
.modal-button.primary:hover {
    background-color: var(--accent-color2); 
    color: #fff; 
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.modal-button.primary:focus {
    background-color: var(--accent-color2); 
    color: #202020; 
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.modal-actions .danger {
  background: #e74c3c;
  color: #fff;
}

.modal-actions .danger:hover {
  background: #c0392b;
  color: #fff;
}