/* ============================================
   TNC – Tạo Mã QR | style.css
   Namespace: .tnc-qr__
   ============================================ */

.tnc-qr__wrapper {
    max-width: 960px;
    margin: 0 auto;
    padding: 28px 24px;
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-sizing: border-box;
    display: flex;
    gap: 0;
}

/* ── 2 cột desktop ── */
.tnc-qr__col-left {
    flex: 1;
    min-width: 0;
    padding-right: 28px;
    border-right: 1px solid #e0e0e0;
}

.tnc-qr__col-right {
    width: 320px;
    min-width: 300px;
    flex-shrink: 0;
    padding-left: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Nút tạo QR trên desktop nằm trong col-right */
.tnc-qr__col-right .tnc-qr__btn-tao {
    width: 100%;
    margin-bottom: 20px;
}

/* Kết quả sticky trong col-right */
.tnc-qr__col-right .tnc-qr__ket-qua {
    margin-top: 0;
    width: 100%;
}

.tnc-qr__col-right .tnc-qr__canvas {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 12px;
    margin-bottom: 12px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Canvas luôn co vừa col-right */
.tnc-qr__col-right .tnc-qr__canvas canvas {
    max-width: 100%;
    height: auto !important;
}

.tnc-qr__col-right .tnc-qr__thong-bao {
    width: 100%;
    margin-top: 8px;
}

/* ── Form ── */
.tnc-qr__form-group {
    margin-bottom: 16px;
}

.tnc-qr__label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.tnc-qr__textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #d0d5dd;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    color: #344054;
    resize: vertical;
    box-sizing: border-box;
    transition: border-color 0.2s;
    outline: none;
}

.tnc-qr__textarea:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.12);
}

/* ── Loại nhanh ── */
.tnc-qr__loai-group {
    margin-bottom: 18px;
}

.tnc-qr__loai-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #667085;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.tnc-qr__loai-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tnc-qr__btn-loai {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 5px;
    font-size: 13px;
    font-weight: 500;
    border: 1.5px solid #e0e4ea;
    border-radius: 10px;
    background: #f8f9fb;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    width: 100px;
}

.tnc-qr__btn-loai:hover {
    background: #eef3fb;
    border-color: #2271b1;
    color: #2271b1;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(34,113,177,0.15);
}

.tnc-qr__btn-loai.active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    box-shadow: 0 3px 10px rgba(34,113,177,0.35);
    transform: translateY(-1px);
}

.tnc-qr__btn-loai.active:hover {
    background: #135e96;
    border-color: #135e96;
}

.tnc-qr__btn-icon {
    font-size: 15px;
    line-height: 1;
}

.tnc-qr__btn-text {
    font-size: 13px;
}

/* ── Nút tạo QR ── */
.tnc-qr__btn-tao {
    width: 100%;
    padding: 12px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    letter-spacing: 0.3px;
}

.tnc-qr__btn-tao:hover {
    background: #135e96;
}

.tnc-qr__btn-tao:active {
    background: #0d4473;
}

/* ── Kết quả ── */
.tnc-qr__ket-qua {
    margin-top: 24px;
    text-align: center;
}

.tnc-qr__canvas {
    display: inline-block;
    padding: 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    margin-bottom: 16px;
}

.tnc-qr__canvas canvas,
.tnc-qr__canvas img {
    display: block;
}

/* ── Actions ── */
.tnc-qr__actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tnc-qr__btn-tai {
    padding: 9px 20px;
    background: #00a32a;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.tnc-qr__btn-tai:hover {
    background: #008a20;
}

.tnc-qr__btn-lam-lai {
    padding: 9px 20px;
    background: #f6f7f7;
    color: #50575e;
    border: 1px solid #c3c4c7;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.tnc-qr__btn-lam-lai:hover {
    background: #dcdcde;
}

/* ── Thông báo ── */
.tnc-qr__thong-bao {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
}

.tnc-qr__thong-bao.loi {
    background: #fcf0f1;
    color: #8a1f11;
    border: 1px solid #f5c5c0;
}

.tnc-qr__thong-bao.thanh-cong {
    background: #edfaef;
    color: #145a23;
    border: 1px solid #a7e8b3;
}

/* ── Responsive ── */
@media (max-width: 700px) {
    .tnc-qr__wrapper {
        flex-direction: column;
        padding: 20px 16px;
        max-width: 480px;
    }
    .tnc-qr__col-left {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding-bottom: 20px;
        margin-bottom: 20px;
    }
    .tnc-qr__col-right {
        width: 100%;
        min-width: 0;
        padding-left: 0;
    }
}

