* {
    box-sizing: border-box;
}

body {
    font-family: "Noto Sans TC", sans-serif;
    padding: 0;
    margin: 0;
    background: #f5f5f5;
}

.header{
  flex: none;
  height: 60px;
  background: #667eea;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: none;
  border-bottom: 2px solid #4d63c4;
  h1{
    margin: 0;
    padding: 0;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.5;
    i{
      margin-right: 4px;
    }
  }
}

.container {
  display: flex;
  height: calc(100vh - 60px);
  width: 100vw;
}
/* 控制區域 */
.controls {
  flex: none;
  width: 340px;
  background: white;
  border-right: 2px solid #dee2e6;
  display: flex;
  flex-direction: column;
  .controls-main {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
  }
  .buttons-box {
    padding: 12px;
    border-top: 2px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
    .btn{
      width: 100%;
      padding: 12px 16px;
      border-radius: 8px;
      cursor: pointer;
      font-weight: bold;
      font-size: 16px;
      transition: all 0.3s ease;
      color: white;
      border: 2px solid #45000059;
    }
    .btn-primary {
      background: #667eea;
      &:hover {
        background: #4d63c4;
      }
    }
    
    .btn-secondary {
      background: #ff741d;
      &:hover {
        background: #ed3b00;
      }
    }
    
  }
  .control-group {
    margin-bottom: 20px;
    h3 {
      margin: 0 0 12px 0;
      color: #495057;
      font-size: 1.1em;
      font-weight: 700;
      border-bottom: 2px solid #e9ecef;
      padding-bottom: 10px;
      display: flex;
      align-items: baseline;
      i {
        margin-right: 8px;
        color: #4d63c4;
      }
      span{
        width: 100%;
      }
      a{
        font-size: 14px;
        white-space: nowrap;
        color: #667eea;
        cursor: pointer;
        &:hover{
          color: #4d63c4;
        }
      }
      
    }
  }
}

/* 圖片預覽 */
.canvas-container {
  flex: 1;
  background: #e9ecef;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
  width: 100%;
  height: 100%;
  overflow: auto;
  .canvas-box {
    background: white;
    padding: 12px;
    border-radius: 16px;

  }
  #canvas {
      border: 3px solid #dee2e6;
      border-radius: 10px;
      max-width: calc(100vw - 460px);
      max-height: 400px;
      width: auto;
      height: auto;
      display: block;
  }
}

/* 欄位元件 */
.form-box{
  margin-bottom: 12px;
}
.form-title {
  display: block;
  margin: 0;
  margin-bottom: 4px;
  font-weight: 600;
  color: #495057;
}
.form-subtitle {
  display: block;
  margin: 0;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 14px;
  color: #666;
  
}
input, textarea, select {
  width: 100%;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  margin-bottom: 0;
  padding: 4px 12px;
  height: 40px;
  &:focus {
      outline: none;
      border-color: #667eea;
      box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
  }
  &:disabled {
      background-color: #e9ecef;
      color: #6c757d;
      cursor: not-allowed;
      opacity: 0.6;
  }
}
textarea {
  resize: vertical;
  height: unset;
  min-height: 120px;
  line-height: 1.5;
}
select {
  background: white;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  &::after {
      content: '';
      position: absolute;
      top: 50%;
      right: 12px;
      transform: translateY(-50%);
      width: 16px;
      height: 16px;
      background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
      background-repeat: no-repeat;
      background-position: center;
      pointer-events: none;
  }
}
.color-input {
  height: 50px;
  cursor: pointer;
  border-radius: 8px;
  padding: 2px;
  &:disabled {
    cursor: not-allowed;
  }
}
.slider-value {
  text-align: center;
  font-weight: bold;
  color: #667eea;
  width: 70px;
  background: #f8f9fa;
  padding: 8px;
  border-radius: 6px;
  font-size: 14px;
}


.flex {
  display: flex;
}
.flex-1 {
  flex: 1;
}
.jc-c {
  justify-content: center;
}
.ai-c {
  align-items: center;
}
.gap-2 {
  gap: 10px;
}




@media (max-width: 900px) {
  .container {
    flex-direction: column-reverse;
  }
  .controls{
    width: 100%;
    height: 50%;
    border-top: 2px solid #dee2e6;
    border-right: 0;
  }
  
  .canvas-container {
    #canvas {
        max-width: 80vw;
        max-height: 40vh;
    }
  }
  
}