style.css

8.14 KB
06/07/2025 18:00
CSS
style.css
/* Reset และ Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  font-family: 'Kanit', 'Noto Sans Thai', sans-serif;
  background-image: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  min-height: 100vh;
  color: #333;
}
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}
/* Header */
.header {
  text-align: center;
  color: white;
  margin-bottom: 30px;
}
.header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}
.header p {
  font-size: 1.1rem;
  opacity: 0.9;
}
/* Main Layout */
.main-content {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}
/* Sidebar */
.sidebar {
  width: 280px;
  background: white;
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
}
.control-section {
  padding-bottom: 12px;
  border-bottom: 1px solid #eee;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.control-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}
.control-section h3 {
  color: #555;
  font-size: 0.95rem;
  font-weight: 600;
}
/* Size Presets */
/* Size Selection */
.size-selection {
  margin-bottom: 10px;
}
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
  cursor: pointer;
}
select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}
.custom-size {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.custom-size label {
  font-weight: 500;
  color: #666;
  font-size: 0.85rem;
}
.size-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}
.size-inputs input {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85rem;
  text-align: center;
  width: 100%;
}
.size-inputs span {
  color: #666;
  font-weight: 500;
}
/* Background Controls */
.background-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.background-controls label {
  font-weight: 500;
  color: #666;
  font-size: 0.85rem;
}
.background-controls input[type="color"] {
  width: 100%;
  height: 35px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
input[type="file"] {
  padding: 6px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.75rem;
}
.background-controls input[type="range"] {
  width: 100%;
}
/* Buttons */
.add-btn, #applyCustomSize, #removeBgImage, .export-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.3s ease;
  width: 100%;
}
.add-btn:hover, #applyCustomSize:hover, #removeBgImage:hover, .export-btn:hover {
  background: #5a6fd8;
}
.delete-btn {
  background: #dc3545;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.3s ease;
  width: 100%;
}
.delete-btn:hover {
  background: #c82333;
}
/* Text Controls */
#textControls {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  border: 2px solid #667eea;
}
#textControls input, #textControls select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.text-style-buttons {
  display: flex;
  gap: 3px;
  margin: 8px 0;
}
.style-btn {
  background: #f8f9fa;
  border: 1px solid #ddd;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  flex: 1;
  font-size: 0.85rem;
}
.style-btn:hover {
  background: #e9ecef;
}
.style-btn.active {
  background: #667eea;
  color: white;
}
/* Canvas Area */
.canvas-area {
  flex: 1;
  background: white;
  border-radius: 15px;
  padding: 25px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.canvas-container {
  position: relative;
  border: 2px dashed #ddd;
  border-radius: 10px;
  padding: 20px;
  background: #fafafa;
  margin-bottom: 15px;
}
#bannerCanvas {
  display: block;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  border-radius: 5px;
  background: white;
}
.overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  pointer-events: all;
  border-radius: 5px;
  cursor: default;
}
.canvas-info {
  color: #666;
  font-size: 0.9rem;
  font-weight: 500;
}
/* Draggable Elements */
.draggable-element {
  position: absolute;
  cursor: move;
  border: 2px dashed transparent;
  user-select: none;
  min-width: 50px;
  min-height: 20px;
  z-index: 10;
}
.draggable-element.selected {
  border-color: #667eea;
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}
/* Resize Handles */
.resize-handles {
  position: absolute;
  pointer-events: none;
}
.resize-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #667eea;
  border: 2px solid white;
  border-radius: 50%;
  pointer-events: all;
  z-index: 20;
}
.resize-handle.nw {
  top: -6px;
  left: -6px;
  cursor: nw-resize;
}
.resize-handle.ne {
  top: -6px;
  right: -6px;
  cursor: ne-resize;
}
.resize-handle.sw {
  bottom: -6px;
  left: -6px;
  cursor: sw-resize;
}
.resize-handle.se {
  bottom: -6px;
  right: -6px;
  cursor: se-resize;
}
.resize-handle.n {
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  cursor: n-resize;
}
.resize-handle.s {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  cursor: s-resize;
}
.resize-handle.w {
  top: 50%;
  left: -6px;
  transform: translateY(-50%);
  cursor: w-resize;
}
.resize-handle.e {
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  cursor: e-resize;
}
.draggable-element.text-element {
  background: transparent;
  color: inherit;
  font-family: inherit;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
  padding: 2px;
}
.draggable-element.text-element.selected {
  background: rgba(102, 126, 234, 0.1);
  border: 2px dashed #667eea;
}
.draggable-element img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
/* เอฟเฟกต์ข้อความ */
.effect-controls {
  background: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  border: 2px solid #17a2b8;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shadow-controls, .stroke-controls {
  border-top: 1px solid #dee2e6;
  padding-top: 8px;
  margin-top: 8px;
}
.shadow-options, .stroke-options {
  margin-left: 20px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.shadow-options input, .stroke-options input {
  margin-bottom: 4px;
}
/* คีย์ลัด */
.keyboard-shortcuts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: #f8f9fa;
  padding: 12px;
  border-radius: 6px;
  border: 2px solid #6c757d;
}
.shortcut-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}
.shortcut-key {
  background: #343a40;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  font-weight: bold;
  min-width: 60px;
  text-align: center;
}
.shortcut-desc {
  color: #666;
  flex: 1;
  margin-left: 8px;
}
/* Responsive */
@media (max-width: 1200px) {
  .main-content {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    max-height: none;
    order: 2;
  }
  .canvas-area {
    order: 1;
  }
}
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  .header h1 {
    font-size: 2rem;
  }
  .sidebar {
    padding: 15px;
  }
  .canvas-container {
    padding: 10px;
  }
  #bannerCanvas {
    max-width: 100%;
    height: auto;
  }
}
/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
  width: 8px;
}
.sidebar::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}
/* Animation */
.control-section {
  animation: fadeInUp 0.5s ease;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}