/* ตั้งค่าพื้นฐาน */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Sarabun', Tahoma, sans-serif;
}

body {
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.preview-section {
    flex: 1;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-left: 20px;
    display: flex;
    flex-direction: column;
}

.preview-header-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

.sticker-size-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 5px;
}

.size-input-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

.size-input-group label {
    font-size: 14px;
    white-space: nowrap;
}

.size-input-group input {
    width: 60px;
    padding: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

header h1 {
    color: #333;
    font-size: 24px;
}

/* สวิตช์เปลี่ยนภาษา */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 10px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* เค้าโครงหลัก */
.main-content {
    display: flex;
    gap: 2px;
    flex-wrap: wrap;
}

.form-section {
    flex: 1;
    min-width: 300px;
}

.preview-section {
    flex: 2;
    min-width: 800px;
}

/* ส่วนฟอร์ม */
.form-group {
    margin-top: 4px;
    margin-bottom: 4px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-group select {
    cursor: pointer;
}

/* ตัวควบคุมขนาดและตำแหน่ง */
.font-size-controls,
.position-controls {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #eee;
}

.font-size-controls h3,
.position-controls h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 18px;
}

.font-size-group,
.position-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.font-size-group label,
.position-group label {
    width: 180px;
    font-weight: bold;
    color: #555;
}

.font-size-group input,
.position-group input {
    flex-grow: 1;
    margin: 0 10px;
}

.font-size-group select {
    min-width: 120px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    margin: 0 10px;
}

.font-size-group span,
.position-group span {
    width: 50px;
    text-align: right;
    color: #666;
}

/* เส้นคั่น */
.font-size-controls hr,
.position-controls hr {
    margin: 15px 0;
    border: 0;
    border-top: 1px dashed #ccc;
}

/* ส่วนเลือกพื้นหลัง */
.background-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.background-item {
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 5px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.background-item:hover {
    transform: scale(1.05);
}

.background-item.selected {
    border-color: #2196F3;
    box-shadow: 0 0 5px rgba(33, 150, 243, 0.5);
}

.background-thumbnail {
    width: 177px;
    height: auto;
    display: block;
}

/* ส่วนพรีวิว */
.preview-container {
    margin-top: 20px;
}

.preview-container h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 18px;
}

.canvas-container {
    width: 100%;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    overflow: hidden;
    background-color: #f9f9f9;
}

#previewCanvas {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

/* ปุ่ม */
button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #45a049;
}

#applyButton {
    display: block;
    width: 100%;
    margin-top: 15px;
}

/* ส่วนเลย์เอาท์การพิมพ์ */
.print-layout {
    display: none;
    margin-top: 30px;
    text-align: center;
}

.print-layout h2 {
    margin-bottom: 20px;
    color: #333;
}

#printCanvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    margin-bottom: 20px;
}

.print-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

#downloadButton {
    background-color: #2196F3;
}

#downloadButton:hover {
    background-color: #0b7dda;
}

#printButton {
    background-color: #ff9800;
}

#printButton:hover {
    background-color: #e68a00;
}

#backButton {
    background-color: #f44336;
}

#backButton:hover {
    background-color: #da190b;
}

