/*
Theme Name: Printior
Theme URI: http://printior.com/
Description: The theme Printior
Author: Liam
Author URI: http://liamph.am
Version: 2.0
Textdomain:
*/
/* =====================================
   CSS RESET & BASE STYLES
===================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    text-align: center;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

#canvas-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* =====================================
   MAIN PAGE LAYOUT
===================================== */
.page {
    display: flex;
    min-height: 100vh;
    background-color: #ffffff;
}
/* =====================================
   LEFT SIDEBAR
===================================== */
.left {
    width: 60px;
    background-color: #fafafa;
    padding: 12px;
    border-right: 1px solid #eee;
}
.left .menu {
    list-style: none;
    margin: 0;
    padding: 0;

    display: flex;
    flex-direction: column;
    align-items: center;
}

.left .menu a {
    display: block;
    margin: 12px 0;
    font-size: 12px;
    color: #6c6c6c;
    text-decoration: none;
}

.left .menu a:hover {
    color: #ff9900;
}

.left .menu li {
    list-style: none;
}

button {
    background: #edebe9;
    padding: 10px;
    border-radius: 6px;
    border: none;
    color: rgb(0, 0, 0);
    margin: 6px;
}
button:hover {
    background: #dcdbda;
    color: #ff9900;
    cursor: pointer;
}

ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

/* =====================================
   MAIN CONTENT AREA
===================================== */
.content {
    flex: 1;
    padding: 24px;

    /* Shadow acts as a separator */
    box-shadow: -8px 0 15px -10px rgba(0, 0, 0, 0.3);
}

.content h1 {
    margin-bottom: 16px;
}

.content p {
    margin-bottom: 12px;
}

.control-panel {
    position: fixed;
    left: 70px;
    top: 20px;
    width: 300px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    border-radius: 8px 8px 0 0;
}

.panel-title {
    font-weight: bold;
    color: #495057;
}

.btn-close-panel {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    line-height: 1;
}

.btn-close-panel:hover {
    color: #dc3545;
}

.panel-content {
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Panel active state */
.control-panel.active {
    display: block !important;
}

#panel-template .panel-content {
    overflow-y:auto;
    height:80%;
}

/* =====================================
   SVG
===================================== */

.icon {
    fill: #6b6b6b;
}

.icon:hover {
    fill: #FF9900;
    cursor: pointer;
}

/* =====================================
   RESPONSIVE: TABLET & MOBILE
===================================== */
@media (max-width: 768px) {
    .page {
        flex-direction: column;
    }

    .left {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
    }
    
    .left .menu {
        flex-direction: row;
        justify-content: space-around;
    }
    
    .left .menu a {
        margin: 0;
    }

    .left .menu a .icon {
        display: none;
    }

    .content {
        /* Shadow moves to the top on mobile */
        box-shadow: 0 -8px 15px -10px rgba(0, 0, 0, 0.3);
    }
}
/* =====================================
   TEMPLATE LIBRARY STYLES
===================================== */

.post-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    padding: 8px;
}

.post-item {
    position: relative;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    background: white;
    cursor: pointer;
}

.post-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: #ff9900;
}

.post-item a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.post-item img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-bottom: 1px solid #eee;
    transition: transform 0.3s;
}

.post-item:hover img {
    transform: scale(1.05);
}

.post-item h3 {
    font-size: 14px;
    padding: 12px 10px;
    margin: 0;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: white;
}

.has-layout {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff9900;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.template-thumb-link {
    cursor: pointer;
}

#template-loading span,
#template-end span {
    display: inline-block;
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 20px;
    font-size: 14px;
}

#template-loading span {
    color: #ff9900;
}

#template-end span {
    color: #999;
}

/* QR Panel Styles */
.qr-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.qr-tab {
    padding: 8px 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.qr-tab:hover {
    background: #e0e0e0;
}

.qr-tab.active {
    background: #ff9900;
    color: white;
}

.qr-tab-content {
    display: none;
    margin-bottom: 20px;
}

.qr-tab-content.active {
    display: block;
}

.qr-field {
    margin-bottom: 15px;
}

.qr-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 13px;
    color: #333;
}

