/* BACKGROUND */
body {
    margin: 0;
    font-family: "Inter", sans-serif;
    background: linear-gradient(135deg, #8a4fff, #ff4f99);
    color: white;
    transition: opacity 0.3s ease-in-out;
    min-height: 100vh;
}

/* Page Transition Overlay */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #8a4fff, #ff4f99);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

.page-transition.active {
    opacity: 1;
    pointer-events: all;
}

/* Loading Spinner */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Smooth transitions for content */
.project-card,
.amenity-row,
.glass-card {
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* Loading indicator styling */
#loadingIndicator,
#loadingAmenities {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

#loadingIndicator.active,
#loadingAmenities.active {
    display: flex;
    opacity: 1;
}

#loadingIndicator p,
#loadingAmenities p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

/* HEADER */
.header {
    display: flex;
    justify-content: space-between;
    padding: 25px 40px 0;
}

.admin-text {
    margin-right: 12px;
    opacity: 0.9;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
    color: white;
}

/* SUB TEXT */
.sub-text {
    margin: 5px 42px 20px;
    opacity: 0.8;
}

/* CONTROLS */
.top-controls {
    display: flex;
    gap: 15px;
    margin: 0 40px;
}

/* SEARCH BOX */
.search-box {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    width: 260px;
    border-radius: 16px;
}

.search-box input {
    background: transparent;
    border: none;
    outline: none;
    color: white;
    width: 100%;
}

.search-box input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.search-icon {
    font-size: 18px;
    margin-right: 10px;
    color: white;
}

/* FILTER DROPDOWN */
.filter {
    padding: 12px;
    border-radius: 16px;
    width: 150px;
    border: none;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
}

.filter option {
    background: rgba(255, 255, 255, 0.25);
    color: black;
    backdrop-filter: blur(10px);
}

/* GLASS BUTTON */
.add-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    color: white;
}

/* GLASS REUSABLE CLASS */
.glass {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
}

/* PROJECT GRID */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 22px;
    padding: 30px 40px;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

.project-grid > * {
    min-width: 0; /* Prevent grid item overflow */
}

/* PROJECT CARD */
.project-card {
    padding: 22px;
    border-radius: 20px;
    position: relative;
}

/* STATUS ROW */
.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dot {
    height: 10px;
    width: 10px;
    border-radius: 50%;
}

.green { background: #00ff7f; }
.red { background: #ff6363; }

/* TOGGLE SWITCH */
.switch {
    position: relative;
    width: 42px;
    height: 22px;
}

.switch input {
    display: none;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0;
    width: 42px;
    height: 22px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    transition: 0.3s;
}

.slider:before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    top: 2px;
    left: 2px;
    border-radius: 50%;
    background: white;
    transition: 0.3s;
}

input:checked + .slider {
    background: rgba(0, 255, 140, 0.7);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* ACTION ICONS */
.actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 20px;
}

.actions i {
    color: white;
    cursor: pointer;
}

/* PROJECT LOGO - Consistent sizing across all pages */
.project-logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0;
    width: 100%;
    height: 92.36px;
}

.project-logo,
.detail-logo {
    width: 136px ;
    height: 92.36px ;
    border-radius: 12px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px;
    backdrop-filter: blur(10px);
    max-width: 136px;
    max-height: 92.36px;
    flex-shrink: 0;
}

/* Global image styling for consistency */
img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Ensure all images in containers fit properly */
.amenity-icon-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* TEMPERATURE */
.temp {
    position: absolute;
    right: 18px;
    bottom: 18px;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 14px;
    display: flex;
    gap: 5px;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(12px);
}

.filter {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    border: none;
    color: white;
    padding: 12px 16px;
    width: 150px;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* Add some padding-right to leave space for arrow */
    padding-right: 30px;
    position: relative;
}

/* Custom arrow using background image */
.filter {
    background-image:
      linear-gradient(45deg, transparent 50%, white 50%),
      linear-gradient(135deg, white 50%, transparent 50%);
    background-position:
      calc(100% - 20px) calc(1em + 2px),
      calc(100% - 15px) calc(1em + 2px);
    background-size: 5px 5px;
    background-repeat: no-repeat;
}

/* -------------------------
   Modal — visible, aligned,
   and matching project cards
   ------------------------- */

/* Backdrop */
.modal-bg {
  position: fixed;
  inset: 0;
  display: none;                 /* JS toggles this */
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.28);  /* dimmer backdrop for contrast */
  backdrop-filter: blur(8px);
  z-index: 1100;
  padding: 20px;
}

/* Modal card — STRONG overrides for .glass */
.modal-box,
.modal-box.glass {
  width: 380px;
  max-width: 94%;
  padding: 18px 18px 16px;
  border-radius: 18px;

  /* stronger glass that keeps controls visible */
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);

  border: 1px solid rgba(255,255,255,0.20);
  box-shadow: 0 8px 30px rgba(0,0,0,0.28);

  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #fff;
  box-sizing: border-box; /* important for consistent sizing */
}

/* Close icon location */
.modal-close {
  font-size: 22px;
  color: #fff;
  margin-left: auto;
  cursor: pointer;
  padding: 4px;
  opacity: 0.95;
}

/* Title */
.modal-box h2 {
  margin: 2px 0 6px 0;
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

/* Inputs / Select / Textarea — visible, consistent */
.modal-box input,
.modal-box textarea,
.modal-box select {
  width: 100%;
  height: 44px;                /* exactly same visual height as controls on cards */
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.06); /* slightly visible input fill */
  color: #ffffff;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
  -webkit-appearance: none;
  appearance: none;
}