/* ตอบสนองหน้าจอ */
@media screen and (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .preview-section,
    .form-section {
        min-width: 100%;
    }
    
    .font-size-group,
    .position-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .font-size-group label,
    .position-group label {
        width: 100%;
        margin-bottom: 4px;
    }
    
    .font-size-group input,
    .position-group input,
    .form-group input,
    .form-group select {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* ป้องกันการ zoom อัตโนมัติบน iOS */
    }
    
    .background-thumbnail {
        width: 100%;
        max-width: 177px;
    }
    
    .background-selector {
        justify-content: center;
    }
    
    .search-group input {
        padding: 12px;
        font-size: 16px;
    }
    
    .search-button {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .action-buttons button {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
    
    .profile-name-input {
        padding: 12px;
        font-size: 16px;
    }
    
    textarea {
        padding: 12px;
        font-size: 16px;
    }
}

/* สไตล์สำหรับฟอนต์ */
@font-face {
    font-family: 'CustomFont';
    src: url('') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* สไตล์สำหรับการตั้งค่าตัวอักษรขั้นสูง */
.advanced-controls {
    margin-top: 20px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #eee;
}

.advanced-controls h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 18px;
}

.settings-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.settings-group label {
    width: 180px;
    font-weight: bold;
    color: #555;
}

.settings-group input {
    flex-grow: 1;
    margin: 0 10px;
}

.settings-group span {
    width: 50px;
    text-align: right;
    color: #666;
}

/* Text Element Controls */
.text-element-controls {
    margin-top: 5_px;
    padding: 5px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #eee;
}

/* สไตล์สำหรับแสดงชั้นและเลขที่ในบรรทัดเดียวกัน */
.class-number-row {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: space-between;
}

.class-input-container {
    flex: 2;
}

.number-input-container {
    flex: 2;
}

/* สไตล์สำหรับเครื่องหมายติ๊กถูก */
.auto-prefix-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.auto-prefix-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #555;
}

.auto-prefix-label input[type="checkbox"] {
    margin-right: 5px;
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.text-element-controls h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 18px;
}

.text-element-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.element-button {
    padding: 2px 2px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #d0d0d0;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.element-button:hover {
    background-color: #e0e0e0;
}

.element-button.selected {
    background-color: #2196F3;
    color: white;
    border-color: #1976D2;
}

.unified-controls {
    background-color: white;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 15px;
}

.control-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.control-group label {
    width: 180px;
    font-weight: bold;
    color: #555;
}

.control-group input,
.control-group select {
    flex-grow: 1;
    margin: 0 10px;
}

.control-group select {
    min-width: 120px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
}

.control-group span {
    width: 50px;
    text-align: right;
    color: #666;
}

/* ส่วนค้นหา */
.search-section {
    margin-bottom: 5px;
    padding: 5px;
    background-color: #f9f9f9;
    border-radius: 5px;
    border: 1px solid #eee;
}

.search-container {
    position: relative;
}

.search-form-container {
    width: 100%;
}

.search-form {
    margin-bottom: 0px;
}

.search-group {
    display: flex;
    gap: 10px;
}

.search-group input {
    flex-grow: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.search-button {
    padding: 8px 15px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-button:hover {
    background-color: #45a049;
}

/* Dropdown สำหรับผลการค้นหา */
.search-dropdown {
    display: none;
    position: absolute;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    margin-top: 0px;
}

.search-dropdown.active {
    display: block;
}

.search-item {
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

.search-item:last-child {
    border-bottom: none;
}

.search-item:hover {
    background-color: #f0f7ff;
}

.search-item strong {
    display: block;
    color: #333;
    font-size: 16px;
}

.search-item .search-details {
    display: block;
    font-size: 14px;
    color: #666;
    margin-top: 0px;
}

.no-results {
    padding: 15px;
    color: #666;
    text-align: center;
    font-style: italic;
}

/* ส่วนลบโปรไฟล์ */
.action-buttons {
    gap: 10px;
    margin-top: 20px;
}

.profile-name-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

#deleteProfileButton {
    background-color: #f44336;
}

#deleteProfileButton:hover {
    background-color: #d32f2f;
}

/* สไตล์สำหรับ textarea ของ Note */
textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 10px;
}

/* สำหรับรายการที่เลือกด้วยลูกศรในช่องค้นหา */
.search-item-active {
    background-color: #f0f8ff;
    cursor: pointer;
    border-left: 3px solid #007bff;
}

/* Login/Logout Button */
.login-section {
    display: flex;
    align-items: center;
    margin-left: 15px;
}

.login-logout-btn {
    background-color: #3498db;
    color: white;
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.login-logout-btn:hover {
    background-color: #2980b9;
}

.logout-btn {
    background-color: #e74c3c;
}

.logout-btn:hover {
    background-color: #c0392b;
}

.login-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.login-form {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    width: 300px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

.login-form h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
}

.login-form input {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.login-form-buttons {
    display: flex;
    justify-content: space-between;
}

.login-form-buttons button {
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.login-submit-btn {
    background-color: #3498db;
    color: white;
}

.login-cancel-btn {
    background-color: #7f8c8d;
    color: white;
}

/* Profile ID Display */
.profile-id-display {
    margin-left: 10px;
    font-size: 14px;
    color: #666;
    font-weight: bold;
}

/* Password input */
#password-container {
    max-width: 600px;
    margin: 0 auto 20px;
    display: flex;
    flex-direction: column;
}

#passwordInput {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    flex-grow: 1;
    margin-right: 10px;
}

#verifyPasswordButton {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#verifyPasswordButton:hover {
    background-color: #45a049;
}

/* Print mode switch */
.print-mode-switch {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.print-mode-switch label {
    margin-right: 10px;
    font-size: 14px;
    color: #555;
}

.mode-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.mode-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.mode-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .mode-slider {
    background-color: #FF9800;
}

input:focus + .mode-slider {
    box-shadow: 0 0 1px #FF9800;
}

input:checked + .mode-slider:before {
    transform: translateX(26px);
}

#dieCutCanvas {
    display: none;
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    margin-bottom: 20px;
}

/* สไตล์สำหรับส่วนหัวข้อการพิมพ์และปุ่มข้อมูล */
.print-header-container {
    position: relative;
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: #3498db;
    color: white;
    font-size: 14px;
    margin-left: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.info-icon:hover {
    background-color: #2980b9;
    transform: scale(1.1);
}

/* สไตล์สำหรับ Popup ข้อมูล */
.info-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background-color: white;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.25);
    border-radius: 10px;
    padding: 20px;
    width: 300px;
    margin-top: 15px;
    border: 1px solid #e0e0e0;
}

