style.css

7.94 KB
02/11/2025 07:08
CSS
style.css
:root {
  --primary: #4a90e2;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #3498db;
  --gray: #95a5a6;
  --light: #f8f9fa;
  --dark: #2c3e50
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0
}
body {
  font-family: 'Sarabun', sans-serif;
  background: #ecf0f1;
  display: flex;
  height: 100vh;
  overflow: hidden
}
button {
  border: none;
}
.app-container {
  display: flex;
  width: 100%;
  height: 100%
}
.left-panel, .right-panel {
  width: 320px;
  background: #fff;
  border: 1px solid #ddd;
  display: flex;
  flex-direction: column
}
.right-panel {
  width: 420px;
}
.left-panel {
  border-left: none
}
.right-panel {
  border-right: none
}
.center-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #bdc3c7
}
.panel-tabs {
  display: flex;
  background: var(--light);
  border-bottom: 1px solid #ddd
}
.panel-tab {
  flex: 1;
  padding: 10px 12px;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  border-bottom: 3px solid transparent;
  transition: .2s;
  background: transparent
}
.panel-tab.active {
  background: #fff;
  border-bottom-color: var(--primary);
  color: var(--primary)
}
.panel-content {
  flex: 1;
  overflow: auto;
  padding: 12px
}
.tab-pane {
  display: none
}
.tab-pane.active {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.empty-hint {
  color: var(--gray);
  text-align: center;
  margin-top: 40px;
  font-size: 14px
}
.toolbar {
  background: #fff;
  padding: 10px 12px;
  border-bottom: 1px solid #ddd;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap
}
.toolbar-group {
  display: flex;
  gap: 8px;
  align-items: center
}
.toolbar-divider {
  width: 1px;
  height: 28px;
  background: #ddd;
  margin: 0 6px
}
.canvas-area {
  flex: 1;
  padding: 24px;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start
}
.receipt-canvas {
  background: #fff;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .2);
  position: relative;
  min-height: 400px
}
.paper-a4 {
  width: 210mm;
  min-height: 297mm;
  padding: 18mm
}
.paper-80mm {
  width: 80mm;
  min-height: 150mm;
  padding: 5mm
}
.paper-58mm {
  width: 58mm;
  min-height: 100mm;
  padding: 3mm
}
.drop-zone {
  min-height: 100px;
  border: 2px dashed #ccc;
  border-radius: 8px;
  padding: 10px;
  transition: .3s
}
.drop-zone.layout-2col {
  column-count: 2;
  column-gap: 10px
}
.drop-zone.layout-2col .dropped-component {
  break-inside: avoid
}
.drop-zone.drag-over {
  border-color: var(--primary);
  background: #e3f2fd
}
.drop-zone-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray);
  font-size: 14px;
  min-height: 200px;
  flex-direction: column;
  gap: 8px
}
.dropped-component {
  position: relative;
  padding: 8px;
  margin: 8px 0;
  border: 2px solid transparent;
  border-radius: 6px;
  cursor: move;
  transition: .2s
}
.dropped-component:hover {
  border-color: var(--primary);
  background: rgba(74, 144, 226, .05)
}
.dropped-component.selected {
  border-color: var(--success);
  background: rgba(39, 174, 96, .05)
}
.component-controls {
  position: absolute;
  top: -12px;
  right: 5px;
  display: none;
  gap: 5px;
  z-index: 10
}
.dropped-component:hover .component-controls, .dropped-component.selected .component-controls {
  display: flex
}
.control-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .2)
}
.control-btn.edit {
  background: var(--primary);
  color: #fff
}
.control-btn.delete {
  background: var(--danger);
  color: #fff
}
.btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: .2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: #eee
}
.btn:hover {
  opacity: .9;
  transform: translateY(-1px)
}
.btn-sm {
  padding: 6px 10px;
  font-size: 12px
}
.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 8px
}
.btn-primary {
  background: var(--primary);
  color: #fff
}
.btn-success {
  background: var(--success);
  color: #fff
}
.btn-danger {
  background: var(--danger);
  color: #fff
}
.btn-warning {
  background: var(--warning);
  color: #fff
}
.btn-info {
  background: var(--info);
  color: #fff
}
.file-label input {
  display: none
}
.file-label {
  display: inline-flex;
  align-items: center;
  gap: 6px
}
.prop-group {
  margin-bottom: 16px;
  padding: 12px;
  background: var(--light);
  border-radius: 8px
}
.prop-group h3 {
  font-size: 14px;
  margin-bottom: 10px;
  color: var(--dark);
  font-weight: 600
}
.prop-field {
  margin-bottom: 10px
}
.prop-field label {
  display: block;
  font-size: 12px;
  margin-bottom: 5px;
  color: #555
}
.prop-field input, .prop-field select, .prop-field textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px
}
.items-list {
  max-height: 380px;
  overflow: auto
}
.item-row {
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr 1em;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
  padding: 8px;
  background: var(--light);
  border-radius: 6px
}
.item-row input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px 5px;
  font-size: 14px;
}
.item-row button {
  background-color: transparent;
  color: var(--danger);
  cursor: pointer;
}
.component-group {
  margin-bottom: 16px
}
.component-group h3 {
  font-size: 13px;
  color: var(--gray);
  margin-bottom: 8px;
  text-transform: uppercase;
  font-weight: 600
}
.component-item {
  background: var(--light);
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 6px;
  cursor: move;
  border: 2px solid transparent;
  transition: .2s;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px
}
.component-item:hover {
  background: #e3f2fd;
  border-color: var(--primary);
  transform: translateX(5px)
}
.template-card {
  background: var(--light);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: .2s
}
.template-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1)
}
.template-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 6px
}
.template-desc {
  font-size: 12px;
  color: var(--gray);
  margin-top: 4px
}
.comp-text {
  font-size: 14px;
  line-height: 1.6
}
.comp-heading {
  font-size: 22px;
  font-weight: 700;
  margin: 8px 0
}
.comp-logo {
  text-align: center
}
.comp-logo img {
  max-width: 100%;
  height: auto;
  border-radius: 4px
}
.comp-divider {
  border-top: 1px solid #ddd;
  margin: 12px 0
}
.comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px
}
.comp-table th, .comp-table td {
  padding: 6px 4px;
  text-align: left;
  border-bottom: 1px solid #eee
}
.comp-table th {
  background: var(--light);
  font-weight: 600
}
.comp-barcode, .comp-qrcode {
  text-align: center;
  margin: 12px 0
}
.editable {
  outline: 1px dashed transparent
}
.editable:focus {
  outline: 1px dashed var(--primary);
  background: rgba(74, 144, 226, .05)
}
.comp-box {
  position: relative;
  min-height: 60px
}
.box-child {
  position: relative
}
.box-drop-zone {
  transition: .2s;
  opacity: 0.7
}
.box-drop-zone:hover {
  background: rgba(74, 144, 226, .1);
  border-color: var(--primary) !important
}
.comp-box.drag-over .box-drop-zone {
  background: rgba(74, 144, 226, .1);
  border-color: var(--primary) !important;
  opacity: 1
}
@media print {
  .left-panel, .right-panel, .toolbar {
    display: none !important
  }
  .canvas-area {
    background: #fff;
    padding: 0
  }
  .receipt-canvas {
    box-shadow: none
  }
  .component-controls {
    display: none !important
  }
  .dropped-component {
    border: none !important;
    background: none !important
  }
}