/* Image Grid Styles */
.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  width: 100%;
  padding: 2rem 1rem;
}
.image-card {
  position: relative;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.image-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}
.image-card:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25);
  z-index: 10;
}
/* Responsive Design */
@media (max-width: 1024px) {
  .image-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}
@media (max-width: 768px) {
  .image-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}
/* User Examples Modal Styles */
.examples-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  padding-top: 50px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
}
.examples-modal-content {
  margin: auto;
  display: block;
  max-width: 75%;
  max-height: 75vh;
  object-fit: contain;
  animation: zoom 0.3s;
}
@keyframes zoom {
  from {transform: scale(0.8)}
  to {transform: scale(1)}
}
.examples-modal-close {
  position: fixed;
  top: 2rem;
  right: 2rem;
  color: #EFF1F2;
  font-size: 3rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease, transform 0.2s ease;
  line-height: 1;
  z-index: 1001;
  background-color: transparent;
  border: none;
  padding: 0;
}
.examples-modal-close:hover,
.examples-modal-close:focus {
  color: #ffffff;
  transform: scale(1.1);
}
@media (max-width: 768px) {
  .examples-modal-content {
    max-width: 75%;
  }
  
  .examples-modal-close {
    font-size: 2.5rem;
    top: 1rem;
    right: 1rem;
  }
}

/* ================================
   Panel Builder Styles
================================ */
.panel-builder-container {
  width: 100%;
  max-width: 100%;
  margin: 2rem 0;
  background: #7A715A;
  border-radius: 1rem;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  height: calc(100vh - 150px);
  max-height: 900px;
}

.panel-builder-app {
  display: grid;
  grid-template-columns: 250px 1fr 280px;
  gap: 0;
  height: 100%;
}

/* Left Panel - Controls */
.panel-left-panel {
  background: #EFF1F2;
  padding: 20px 15px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  height: 100%;
}

.panel-section-title {
  font-size: 1em;
  color: #102864;
  margin-bottom: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

.panel-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.panel-btn {
  padding: 12px 16px;
  border: 2px solid #102864;
  background: white;
  color: #102864;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  transition: all 0.3s ease;
}

.panel-btn:hover {
  background: #102864;
  color: #EFF1F2;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 40, 100, 0.3);
}

.panel-btn.active {
  background: #102864;
  color: #EFF1F2;
}

.panel-controls-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  flex-shrink: 0;
}

.panel-btn-primary {
  background: #102864;
  color: #EFF1F2;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.panel-btn-primary:hover {
  background: #1a3a99;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
}

.panel-btn-secondary {
  background: #7A715A;
  color: #EFF1F2;
  padding: 12px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.panel-btn-secondary:hover {
  background: #5F5643;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25);
}

/* Center Panel - Workspace */
.panel-center-panel {
  display: flex;
  flex-direction: column;
  padding: 20px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  height: 100%;
}

.panel-workspace-title {
  color: #EFF1F2;
  font-size: 1.5em;
  margin-bottom: 15px;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  flex-shrink: 0;
}

.panel-canvas {
  background: #2c3e50;
  border: 4px solid #34495e;
  border-radius: 12px;
  position: relative;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 100%;
  flex-shrink: 1;
  min-height: 0;
}

.panel-canvas.full {
  aspect-ratio: 16/9;
  max-width: min(900px, 100%);
}

.panel-canvas.half {
  aspect-ratio: 8/9;
  max-width: min(450px, 100%);
}

.panel-canvas.quarter {
  aspect-ratio: 4/9;
  max-width: min(225px, 100%);
}

.panel-canvas.quarter-sideways {
  aspect-ratio: 19/10;
  max-width: min(900px, 100%);
}

.panel-canvas.drag-over {
  background: #3d5872;
  border-color: #102864;
  box-shadow: 0 10px 40px rgba(16, 40, 100, 0.4);
}

.placed-item {
  position: absolute;
  background: #34495e;
  border: 2px solid #4a5f7f;
  border-radius: 6px;
  padding: 10px;
  cursor: move;
  user-select: none;
  touch-action: none;
}

.placed-item .item-content {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #102864 0%, #1a3a99 100%);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #EFF1F2;
  font-weight: 600;
  font-size: 0.85em;
  text-align: center;
  padding: 5px;
  position: relative;
}

.placed-item .item-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  z-index: 1;
}

.placed-item .item-content span {
  position: relative;
  z-index: 2;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.placed-item .remove-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #7A715A;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 10;
  font-size: 18px;
}

