/* Reset และ Base Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Sarabun', sans-serif;
background: #f8f9fa;
color: #2c3e50;
overflow-x: hidden;
}
/* App Layout */
.app-container {
display: flex;
flex-direction: column;
height: 100vh;
}
/* Header */
.app-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 1rem 2rem;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
z-index: 1000;
}
.header-content {
display: flex;
justify-content: space-between;
align-items: center;
max-width: 1400px;
margin: 0 auto;
}
.header-content h1 {
font-size: 1.5rem;
font-weight: 600;
}
.header-content h1 i {
margin-right: 0.5rem;
color: #ffd700;
}
.header-actions {
display: flex;
gap: 1rem;
}
/* Mode Buttons */
.mode-buttons {
display: flex;
gap: 0.5rem;
background: rgba(255, 255, 255, 0.1);
border-radius: 8px;
padding: 0.25rem;
backdrop-filter: blur(10px);
}
.mode-btn {
padding: 0.5rem 1rem;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 0.9rem;
font-weight: 500;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
background: transparent;
color: rgba(255, 255, 255, 0.8);
}
.mode-btn:hover {
background: rgba(255, 255, 255, 0.15);
color: white;
}
.mode-btn.active {
background: rgba(255, 255, 255, 0.2);
color: white;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.mode-btn i {
font-size: 0.8rem;
}
/* Edit Mode Indicator */
.edit-mode-indicator {
position: fixed;
top: 20px;
right: 20px;
background: #e74c3c;
color: white;
padding: 0.5rem 1rem;
border-radius: 20px;
font-size: 0.8rem;
font-weight: 600;
box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
z-index: 9999;
display: none;
align-items: center;
gap: 0.5rem;
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
}
.edit-mode-indicator.active {
display: flex;
animation: slideInRight 0.3s ease;
}
.edit-mode-indicator i {
font-size: 0.8rem;
animation: pulse 2s infinite;
}
@keyframes slideInRight {
from {
transform: translateX(100%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.7;
}
}
/* Buttons */
.btn {
padding: 0.5rem 1rem;
border: none;
border-radius: 6px;
cursor: pointer;
font-size: 0.9rem;
font-weight: 500;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.btn:disabled {
opacity: 0.6;
cursor: not-allowed;
transform: none;
}
.btn-primary {
background: #3498db;
color: white;
}
.btn-secondary {
background: #95a5a6;
color: white;
}
.btn-success {
background: #27ae60;
color: white;
}
.btn-warning {
background: #f39c12;
color: white;
}
/* App Body */
.app-body {
display: flex;
flex: 1;
overflow: hidden;
}
/* Sidebar */
.sidebar {
width: 280px;
background: white;
border-right: 1px solid #e9ecef;
overflow-y: auto;
padding: 1.5rem;
}
.sidebar-section {
margin-bottom: 2rem;
}
.sidebar-section h3 {
font-size: 1.1rem;
font-weight: 600;
color: #2c3e50;
margin-bottom: 1rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
/* Template Grid */
.template-grid {
display: grid;
grid-template-columns: 1fr;
gap: 1rem;
}
.template-card {
background: #f8f9fa;
border: 2px solid #e9ecef;
border-radius: 8px;
padding: 1rem;
cursor: pointer;
transition: all 0.3s ease;
text-align: center;
}
.template-card:hover {
border-color: #3498db;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);
}
.template-card.active {
border-color: #3498db;
background: #e3f2fd;
}
.template-preview {
font-size: 2rem;
color: #3498db;
margin-bottom: 0.5rem;
}
.template-card h4 {
font-size: 0.9rem;
font-weight: 500;
color: #2c3e50;
}
/* Form Elements */
.form-group {
margin-bottom: 1rem;
}
.form-group label {
display: block;
font-size: 0.9rem;
font-weight: 500;
color: #2c3e50;
margin-bottom: 0.5rem;
}
.form-group input,
.form-group select {
width: 100%;
padding: 0.5rem;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 0.9rem;
}
.form-group input[type="color"] {
height: 40px;
padding: 0.25rem;
}
/* Tool Buttons */
.tool-buttons {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.tool-btn {
background: #ecf0f1;
border: 1px solid #bdc3c7;
border-radius: 6px;
padding: 0.75rem;
cursor: pointer;
font-size: 0.9rem;
transition: all 0.3s ease;
display: flex;
align-items: center;
gap: 0.5rem;
}
.tool-btn:hover {
background: #d5dbdb;
border-color: #95a5a6;
}
/* Editor Container */
.editor-container {
flex: 1;
display: flex;
flex-direction: column;
background: #f8f9fa;
overflow: hidden;
}
/* Editor Toolbar */
.editor-toolbar {
background: white;
border-bottom: 1px solid #e9ecef;
padding: 0.75rem 1.5rem;
display: flex;
align-items: center;
gap: 1rem;
}
.toolbar-group {
display: flex;
align-items: center;
gap: 0.5rem;
}
.toolbar-btn {
background: none;
border: 1px solid #ddd;
border-radius: 4px;
padding: 0.5rem;
cursor: pointer;
font-size: 0.9rem;
transition: all 0.3s ease;
width: 36px;
height: 36px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.toolbar-btn:hover {
background: #f8f9fa;
border-color: #3498db;
}
.toolbar-btn[title] {
position: relative;
}
.toolbar-btn[title]:hover::after {
content: attr(title);
position: absolute;
bottom: 120%;
left: 50%;
transform: translateX(-50%);
background: rgba(0, 0, 0, 0.8);
color: white;
padding: 4px 8px;
border-radius: 4px;
font-size: 12px;
white-space: nowrap;
z-index: 1000;
}
.zoom-level {
font-size: 0.9rem;
font-weight: 500;
min-width: 50px;
text-align: center;
}
/* VAT Selector */
.vat-selector {
padding: 0.4rem 0.6rem;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 0.8rem;
background: white;
cursor: pointer;
transition: all 0.3s ease;
min-width: 120px;
}
.vat-selector:hover {
border-color: #3498db;
}
.vat-selector:focus {
outline: none;
border-color: #3498db;
box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
/* Receipt Editor */
.receipt-editor {
flex: 1;
overflow: auto;
padding: 2rem;
display: flex;
justify-content: center;
align-items: flex-start;
}
/* A4 Page */
.receipt-page {
background: white;
border-radius: 8px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
position: relative;
min-height: 100%;
}
.receipt-page.a4 {
width: 21cm;
min-height: 29.7cm;
padding: 1cm;
}
/* Welcome Message */
.welcome-message {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 25.7cm;
color: #95a5a6;
text-align: center;
}
.welcome-message i {
font-size: 3rem;
margin-bottom: 1rem;
}
.welcome-message p {
font-size: 1.1rem;
}
/* Receipt Templates */
.receipt-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 2px solid #3498db;
}
.company-info {
flex: 1;
}
.company-info h1 {
font-size: 1.8rem;
font-weight: 700;
color: #2c3e50;
margin-bottom: 0.5rem;
}
.company-info p {
color: #7f8c8d;
line-height: 1.4;
margin-bottom: 0.25rem;
}
.company-logo {
max-width: 120px;
max-height: 80px;
margin-bottom: 1rem;
object-fit: contain;
}
.receipt-info {
min-width: 200px;
}
.receipt-title {
font-size: 1.5rem;
font-weight: 600;
color: #3498db;
margin-bottom: 1rem;
text-align: right;
}
.receipt-details {
background: #f8f9fa;
padding: 1rem;
border-radius: 6px;
}
.receipt-details .detail-row {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
}
.receipt-details .detail-row:last-child {
margin-bottom: 0;
}
.customer-section {
margin-bottom: 2rem;
}
.customer-section h3 {
font-size: 1.1rem;
font-weight: 600;
color: #2c3e50;
margin-bottom: 1rem;
padding: 0.5rem 0;
border-bottom: 1px solid #e9ecef;
}
.items-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 2rem;
}
.items-table th {
background: #3498db;
color: white;
padding: 0.75rem;
text-align: left;
font-weight: 600;
}
.items-table td {
padding: 0.75rem;
border-bottom: 1px solid #e9ecef;
}
.items-table tr:nth-child(even) {
background: #f8f9fa;
}
.total-section {
display: flex;
justify-content: flex-end;
margin-bottom: 2rem;
}
.total-box {
background: #2c3e50;
color: white;
padding: 1.5rem;
border-radius: 6px;
min-width: 250px;
}
.total-row {
display: flex;
justify-content: space-between;
margin-bottom: 0.5rem;
}
.total-row:last-child {
margin-bottom: 0;
font-size: 1.2rem;
font-weight: 700;
border-top: 1px solid rgba(255, 255, 255, 0.3);
padding-top: 0.75rem;
margin-top: 0.75rem;
}
.footer-section {
text-align: center;
padding-top: 2rem;
border-top: 1px solid #e9ecef;
color: #7f8c8d;
}
/* Editable Elements */
.editable {
position: relative;
cursor: text;
transition: all 0.3s ease;
min-height: 1em;
}
.editable:hover,
.editable.selected,
.editable:focus {
outline: 1px dashed #3498db;
border-radius: 3px;
}
/* Inline Format Toolbar */
.format-toolbar {
position: fixed;
top: 0;
left: 0;
background: rgba(255, 255, 255, 0.98);
backdrop-filter: blur(10px);
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 8px;
padding: 8px 12px;
z-index: 10000;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
transition: all 0.2s ease;
width: auto;
max-width: none;
display: none;
}
.format-toolbar.show {
display: flex;
}
.toolbar-content {
display: flex;
align-items: center;
gap: 8px;
flex-wrap: nowrap;
}
.toolbar-group {
display: flex;
align-items: center;
gap: 4px;
}
.toolbar-group:not(:last-child)::after {
content: '';
width: 1px;
height: 20px;
background: #dee2e6;
margin: 0 8px;
}
/* Item Actions */
.item-actions {
text-align: center;
}
.item-actions button {
border: none;
background-color: transparent;
cursor: pointer;
}
.item-actions button:hover {
color: #FF0000;
}
.add-item-row {
background: #f8f9fa;
cursor: pointer;
transition: all 0.3s ease;
}
.add-item-row:hover {
background: #e9ecef;
}
.add-item-row td {
text-align: center;
color: #6c757d;
font-style: italic;
}
/* Modal Styles */
.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0, 0, 0, 0.5);
z-index: 2000;
align-items: center;
justify-content: center;
}
.modal.show {
display: flex;
}
.modal-content {
background: white;
border-radius: 8px;
max-width: 500px;
width: 90%;
max-height: 80%;
overflow: hidden;
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}
.modal-header {
background: #f8f9fa;
padding: 1rem 1.5rem;
border-bottom: 1px solid #e9ecef;
display: flex;
justify-content: space-between;
align-items: center;
}
.modal-header h3 {
margin: 0;
font-size: 1.25rem;
font-weight: 600;
color: #2c3e50;
}
.modal-close {
background: none;
border: none;
font-size: 1.5rem;
color: #6c757d;
cursor: pointer;
padding: 0;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 4px;
transition: all 0.2s ease;
}
.modal-close:hover {
background: #e9ecef;
color: #495057;
}
.modal-body {
padding: 1.5rem;
}
/* Upload Area */
.upload-area {
border: 2px dashed #dee2e6;
border-radius: 8px;
padding: 2rem;
text-align: center;
cursor: pointer;
transition: all 0.3s ease;
background: #f8f9fa;
}
.upload-area:hover {
border-color: #667eea;
background: #f0f8ff;
}
.upload-area i {
font-size: 3rem;
color: #6c757d;
margin-bottom: 1rem;
}
.upload-area p {
color: #6c757d;
margin: 0;
font-size: 1rem;
}
/* Reset Company Data Button */
.btn-outline {
background: transparent;
border: 2px solid rgba(255, 255, 255, 0.3);
color: white;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
cursor: pointer;
font-size: 0.875rem;
font-weight: 500;
transition: all 0.2s ease;
display: flex;
align-items: center;
gap: 0.5rem;
}
.btn-outline:hover {
background: rgba(255, 255, 255, 0.1);
border-color: rgba(255, 255, 255, 0.5);
transform: translateY(-1px);
}
/* Responsive Design */
@media (max-width: 1200px) {
.receipt-page.a4 {
width: 95%;
min-height: auto;
}
}
@media (max-width: 768px) {
.app-body {
flex-direction: column;
}
.sidebar {
width: 100%;
max-height: 300px;
}
.header-content {
flex-direction: column;
gap: 1rem;
}
.header-actions {
flex-wrap: wrap;
justify-content: center;
}
.receipt-info {
text-align: left;
}
}
/* Print Styles */
@media print {
.sidebar,
.app-header,
.editor-toolbar,
.format-toolbar,
.item-actions,
.add-item-row,
.edit-mode-indicator {
display: none !important;
}
body,
.receipt-editor,
.receipt-page.a4 {
box-shadow: none;
border-radius: 0;
margin: 0;
padding: 0;
background: white;
}
}