.qr-field input[type="text"],
.qr-field input[type="url"],
.qr-field input[type="email"],
.qr-field input[type="tel"],
.qr-field select,
.qr-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.qr-field input[type="range"] {
    width: calc(100% - 70px);
    display: inline-block;
    vertical-align: middle;
}

.qr-field input[type="color"] {
    width: 50px;
    height: 40px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

#qr-size-value {
    display: inline-block;
    width: 60px;
    text-align: right;
    font-size: 13px;
    color: #666;
}

.qr-style-section {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
}

.qr-style-section h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #333;
}

.qr-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.qr-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.qr-btn.primary {
    background: #ff9900;
    color: white;
}

.qr-btn.primary:hover {
    background: #e68a00;
}

.qr-btn.secondary {
    background: #6c757d;
    color: white;
}

.qr-btn.secondary:hover {
    background: #5a6268;
}

.qr-btn.success {
    background: #28a745;
    color: white;
}

.qr-btn.success:hover {
    background: #218838;
}

.qr-preview-area {
    border-top: 1px solid #ddd;
    padding-top: 20px;
    margin-top: 10px;
}

.qr-preview-area h4 {
    margin: 0 0 15px 0;
    font-size: 14px;
    color: #333;
}

#qr-preview-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    background: #f5f5f5;
    border-radius: 8px;
    margin-bottom: 15px;
    padding: 20px;
}

#qr-preview-container svg,
#qr-preview-container canvas {
    max-width: 100%;
    max-height: 300px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.qr-logo-preview {
    margin-top: 10px;
    max-width: 100px;
    max-height: 100px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 5px;
}

.qr-logo-preview img {
    max-width: 100%;
    max-height: 100%;
}

/* Responsive */
@media (max-width: 480px) {
    .qr-tabs {
        flex-direction: column;
    }
    
    .qr-tab {
        width: 100%;
    }
    
    .qr-actions {
        flex-direction: column;
    }
}

/* Upload Panel Styles */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 30px 20px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.upload-area:hover {
    border-color: #ff9900;
    background: #f0f0f0;
}

.upload-area.dragover {
    border-color: #28a745;
    background: #e8f5e9;
}

.upload-area svg {
    margin-bottom: 10px;
}

.upload-area p {
    margin: 5px 0;
    color: #333;
}

.upload-hint {
    color: #999;
    font-size: 12px;
}

/* Preview Grid */
.upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding: 5px;
}

.preview-item {
    position: relative;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    transition: all 0.2s;
}

.preview-item:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border-color: #ff9900;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .preview-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px;
    font-size: 10px;
    text-align: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.preview-item:hover .preview-info {
    opacity: 1;
}

.preview-item .remove-preview {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: rgba(220,53,69,0.9);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    z-index: 2;
}

.preview-item:hover .remove-preview {
    display: flex;
}

.preview-item .remove-preview:hover {
    background: #dc3545;
}

.preview-item.svg-item::before {
    content: 'SVG';
    position: absolute;
    top: 5px;
    left: 5px;
    background: #ff9900;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
}

/* Upload History */
.upload-history {
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.upload-history h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
}

.history-list {
    max-height: 150px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 5px;
    background: #f9f9f9;
    transition: background 0.2s;
}

.history-item:hover {
    background: #f0f0f0;
}

.history-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 10px;
}

.history-item .history-info {
    flex: 1;
    font-size: 12px;
}

.history-item .history-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.history-item .history-size {
    color: #999;
    font-size: 10px;
}

.history-item .history-type {
    padding: 2px 4px;
    background: #e0e0e0;
    border-radius: 3px;
    font-size: 9px;
    margin-left: 5px;
}

.clear-history {
    width: 100%;
    padding: 8px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #666;
    transition: all 0.2s;
}

.clear-history:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* Loading Spinner */
.upload-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ff9900;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 5px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 480px) {
    .upload-preview-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* =====================================
   TEXT PANEL STYLES
===================================== */

/* Simple Text Section */
.text-simple-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.text-simple-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.simple-text-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
    transition: border-color 0.2s;
}