.info-popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.print-size-info {
    width: 220px;
    height: 200px;
    border: 2px solid #3498db;
    border-radius: 8px;
    margin-top: 10px;
    margin-bottom: 20px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
}

.print-size-width {
    position: absolute;
    top: -25px;
    left: 0;
    right: 0;
    text-align: center;
    font-weight: bold;
    color: #3498db;
    font-size: 15px;
}

.print-size-height {
    position: absolute;
    right: -45px;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-weight: bold;
    color: #3498db;
    font-size: 15px;
}

.print-size-dpi {
    font-size: 22px;
    font-weight: bold;
    color: #555;
    background-color: rgba(52, 152, 219, 0.1);
    padding: 8px 15px;
    border-radius: 6px;
}

.info-popup-text {
    text-align: center;
    font-size: 14px;
    color: #555;
    line-height: 1.5;
    margin-top: 10px;
}

/* สำหรับปุ่ม info แบบกลม (ทางเลือก) */
.info-icon-round {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #3498db;
    color: white;
    font-size: 14px;
    margin-left: 8px;
    cursor: pointer;
    font-weight: bold;
}

.info-icon-round:hover {
    background-color: #2980b9;
} 
/* ---- OK-Order SSO + personal backgrounds ---- */
.ok-user-chip {
    background: #fff0e6; color: #d1530a; font-weight: 600; font-size: 13px;
    padding: 4px 12px; border-radius: 999px; margin-right: 10px; white-space: nowrap;
}
.my-bg-section { margin-top: 14px; }
.my-bg-section h3 { font-size: 16px; margin: 8px 0; }
.my-bg-item { position: relative; }
.my-bg-owner {
    position: absolute; left: 0; right: 0; bottom: 0; background: rgba(23,23,23,.65);
    color: #fff; font-size: 11px; text-align: center; padding: 1px 2px; border-radius: 0 0 4px 4px;
}
.my-bg-delete {
    position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
    border: none; background: #dc2626; color: #fff; font-size: 11px; cursor: pointer; line-height: 1;
}
.my-bg-delete:hover { background: #b91c1c; }
.my-bg-upload-btn {
    margin-top: 8px; padding: 8px 14px; border: 1.5px dashed #f26b1d; background: #fff7f0;
    color: #d1530a; border-radius: 8px; cursor: pointer; font-weight: 600;
}
.my-bg-upload-btn:hover { background: #ffe9d6; }
.my-bg-upload-btn:disabled { opacity: .6; cursor: wait; }

/* ===== OK-Order login modal (sticker.ok-order.com) ===== */
.ok-login-form { width: 340px; }
.ok-login-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.ok-tab {
    flex: 1; padding: 8px 0; border: 1px solid #ddd; background: #f5f5f5;
    border-radius: 6px; cursor: pointer; font-weight: 600; color: #666;
}
.ok-tab.active { background: #f26b1d; border-color: #f26b1d; color: #fff; }
.ok-line-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 11px 0; border: none; border-radius: 6px;
    background: #06c755; color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
.ok-line-btn:hover { background: #05b34c; }
.ok-login-sep {
    display: flex; align-items: center; gap: 10px; margin: 12px 0;
    color: #999; font-size: 12.5px;
}
.ok-login-sep::before, .ok-login-sep::after { content: ''; flex: 1; height: 1px; background: #e3e3e3; }
.ok-login-hint { font-size: 12px; color: #888; margin: 2px 0 12px; }
.ok-login-error {
    background: #fdecea; color: #b3261e; border: 1px solid #f5c6c0;
    border-radius: 6px; padding: 8px 10px; font-size: 13px; margin-bottom: 12px;
}

/* ===== OK-Order shop selector bar ===== */
.ok-shop-bar {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    background: #fff7f0; border: 1px solid #f7c9a8; border-radius: 10px;
    padding: 9px 14px; margin: 0 0 14px; font-size: 14px;
}
.ok-shop-icon { font-size: 18px; }
.ok-shop-bar label { font-weight: 700; color: #7c3d10; }
.ok-shop-bar select {
    padding: 6px 10px; border: 1px solid #eab68b; border-radius: 7px;
    background: #fff; font: inherit; color: #1c1917; min-width: 170px;
}
.ok-shop-hint { color: #a16038; font-size: 12px; }

/* ===== OK-Order avatar + dropdown ===== */
.ok-avatar-wrap { position: relative; display: inline-block; }
.ok-avatar-btn {
    width: 40px; height: 40px; border-radius: 50%; border: 2px solid #f26b1d;
    background: linear-gradient(135deg, #f26b1d, #b45309); color: #fff;
    font-size: 17px; font-weight: 700; cursor: pointer; overflow: hidden;
    display: grid; place-items: center; padding: 0; vertical-align: middle;
}
.ok-avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.ok-avatar-menu {
    position: absolute; right: 0; top: 48px; z-index: 1200; min-width: 210px;
    background: #fff; border: 1px solid #e5e5e5; border-radius: 12px;
    box-shadow: 0 14px 40px rgba(0,0,0,.18); overflow: hidden; padding: 6px 0;
}
.ok-menu-name {
    padding: 10px 16px 8px; font-weight: 700; border-bottom: 1px solid #f0f0f0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.ok-menu-item {
    display: block; width: 100%; text-align: left; padding: 9px 16px;
    background: none; border: none; font: inherit; font-size: 14px;
    color: #333; cursor: pointer; text-decoration: none;
}
.ok-menu-item:hover { background: #fff3ea; }
.ok-menu-logout { color: #c0392b; border-top: 1px solid #f0f0f0; margin-top: 4px; }

/* ===== OK-Order mini chat (same look as ok-order.com) ===== */
.ok-chat-fab {
    position: fixed; right: 22px; bottom: 22px; z-index: 1100;
    width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer; font-size: 25px;
    background: linear-gradient(135deg, #f26b1d, #7c3aed); color: #fff;
    box-shadow: 0 8px 24px rgba(242, 107, 29, .45); transition: transform .15s;
}
.ok-chat-fab:hover { transform: scale(1.06); }
.ok-chat-badge {
    position: absolute; top: -4px; right: -4px; background: #dc2626; color: #fff;
    font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 999px;
    display: grid; place-items: center; padding: 0 5px;
}
.ok-chat-panel {
    position: fixed; right: 22px; bottom: 92px; z-index: 1100;
    width: min(380px, calc(100vw - 32px)); height: min(500px, calc(100vh - 130px));
    background: #fff; border-radius: 18px; box-shadow: 0 24px 64px rgba(15,23,42,.35);
    overflow: hidden; display: flex; flex-direction: column;
}
.ok-chat-head {
    padding: 13px 16px; background: linear-gradient(135deg, #f26b1d, #7c3aed); color: #fff;
    display: flex; align-items: center; gap: 8px; font-weight: 700;
}
.ok-chat-head b { flex: 1; }
.ok-chat-dot { width: 9px; height: 9px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 8px #4ade80; }
.ok-chat-close { background: none; border: none; color: #fff; font-size: 15px; cursor: pointer; opacity: .8; }
.ok-chat-body { flex: 1; overflow-y: auto; padding: 14px; background: #f8fafc; }
.ok-chat-empty { text-align: center; color: #64748b; font-size: 13px; padding: 30px 10px; }
.ok-chat-msg { display: flex; margin-bottom: 8px; }
.ok-chat-msg.mine { justify-content: flex-end; }
.ok-chat-bubble {
    max-width: 78%; padding: 8px 13px; border-radius: 16px; font-size: 14px;
    background: #fff; border: 1px solid #e2e8f0; border-bottom-left-radius: 5px;
}
.ok-chat-msg.mine .ok-chat-bubble {
    background: linear-gradient(135deg, #f26b1d, #7c3aed); color: #fff; border: none;
    border-bottom-left-radius: 16px; border-bottom-right-radius: 5px;
}
.ok-chat-who { font-size: 11.5px; font-weight: 700; color: #7c3aed; margin-bottom: 2px; }
.ok-chat-time { font-size: 10.5px; opacity: .65; margin-top: 3px; }
.ok-chat-input { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e2e8f0; background: #fff; }
.ok-chat-input input {
    flex: 1; padding: 9px 13px; font-size: 14px; border: 1px solid #ddd; border-radius: 8px;
}
.ok-chat-input button {
    padding: 8px 16px; border: none; border-radius: 8px; cursor: pointer;
    background: #f26b1d; color: #fff; font-weight: 700;
}

/* ===== Current job + ORDER button in the shop bar ===== */
.ok-job-info {
    font-weight: 700; color: #1c1917; background: #fff; border: 1px solid #eab68b;
    border-radius: 7px; padding: 5px 12px; max-width: 320px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ok-order-btn {
    padding: 7px 22px; border: none; border-radius: 8px; cursor: pointer;
    background: linear-gradient(135deg, #1c1917 40%, #f26b1d); color: #fff;
    font-weight: 800; font-size: 14px; letter-spacing: .5px;
    box-shadow: 0 4px 12px rgba(28,25,23,.35); transition: transform .12s;
}
.ok-order-btn:hover { transform: translateY(-1px); }
.ok-phone-form { width: 320px; }
.ok-phone-form .ok-login-hint { margin-bottom: 10px; }

/* ===== Step wizard (index2.php) ===== */
#wizShell { margin-top: 4px; }
.wiz-steps {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    margin: 6px 0 18px; padding: 10px 14px; background: #fff;
    border: 1px solid #eee; border-radius: 12px; box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.wiz-chip {
    display: flex; align-items: center; gap: 8px; padding: 8px 16px;
    border: 1.5px solid #e5e5e5; border-radius: 999px; background: #fafafa;
    font: inherit; font-weight: 700; color: #888; cursor: pointer; transition: all .15s;
}
.wiz-num {
    width: 24px; height: 24px; border-radius: 50%; background: #d6d3d1; color: #fff;
    display: grid; place-items: center; font-size: 13px;
}
.wiz-chip.active { border-color: #f26b1d; background: #fff7f0; color: #b45309; }
.wiz-chip.active .wiz-num { background: #f26b1d; }
.wiz-chip.done { color: #16a34a; border-color: #bbf7d0; background: #f0fdf4; }
.wiz-chip.done .wiz-num { background: #16a34a; }
.wiz-arrow { color: #d6d3d1; font-size: 20px; font-weight: 700; }

.wiz-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 520px); gap: 20px; align-items: start; }
.wiz-panes { min-width: 0; }
.wiz-pane {
    background: #fff; border: 1px solid #eee; border-radius: 14px;
    padding: 20px 22px; box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.wiz-title { margin: 0 0 4px; font-size: 20px; }
.wiz-hint { margin: 0 0 16px; color: #78716c; font-size: 13.5px; }
.wiz-preview { position: sticky; top: 12px; }
.wiz-preview .preview-container {
    background: #fff; border: 1px solid #eee; border-radius: 14px;
    padding: 14px 16px; box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.wiz-preview canvas { max-width: 100%; height: auto; }
.wiz-advanced { margin-top: 16px; border-top: 1px dashed #e5e5e5; padding-top: 12px; }
.wiz-advanced summary { cursor: pointer; font-weight: 700; color: #78716c; font-size: 14px; }
.wiz-nav { display: flex; justify-content: space-between; margin: 16px 0 30px; }
.wiz-nav-btn {
    padding: 11px 26px; border: 1.5px solid #d6d3d1; border-radius: 10px;
    background: #fff; color: #44403c; font: inherit; font-weight: 700; cursor: pointer; font-size: 15px;
}
.wiz-nav-btn:hover { border-color: #f26b1d; color: #b45309; }
.wiz-next { background: linear-gradient(135deg, #f26b1d, #e8490f); border: none; color: #fff; box-shadow: 0 5px 16px rgba(242,107,29,.35); }
.wiz-next:hover { transform: translateY(-1px); }
.wiz-order-big { width: 100%; padding: 14px 0; font-size: 17px; margin-top: 14px; }
.wiz-order-hint { text-align: center; margin-top: 8px; color: #a8a29e; font-size: 13px; }
.wiz-order-hint.ready { color: #16a34a; font-weight: 700; }

@media (max-width: 980px) {
    .wiz-body { grid-template-columns: 1fr; }
    .wiz-preview { position: static; order: -1; }
}

/* ===== UI mode toggle (classic <-> wizard) ===== */
.wiz-mode-btn {
    padding: 7px 14px; border: 1.5px solid #eab68b; border-radius: 999px;
    background: #fff7f0; color: #b45309; font: inherit; font-size: 13px;
    font-weight: 700; cursor: pointer; margin-right: 10px; white-space: nowrap;
}
.wiz-mode-btn:hover { background: #ffe9d6; }
.wiz-mode-in-bar { margin-left: auto; margin-right: 0; }

/* ===== Header: wizard mode switch + text language button ===== */
.ui-mode-switch { display: flex; align-items: center; gap: 8px; margin-right: 14px; }
.ui-mode-label { font-weight: 700; font-size: 14px; color: #b45309; }
.lang-btn {
    background: none; border: none; padding: 4px 6px; cursor: pointer;
    font: inherit; font-weight: 700; font-size: 14px; color: #44403c;
}
.lang-btn:hover { color: #f26b1d; }

/* ===== Auto direct-manipulation mode ===== */
.element-button-auto {
    padding: 8px 14px; border: 1.5px solid #d6d3d1; border-radius: 6px;
    background: #fafafa; color: #57534e; font: inherit; font-weight: 700; cursor: pointer;
}
.element-button-auto.selected {
    background: linear-gradient(135deg, #f26b1d, #e8490f); border-color: #e8490f; color: #fff;
    box-shadow: 0 3px 10px rgba(242,107,29,.35);
}
canvas.ae-active { cursor: crosshair; }
#aeBox {
    position: absolute; z-index: 40; border: 2px dashed #f26b1d;
    background: rgba(242,107,29,.06); cursor: move; box-sizing: border-box;
}
.ae-tag {
    position: absolute; top: -22px; left: -2px; background: #f26b1d; color: #fff;
    font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; white-space: nowrap;
}
.ae-handle {
    position: absolute; width: 12px; height: 12px; background: #fff;
    border: 2px solid #f26b1d; border-radius: 3px; box-sizing: border-box;
}
.ae-nw { left: -7px; top: -7px; cursor: nwse-resize; }
.ae-ne { right: -7px; top: -7px; cursor: nesw-resize; }
.ae-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.ae-se { right: -7px; bottom: -7px; cursor: nwse-resize; }
