/* Moved from index.html inline styles */
body {
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #fff5f2 0%, #ffe4dc 100%);
    font-family: 'Segoe UI', Arial, sans-serif;
}

.canvas-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 0 20px;
}

.scale-control {
    background: #ffffff;
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    font-weight: 600;
    color: #666;
    font-size: 13px;
    width: 160px;
}

.scale-control input[type="range"] {
    width: 100%;
    cursor: pointer;
    margin: 0 0 10px 0;
}

.scale-control input[type="range"]:last-child {
    margin-bottom: 0;
}

.photo-btn {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    background: linear-gradient(to bottom, #9DB4FF, #8AA3FF);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.photo-btn:hover {
    background: linear-gradient(to bottom, #8AA3FF, #7992FF);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.photo-btn:active {
    background: #7992FF;
    transform: translateY(1px);
}

.canvas-container {
    position: relative;
    width: 600px;
    height: 750px;
    background: #FFF8F3; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    border-radius: 15px;
}

.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: 2px dashed transparent;
    border-radius: 15px;
}

.layer.selected {
    background: transparent;
}

#layer1 { z-index: 1; }
#layer2 { z-index: 2; }

.draggable-image {
    position: absolute;
    cursor: move;
    padding: 4px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    touch-action: none;
    transition: transform 0.2s ease;
    z-index: 1;
}

.draggable-image:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 10; 
}

.draggable-image.layer1 {
    z-index: 1 !important;
}

.draggable-image.layer2 {
    z-index: 2 !important;
}

.controls {
    position: relative;
    height: auto;
    margin: 0;
    max-width: 1200px;
    padding: 0;
    text-align: left;
    display: flex;
    justify-content: center;
    gap: 20px;
}

.layer-controls {
    display: none;
}

.layer-btn {
    display: none;
}

.image-menu {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 0;
    max-width: none;
    position: relative;
}

.image-upload-section {
    position: relative;
    padding: 15px;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    margin: 0;
}

.image-upload-section:hover {
    background: #fafafa;
    box-shadow: 0 6px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.image-upload-section h3 {
    position: absolute;
    top: -40px;
    left: 0;
    color: #ffffff;
    margin: 0;
    font-size: 16px;
    padding: 8px 16px;
    background: #9DB4FF;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}

.image-upload-section:nth-child(1) {
    width: 160px;
    padding: 12px;
}

.image-upload-section:nth-child(2) {
    width: 300px;
}

input[type="file"] {
  color: transparent;
  width: 140px; 
  font-size: 0.9em;
  padding: 4px;
  border-radius: 6px;
  background: #f8f8f8;
  border: 1px solid #e0e0e0;
  margin: 5px auto;
  display: block;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

input[type="file"]::-webkit-file-upload-button {
  visibility: hidden;
  width: 0;
}

input[type="file"]::before {
  content: 'Select Files';
  display: inline-block;
  background: linear-gradient(to bottom, #9DB4FF, #8AA3FF);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  outline: none;
  white-space: nowrap;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  margin-left: 10px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

input[type="file"]:hover::before {
  background: linear-gradient(to bottom, #8AA3FF, #7992FF);
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}

input[type="file"]:active::before {
  background: #7992FF;
  transform: translateY(1px);
}

.upload-counter {
    font-size: 12px;
    color: #666;
    margin: 5px 0;
    text-align: center;
}

.image-preview {
    position: relative;
    display: inline-block;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.image-preview img {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.image-preview:hover img {
    transform: scale(1.05);
}

.image-preview.active-preview {
    box-shadow: 0 0 0 3px #9DB4FF, 0 4px 12px rgba(0,0,0,0.2);
}

.preview-delete-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #FF6B6B;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    opacity: 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.image-preview:hover .preview-delete-btn {
    opacity: 1;
}

#layer1Previews {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 8px;
    justify-content: center;
}

#layer2Previews {
    display: grid;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 12px;
    margin-top: 10px;
    padding: 8px;
    justify-content: center;
}

.page-title {
    text-align: center;
    color: indigo;
    font-size: 32px;
    font-weight: bold;
    margin: 20px auto; 
    font-family: 'Segoe UI', Arial, sans-serif;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    max-width: 1200px; 
    padding: 0 20px; 
}

.main-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 10px;
    margin: 0 auto;
    max-width: 1100px;
    padding: 20px;
}