.simple-text-input:focus {
    border-color: #ff9900;
    outline: none;
}

.simple-text-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.simple-text-options select {
    flex: 2;
    min-width: 120px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.simple-text-options input[type="number"] {
    width: 70px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.simple-text-options input[type="color"] {
    width: 50px;
    height: 38px;
    padding: 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
}

.text-style-buttons {
    display: flex;
    gap: 5px;
}

.style-btn {
    width: 38px;
    height: 38px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.style-btn:hover {
    background: #e9ecef;
    border-color: #ff9900;
}

.style-btn.active {
    background: #ff9900;
    color: white;
    border-color: #ff9900;
}

.text-action-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.text-action-btn.primary {
    background: #ff9900;
    color: white;
}

.text-action-btn.primary:hover {
    background: #e68a00;
}

/* Templates Section */
.text-templates-section h4 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.category-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 15px;
}

.text-template-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.text-template-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #ff9900;
}

.template-thumbnail {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-bottom: 1px solid #eee;
}

.template-thumbnail.placeholder {
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #ccc;
}

.template-title {
    padding: 10px 10px 5px;
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.template-categories {
    padding: 0 10px 10px;
    font-size: 10px;
    color: #999;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: center;
}

.template-category {
    background: #f0f0f0;
    padding: 2px 6px;
    border-radius: 12px;
}

/* Loading States */
.loading-templates {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #999;
}

.load-more-container {
    text-align: center;
    margin: 15px 0;
}

.load-more-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: #e9ecef;
    border-color: #ff9900;
}

.no-more-templates {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* Responsive */
@media (max-width: 480px) {
    .templates-grid {
        grid-template-columns: 1fr;
    }
}
/* Elements Panel */
.element-category-filter {
    margin-bottom: 20px;
}

.category-select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 13px;
}

.element-type-filter {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.type-filter {
    flex: 1;
    padding: 8px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.type-filter:hover {
    background: #e0e0e0;
}

.type-filter.active {
    background: #ff9900;
    color: white;
    border-color: #ff9900;
}

.elements-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 cột */
    gap: 15px;
    margin-bottom: 20px;
}

.element-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    aspect-ratio: 1; /* Tỷ lệ 1:1 cho thumbnail */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.element-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #ff9900;
}

.element-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    border-radius: 4px;
    overflow: hidden;
}