/* ── Logo upload ── */
.tnc-qr__logo-group {
    margin-bottom: 18px;
}

.tnc-qr__label-optional {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
    margin-left: 4px;
}

.tnc-qr__logo-upload-area {
    position: relative;
    border: 2px dashed #d0d5dd;
    border-radius: 10px;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    overflow: hidden;
    min-height: 90px;
}

.tnc-qr__logo-upload-area:hover {
    border-color: #2271b1;
    background: #f0f6ff;
}

.tnc-qr__logo-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.tnc-qr__logo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    gap: 4px;
    pointer-events: none;
}

.tnc-qr__logo-icon {
    font-size: 28px;
    line-height: 1;
    margin-bottom: 4px;
}

.tnc-qr__logo-hint {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.tnc-qr__logo-sub {
    font-size: 11px;
    color: #9ca3af;
}

/* Preview logo đã chọn */
.tnc-qr__logo-preview {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 90px;
}

.tnc-qr__logo-preview img {
    max-height: 60px;
    max-width: 80%;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.tnc-qr__logo-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    line-height: 1;
    transition: background 0.15s;
}

.tnc-qr__logo-remove:hover {
    background: #dc2626;
}

/* Slider kích thước */
.tnc-qr__logo-size-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.tnc-qr__logo-size-label {
    font-size: 12px;
    color: #667085;
    white-space: nowrap;
    font-weight: 500;
}

.tnc-qr__logo-size-range {
    flex: 1;
    accent-color: #2271b1;
    cursor: pointer;
}

.tnc-qr__logo-size-val {
    font-size: 12px;
    font-weight: 700;
    color: #2271b1;
    min-width: 34px;
    text-align: right;
}

/* ── Chọn kiểu khung logo ── */
.tnc-qr__logo-shape-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.tnc-qr__shape-buttons {
    display: flex;
    gap: 8px;
}

.tnc-qr__btn-shape {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 500;
    border: 1.5px solid #e0e4ea;
    border-radius: 8px;
    background: #f8f9fb;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.18s ease;
}

.tnc-qr__btn-shape:hover {
    border-color: #2271b1;
    color: #2271b1;
    background: #eef3fb;
}

.tnc-qr__btn-shape.active {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
    box-shadow: 0 2px 8px rgba(34,113,177,0.3);
}

.tnc-qr__btn-shape svg {
    flex-shrink: 0;
}

/* ── Chọn màu sắc QR ── */
.tnc-qr__mau-group {
    margin-bottom: 18px;
}

.tnc-qr__mau-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.tnc-qr__mau-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    min-width: 140px;
}

.tnc-qr__mau-label {
    font-size: 12px;
    font-weight: 500;
    color: #667085;
}

/* Color picker tự viết */
.tnc-pickr-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}
.tnc-pickr-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 8px;
    border: 1.5px solid #d0d5dd;
    cursor: pointer;
    padding: 0;
    transition: border-color 0.2s, transform 0.1s;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.2);
}
.tnc-pickr-btn:hover {
    border-color: #2271b1;
    transform: scale(1.06);
}
.tnc-pickr-hex {
    flex: 1;
    height: 40px;
    padding: 0 10px;
    border: 1.5px solid #d0d5dd;
    border-radius: 8px;
    font-size: 13px;
    font-family: monospace;
    color: #344054;
    background: #fff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
    text-transform: uppercase;
}
.tnc-pickr-hex:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,0.12);
}
#tnc-cp-popup {
    position: absolute;
    z-index: 999999;
    display: none;
    background: #1e1e2e;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.28);
    width: 284px;
    overflow: hidden;
    border: 1px solid #333;
}
#tnc-cp-hex:focus {
    border-color: #2271b1 !important;
    outline: none;
}
#tnc-cp-ok:hover {
    background: #1a5e9a !important;
}
/* ── WiFi Form ── */
.tnc-qr__wifi-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tnc-qr__wifi-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.tnc-qr__wifi-label {
    font-size: 13px;
    font-weight: 600;
    color: #344054;
}
.tnc-qr__wifi-input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #d0d5dd;
    border-radius: 8px;
    font-size: 14px;
    color: #1d2327;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.2s;
    outline: none;
}
.tnc-qr__wifi-input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34,113,177,0.12);
}
.tnc-qr__wifi-pass-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.tnc-qr__wifi-pass-wrap .tnc-qr__wifi-input {
    padding-right: 44px;
}
.tnc-qr__wifi-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.tnc-qr__wifi-toggle:hover { opacity: 1; }
.tnc-qr__wifi-security {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}
.tnc-qr__wifi-radio {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #344054;
    cursor: pointer;
}
.tnc-qr__wifi-radio input { cursor: pointer; }