.placed-item .remove-btn:hover {
  background: #5F5643;
}

.panel-empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: #7f8c8d;
  pointer-events: none;
}

.panel-empty-state svg {
  width: 80px;
  height: 80px;
  margin-bottom: 15px;
  opacity: 0.5;
}

/* Right Panel - Avionics Library */
.panel-right-panel {
  background: #EFF1F2;
  padding: 20px 15px;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  overflow-y: auto;
  height: 100%;
}

.avionics-library {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.avionics-item {
  background: white;
  border: 2px solid #e0e6ed;
  border-radius: 8px;
  padding: 12px;
  cursor: grab;
  transition: all 0.3s ease;
  text-align: center;
  flex-shrink: 0;
}

.avionics-item:hover {
  border-color: #102864;
  box-shadow: 0 4px 12px rgba(16, 40, 100, 0.2);
  transform: translateY(-2px);
}

.avionics-item:active {
  cursor: grabbing;
}

.avionics-icon {
  width: 100%;
  height: 80px;
  background: linear-gradient(135deg, #102864 0%, #1a3a99 100%);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 6px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.9em;
  position: relative;
}

.avionics-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  z-index: 1;
}

.avionics-icon span {
  position: relative;
  z-index: 2;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.avionics-name {
  font-weight: 600;
  color: #102864;
  font-size: 0.85em;
}

.avionics-category {
    color: #102864;
    font-size: 0.9em;
    font-weight: 700;
    margin: 20px 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #102864;
    flex-shrink: 0;
}

.avionics-category:first-child {
    margin-top: 0;
}

/* Scrollbar Styling */
.panel-right-panel::-webkit-scrollbar {
  width: 8px;
}

.panel-right-panel::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 10px;
}

.panel-right-panel::-webkit-scrollbar-thumb {
  background: #102864;
  border-radius: 10px;
}

.panel-right-panel::-webkit-scrollbar-thumb:hover {
  background: #7A715A;
}

/* Custom Objects Section */
.custom-objects-section {
  display: flex;
  gap: 8px;
  margin-bottom: 15px;
  flex-shrink: 0;
}

.custom-object-btn {
  flex: 1;
  padding: 10px;
  background: #102864;
  color: #EFF1F2;
  border: none;
  border-radius: 6px;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.custom-object-btn:hover {
  background: #1a3a99;
  transform: translateY(-2px);
}

/* Custom Panel Modal */
.custom-panel-modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.custom-panel-modal-content {
  background: #EFF1F2;
  padding: 30px;
  border-radius: 12px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.custom-panel-modal h2 {
  color: #102864;
  margin-bottom: 20px;
  text-align: center;
}

.custom-panel-input-group {
  margin-bottom: 15px;
}

.custom-panel-input-group label {
  display: block;
  color: #102864;
  font-weight: 600;
  margin-bottom: 5px;
}

.custom-panel-input-group input {
  width: 100%;
  padding: 10px;
  border: 2px solid #102864;
  border-radius: 6px;
  font-size: 1em;
}

.custom-panel-buttons {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.custom-panel-buttons button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.custom-panel-buttons .btn-confirm {
  background: #102864;
  color: #EFF1F2;
}

.custom-panel-buttons .btn-confirm:hover {
  background: #1a3a99;
}

.custom-panel-buttons .btn-cancel {
  background: #7A715A;
  color: #EFF1F2;
}

.custom-panel-buttons .btn-cancel:hover {
  background: #5F5643;
}

/* Mobile Layout */
/* Mobile Layout */
@media (max-width: 968px) {
  .panel-builder-container {
    height: auto;
    max-height: none;
  }

  .panel-builder-app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    height: auto;
  }

  .panel-left-panel {
    order: 3;
    padding: 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    height: auto;
  }

  .panel-logo {
    display: none;
  }

  .panel-options {
    flex-direction: row;
    overflow-x: auto;
  }

  .panel-controls-group {
    flex-direction: row;
    margin-top: 0;
  }

  .panel-center-panel {
    order: 2;
    padding: 20px;
    min-height: 400px;
    height: auto;
  }

  .panel-workspace-title {
    font-size: 1.5em;
    margin-bottom: 15px;
  }

  .panel-right-panel {
    order: 1;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    max-height: 325px;
    overflow-y: auto;
    height: auto;
  }

  .avionics-library {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
  }

  .avionics-item {
    min-width: 140px;
  }

  .panel-section-title {
    font-size: 1em;
  }
}