.element-thumbnail img,
.element-thumbnail svg,
.element-thumbnail object {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.element-thumbnail .placeholder {
    font-size: 32px;
    color: #ccc;
}

.element-info {
    display: none;
}

.element-title {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.element-type-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: bold;
    text-transform: uppercase;
    background: rgba(0,0,0,0.6);
    color: white;
    z-index: 2;
    pointer-events: none; /* Không ảnh hưởng click */
}

.element-type-badge.svg { background: #ff9900; }
.element-type-badge.png { background: #2196f3; }
.element-type-badge.jpg { background: #4caf50; }

.element-categories {
    font-size: 9px;
    color: #999;
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
}

.element-category {
    background: #f0f0f0;
    padding: 2px 4px;
    border-radius: 3px;
}

.loading-elements {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Responsive */
@media (max-width: 480px) {
    .elements-grid {
        grid-template-columns: repeat(2, 1fr); /* Vẫn giữ 2 cột trên mobile */
        gap: 10px;
    }
}

/* Solid Color Picker */
.solid-color-picker {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    z-index: 10000;
    min-width: 200px;
    max-width: 300px;
}

.picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    border-radius: 8px 8px 0 0;
}

.picker-header span {
    font-weight: 600;
    font-size: 13px;
}

.close-picker {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.close-picker:hover {
    color: #dc3545;
}

.solid-colors-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 15px;
}

.solid-color-item {
    aspect-ratio: 1;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
}

.solid-color-item:hover {
    transform: scale(1.1);
    border-color: #ff9900;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.solid-color-item:hover .color-tooltip {
    display: block;
}

.color-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    margin-bottom: 5px;
    z-index: 10001;
}

.bg-thumbnail.solid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
    padding: 2px;
    background: #f0f0f0;
    height: 100%;
}

.bg-thumbnail.solid div {
    width: 100%;
    height: 100%;
    min-height: 30px;
}

.bg-thumbnail.solid .more-colors {
    background: rgba(0,0,0,0.5);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}
.solid-colors-grid .no-colors {
    grid-column: 1 / -1;
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}
.control-item {
    margin-bottom: 20px;
}

.control-item label {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    font-weight: 600;
}

.control-with-value {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-with-value input[type="range"] {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    background: #ddd;
    border-radius: 3px;
}

.control-with-value input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #ff9900;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.control-with-value input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #e68a00;
}

.value-display {
    min-width: 50px;
    text-align: right;
    font-size: 12px;
    color: #ff9900;
    font-weight: 600;
    background: #fff3e0;
    padding: 3px 8px;
    border-radius: 4px;
}
/* =====================================
   MOBILE BOTTOM NAVIGATION
===================================== */
@media (max-width: 768px) {
    .page {
        flex-direction: column;
        position: relative;
        min-height: 100vh;
    }

    /* Left sidebar becomes bottom navigation */
    .left {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        background-color: #ffffff;
        border-top: 1px solid #eee;
        border-right: none;
        padding: 8px 0;
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    }

    .left .menu {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS */
        scrollbar-width: none;
        /* Hide scrollbar Firefox */
        padding: 0 10px;
        margin: 0;
        white-space: nowrap;
        display: flex;
        flex-wrap: nowrap;
        gap: 5px;
        scroll-behavior: smooth;
    }

    /* Hide scrollbar for Chrome/Safari */
    .left .menu::-webkit-scrollbar {
        display: none;
    }

    .left .menu a {
        flex: 0 0 auto;
        margin: 0 5px;
        padding: 8px 15px;
        background: #f5f5f5;
        border-radius: 30px;
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 13px;
        color: #333;
        transition: all 0.2s;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }

    .left .menu a:hover,
    .left .menu a:active {
        background: #ff9900;
        color: white;
    }

    .left .menu a:hover .icon,
    .left .menu a:active .icon {
        fill: white;
    }

    .left .menu a .icon {
        width: 18px;
        height: 18px;
        fill: #666;
    }

    .left .menu a br {
        display: none;
        /* Remove line break */
    }

    /* Adjust content area to make space for bottom nav */
    .content {
        margin-bottom: 80px;
        /* Space for bottom navigation */
        padding: 15px;
        box-shadow: none;
        flex: 1;
    }

    /* Adjust control panel position on mobile */
    .control-panel {
        left: 10px;
        right: 10px;
        width: auto;
        max-width: none;
        top: 60px;
    }

    /* Export button in mobile */
    #btn-export {
        background: #28a745;
        color: white;
        margin: 0 10px;
        padding: 8px 20px;
        white-space: nowrap;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .left .menu a {
        padding: 8px 12px;
        font-size: 12px;
    }

    .left .menu a .icon {
        width: 16px;
        height: 16px;
    }
}
/* Optional: Add to your existing style.css */

/* Smooth scrolling for the menu */
.left .menu {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Active state for menu items */
.left .menu a.active {
    background: #ff9900;
    color: white;
}

.left .menu a.active .icon {
    fill: white;
}

/* Animation for menu items on mobile */
@media (max-width: 768px) {
    .left .menu a {
        animation: slideIn 0.3s ease;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.scroll-dots {
    display: none;
    justify-content: center;
    gap: 8px;
    padding: 8px 0;
    background: transparent;
}

@media (max-width: 768px) {
    .scroll-dots {
        display: flex;
    }
}

.scroll-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: all 0.2s;
}

.scroll-dot.active {
    width: 20px;
    border-radius: 10px;
    background: #ff9900;
}
/* =====================================
   TOP TOOLBAR STYLES
===================================== */

/* Main page layout adjustment */
.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #ffffff;
}

/* Top toolbar container */
.top {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-left: 60px;
    /* Space for left menu */
}

/* Toolbar layout */
.toolbar-container {
    display: flex;
    align-items: center;
    height: 55px;
    padding: 0 20px;
    background: #ffffff;
}

/* Toolbar sections */
.toolbar-section {
    display: flex;
    align-items: center;
    height: 100%;
}

.left-section {
    flex: 0 0 auto;
}

.center-section {
    flex: 1;
}

.right-section {
    flex: 0 0 auto;
}

/* Logo area */
.logo-area {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-area svg {
    display: block;
}

/* Left sidebar adjustment */
.left {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 60px;
    background-color: #fafafa;
    border-right: 1px solid #eee;
    z-index: 1001;
}

/* Adjust main content area */
.content {
    flex: 1;
    padding: 24px;
    margin-left: 60px;
    /* Space for left menu */
    background: #f8f9fa;
    min-height: calc(100vh - 65px);
    /* Subtract toolbar height */
}

/* Control panels adjustment */
.control-panel {
    top: 75px;
    /* Below toolbar */
    left: 70px;
    /* Next to left menu */
}

/* =====================================
   RESPONSIVE FOR MOBILE
===================================== */
@media (max-width: 768px) {
    .top {
        margin-left: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }

    .toolbar-container {
        height: 60px;
        padding: 0 12px;
        justify-content: flex-start;
    }

    .left-section {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    .logo-area svg {
        max-width: 100px;
        height: auto;
    }

    .center-section,
    .right-section {
        display: none;
        /* Ẩn các phần khác trên mobile */
    }

    .left {
        top: auto;
        bottom: 0;
        height: auto;
        width: 100%;
    }

    .content {
        margin-left: 0;
        margin-top: 60px;
        margin-bottom: 70px;
        padding: 15px;
    }

    .control-panel {
        left: 10px;
        right: 10px;
        top: 70px;
    }
}
/* Thêm vào style.css */

/* Contextual Toolbar - Hiển thị khi chọn object */
.contextual-toolbar {
    position: sticky;
    top: 65px; /* Ngay dưới top toolbar */
    z-index: 999;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-left: 60px; /* Căn theo left menu */
    padding: 8px 16px;
    display: none; /* Mặc định ẩn */
    transition: all 0.2s ease;
}

.contextual-toolbar.visible {
    display: block;
}

/* Container cho toolbar */
.toolbar-content {
    display: flex;
    align-items: center;
    gap: 16px;
    overflow-x: auto;
    padding: 4px 0;
    scrollbar-width: thin;
}

/* Các nhóm công cụ */
.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 8px;
    border-right: 1px solid #e9ecef;
}

.toolbar-group:last-child {
    border-right: none;
}

/* Nút công cụ */
.toolbar-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    padding: 6px 8px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #495057;
}

.toolbar-btn:hover {
    background: #f8f9fa;
    color: #ff9900;
}

.toolbar-btn .btn-icon {
    font-size: 18px;
    margin-bottom: 2px;
}

.toolbar-btn .btn-label {
    font-size: 11px;
    white-space: nowrap;
}

/* Dropdown trong toolbar */
.toolbar-select {
    padding: 6px 24px 6px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
    color: #495057;
    background: white;
    cursor: pointer;
}

.toolbar-select:hover {
    border-color: #ff9900;
}

/* Color picker nhỏ gọn */
.toolbar-color {
    width: 32px;
    height: 32px;
    padding: 2px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
}

/* Responsive cho mobile */
@media (max-width: 768px) {
    .contextual-toolbar {
        position: fixed;
        bottom: 70px; /* Trên bottom navigation */
        top: auto;
        left: 0;
        right: 0;
        margin-left: 0;
        border-top: 1px solid #e5e7eb;
        border-bottom: none;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        background: white;
        padding: 8px;
    }

    .toolbar-content {
        justify-content: flex-start;
    }

    .toolbar-group {
        padding: 0 4px;
    }

    .toolbar-btn {
        min-width: 50px;
        padding: 4px 6px;
    }

    .toolbar-btn .btn-label {
        font-size: 10px;
    }
}