/* ── WiFi Icon Picker ── */
.tnc-qr__wifi-icons {
    margin-bottom: 10px;
}
.tnc-qr__wifi-icons-label {
    font-size: 13px;
    font-weight: 600;
    color: #344054;
    margin: 0 0 8px 0;
}
.tnc-qr__wifi-icons-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.tnc-qr__wifi-icon-btn {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #e0e4ea;
    border-radius: 12px;
    background: #f8f9fb;
    cursor: pointer;
    transition: all 0.18s ease;
    color: #1a73e8;
    padding: 0;
}
.tnc-qr__wifi-icon-btn:hover {
    border-color: #1a73e8;
    background: #eef4fd;
}
.tnc-qr__wifi-icon-btn.active {
    border-color: #1a73e8;
    background: #dbeafe;
    box-shadow: 0 0 0 3px rgba(26,115,232,0.15);
}

/* ── Khung ngoài ── */
.tnc-qr__section {
    margin-bottom: 16px;
}
.tnc-qr__khung-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.tnc-qr__khung-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 8px;
    border: 1.5px solid #e0e4ea;
    border-radius: 10px;
    background: #f8f9fb;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 64px;
}
.tnc-qr__khung-btn:hover { border-color: #2271b1; background: #eef4fd; }
.tnc-qr__khung-btn.active { border-color: #2271b1; background: #dbeafe; box-shadow: 0 0 0 3px rgba(34,113,177,0.12); }
.tnc-qr__khung-name { font-size: 11px; color: #4a5568; }
.tnc-qr__khung-preview {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: #333;
}
.tnc-khung-none { background: #fff; border: 1px dashed #ccc; border-radius: 4px; }
.tnc-khung-shadow { background: #fff; border-radius: 4px; box-shadow: 0 3px 10px rgba(0,0,0,0.22); }
.tnc-khung-border { background: #fff; border: 3px solid #333; }
.tnc-khung-rounded { background: #fff; border: 3px solid #2271b1; border-radius: 10px; }
.tnc-khung-polaroid { background: #fff; border: 1px solid #e0e0e0; border-radius: 3px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); padding-bottom: 8px; }
.tnc-khung-dark { background: #1a1a2e; border-radius: 8px; color: #fff; }

/* ── Dòng chữ dưới ── */
.tnc-qr__input-text {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #d0d5dd;
    border-radius: 8px;
    font-size: 14px;
    color: #1d2327;
    background: #fff;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 10px;
}
.tnc-qr__input-text:focus { border-color: #2271b1; box-shadow: 0 0 0 3px rgba(34,113,177,0.12); }
.tnc-qr__chu-options { display: flex; flex-direction: column; gap: 8px; }
.tnc-qr__chu-opt-row {
    display: flex; align-items: center; gap: 8px;
}
.tnc-qr__chu-opt-label {
    font-size: 12px; font-weight: 600; color: #4a5568;
    min-width: 62px;
}
.tnc-qr__chu-select {
    flex: 1; height: 36px; border: 1.5px solid #d0d5dd;
    border-radius: 8px; font-size: 13px; padding: 0 8px;
    background: #fff; color: #344054; outline: none;
}
.tnc-qr__chu-select:focus { border-color: #2271b1; }

/* ── Chất lượng xuất ── */
.tnc-qr__chat-luong {
    margin-bottom: 10px;
    width: 100%;
}
.tnc-qr__chat-luong-label {
    font-size: 12px;
    font-weight: 600;
    color: #667085;
    display: block;
    margin-bottom: 6px;
}
.tnc-qr__chat-luong-btns {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.tnc-qr__cl-btn {
    flex: 1;
    padding: 6px 4px;
    border: 1.5px solid #e0e4ea;
    border-radius: 8px;
    background: #f8f9fb;
    color: #4a5568;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    line-height: 1.3;
}
.tnc-qr__cl-btn span {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: #9ca3af;
}
.tnc-qr__cl-btn:hover {
    border-color: #2271b1;
    background: #eef4fd;
    color: #2271b1;
}
.tnc-qr__cl-btn.active {
    border-color: #2271b1;
    background: #2271b1;
    color: #fff;
}
.tnc-qr__cl-btn.active span { color: #bfdbfe; }