/* textarea taller but same corner/radius */
.modal-box textarea {
  height: 92px;               /* compact but usable */
  padding-top: 12px;
  resize: vertical;
}

/* focus state — clear and visible */
.modal-box input:focus,
.modal-box textarea:focus,
.modal-box select:focus {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.40);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02), 0 6px 18px rgba(0,0,0,0.25);
}

/* Dropdown options — visible text on dark background */
.modal-box select option {
  background: rgba(30, 30, 40, 0.95);
  color: #ffffff;
  padding: 10px 12px;
}

/* placeholder color — more visible */
.modal-box input::placeholder,
.modal-box textarea::placeholder {
  color: rgba(255,255,255,0.72);
}

/* file upload — same height and alignment as input */
.file-upload {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.20);
  cursor: pointer;
  color: rgba(255,255,255,0.9);
  font-size: 14px;
}

/* hide native file input */
#fileInput { display: none; }

/* Submit button — match card theme (no neon) and proper sizing */
.submit-btn {
  height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: none;
  width: 100%;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;

  /* Use project-card gradient / subtle */
  background: linear-gradient(135deg, rgba(123,77,255,0.95), rgba(177,77,255,0.95));
  color: #fff;
  box-shadow: 0 6px 16px rgba(120, 60, 200, 0.16);
}

/* small hover lift */
.submit-btn:hover { transform: translateY(-2px); }

/* tiny layout helpers so every field lines up like project cards */
.modal-box > input,
.modal-box > textarea,
.modal-box > select,
.modal-box > .file-upload {
  margin: 0;           /* remove stray margins */
}

/* Responsive - Mobile First Approach */
/* Mobile: 320px - 479px */
@media (max-width: 479px) {
  .modal-box, .modal-box.glass { 
    width: calc(100vw - 40px);
    max-width: calc(100vw - 40px);
    padding: 14px; 
    border-radius: 14px; 
  }
  .modal-box input,
  .modal-box textarea,
  .modal-box select,
  .file-upload,
  .submit-btn { 
    height: 44px; 
    font-size: 14px; 
  }
  .modal-box textarea { 
    height: 80px; 
  }
  .modal-buttons {
    flex-direction: column;
  }
  .modal-buttons button {
    width: 100%;
  }
  
  /* Projects grid adjustments */
  .project-grid {
    grid-template-columns: 1fr;
    padding: 20px 15px;
    gap: 15px;
  }
  
  .top-controls {
    flex-direction: column;
    margin: 0 15px;
    gap: 10px;
  }
  
  .search-box {
    width: 100%;
  }
  
  .filter {
    width: 100%;
  }
  
  .header {
    flex-direction: column;
    align-items: flex-start;
    padding: 20px 15px 0;
    gap: 15px;
  }
  
  .sub-text {
    margin: 5px 15px 20px;
  }
}

/* Tablet: 480px - 767px */
@media (min-width: 480px) and (max-width: 767px) {
  .modal-box, .modal-box.glass {
    width: min(500px, 90vw);
    max-width: min(500px, 90vw);
  }
  
  .project-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    padding: 25px 20px;
    gap: 18px;
  }
  
  .top-controls {
    margin: 0 20px;
  }
}

/* Small Desktop: 768px - 1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  .project-grid {
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  }
}
/* --- Project Detail Layout --- */
.detail-wrapper {
    width: 100%;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 30px;
    padding: 20px 40px;
}

.detail-card, .amenities-card {
    padding: 22px;
    border-radius: 18px;
    box-sizing: border-box;
}

/* Header */
.detail-header {
    display: flex;
    align-items: center;
    gap: 15px;
}

.detail-logo {
    width: 136px;
    height: 92.36px;
    border-radius: 12px;
    opacity: 0.85;
    object-fit: contain;
    padding: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.detail-title {
    font-size: 22px;
    margin: 0;
}

.detail-code {
    margin: 0;
    color: rgba(255,255,255,0.8);
}

/* Description */
.detail-desc {
    margin: 16px 0 20px;
    line-height: 1.5;
    color: rgba(255,255,255,0.85);
}

/* Section Blocks */
.detail-section {
    margin-bottom: 20px;
}

.detail-section h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

/* Temperature View */
.temp-view {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Amenities */
.amenity-title {
    margin-bottom: 16px;
}

.amenity-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.amenity-item {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 12px;
    height: 44px;

    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
}

.amenity-item i {
    font-size: 20px;
}

/* Responsive - Detail Wrapper */
/* Mobile: 320px - 479px */
@media (max-width: 479px) {
    .detail-wrapper {
        grid-template-columns: 1fr;
        padding: 15px;
        gap: 20px;
    }
    
    .detail-card, .amenities-card {
        padding: 18px;
    }
}

/* Tablet: 480px - 767px */
@media (min-width: 480px) and (max-width: 767px) {
    .detail-wrapper {
        grid-template-columns: 1fr;
        padding: 20px;
    }
}

/* Small Desktop: 768px - 967px */
@media (min-width: 768px) and (max-width: 967px) {
    .detail-wrapper {
        grid-template-columns: 1fr;
        padding: 20px 30px;
    }
}

/* Desktop: 968px - 1023px */
@media (min-width: 968px) and (max-width: 1023px) {
    .detail-wrapper {
        grid-template-columns: 1.1fr 1fr;
        gap: 25px;
    }
}

/* Large Desktop: 1024px+ */
@media (min-width: 1024px) {
    .detail-wrapper {
        grid-template-columns: 1.2fr 1fr;
    }
}
