/* ==========================================================================
   TEACHER ASSISTANT TOOLBAR & BUTTON ERGONOMICS SYSTEM (.ta-*)
   - Áp dụng chuẩn tỉ lệ vàng từ Tabler UI + Open-Props + Shadcn/DaisyUI:
     + Chiều cao nút chuẩn WCAG 2.2 (38px–44px), căn giữa Icon-Text (gap 6px).
     + Bo góc thân thiện (10px cho nút, 14px cho khung chứa), hiệu ứng nhấn êm.
   - 100% Print-Safe: Toàn bộ thanh công cụ tự ẩn khi in (@media print).
   ========================================================================== */

/* --- Chuẩn hóa Ergonomics cho toàn bộ nút bấm khu vực làm việc --- */
.edtech-navbar .btn,
.edtech-sidebar .btn,
.ta-toolbar-wrap .btn,
.ta-bottom-dock .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-radius: 10px;
    font-weight: 700;
    letter-spacing: -0.01em;
    transition: transform 0.16s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.16s cubic-bezier(0.22, 1, 0.36, 1),
                background-color 0.15s ease, border-color 0.15s ease;
}

.edtech-navbar .btn.btn-pill,
.edtech-sidebar .btn.rounded-pill {
    border-radius: 999px;
}

.edtech-navbar .btn:hover:not(:disabled),
.edtech-sidebar .btn:hover:not(:disabled),
.ta-toolbar-wrap .btn:hover:not(:disabled),
.ta-bottom-dock .btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.edtech-navbar .btn:active:not(:disabled),
.edtech-sidebar .btn:active:not(:disabled),
.ta-toolbar-wrap .btn:active:not(:disabled),
.ta-bottom-dock .btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.edtech-sidebar .btn-lg {
    min-height: 48px;
    font-size: 0.98rem;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.edtech-print-grid .btn {
    min-height: 42px;
    font-size: 0.86rem;
    padding: 0.45rem 0.65rem;
}

.edtech-print-grid .btn-main-print {
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* --- Thanh Công cụ Trợ lý Giáo viên (Phía trên tờ giấy A4) --- */
.ta-toolbar-wrap {
    width: 100%;
    max-width: 820px;
    margin: 0 auto 0.65rem auto;
    padding: 0 0.5rem;
}

.ta-toolbar-card {
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    padding: 0.65rem 0.85rem;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.ta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.ta-group {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 11px;
    padding: 0.22rem 0.35rem;
    min-height: 38px;
}

.ta-action-btn {
    min-height: 36px;
    padding: 0.32rem 0.72rem !important;
    font-size: 0.82rem !important;
    border-radius: 9px !important;
    white-space: nowrap;
}

.ta-code-btn {
    border: 1px solid transparent;
    background: transparent;
    color: #334155;
    font-size: 0.81rem;
    font-weight: 800;
    min-height: 30px;
    padding: 0.22rem 0.58rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.14s ease;
}

.ta-code-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.ta-code-btn.is-active {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(37, 99, 235, 0.28);
}

.ta-quick-templates {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #e2e8f0;
}

.ta-tpl-pill {
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e40af;
    font-size: 0.78rem;
    font-weight: 700;
    min-height: 31px;
    padding: 0.24rem 0.72rem;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ta-tpl-pill:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(37, 99, 235, 0.22);
}

/* --- Thanh Hành động Điểm Đích (Point-of-Need Dock ngay dưới tờ giấy A4) --- */
.ta-bottom-dock {
    width: 100%;
    max-width: 794px;
    margin: 4px auto 18px auto;
    padding: 0.7rem 0.9rem;
    background: #ffffff;
    border: 1.5px solid #cbd5e1;
    border-radius: 14px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.ta-bottom-dock .ta-dock-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.ta-bottom-dock .btn {
    min-height: 40px;
    padding: 0.42rem 0.9rem;
    font-size: 0.86rem;
}

.ta-edit-banner {
    margin-top: 0.45rem;
    background: #fefce8;
    border: 1px dashed #eab308;
    color: #713f12;
    border-radius: 8px;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.ta-toast {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.45rem;
    background: #ecfdf5;
    border: 1px solid #10b981;
    color: #065f46;
    border-radius: 8px;
    padding: 0.38rem 0.7rem;
    font-size: 0.82rem;
    font-weight: 700;
}

/* Cỡ chữ gọn A- (11pt) giúp giáo viên THCS/THPT tiết kiệm giấy photocopy */


/* Chế độ sửa chữ trực tiếp trên giấy (chỉ hiện viền gợi ý trên màn hình, TẮT KHI IN) */
@media screen {
    body.is-live-paper-edit #a4-sheets-wrapper .sheet [data-paper-edit="1"] {
        outline: 1px dashed rgba(37, 99, 235, 0.38);
        outline-offset: 2px;
        border-radius: 3px;
        cursor: text;
    }
    body.is-live-paper-edit #a4-sheets-wrapper .sheet [data-paper-edit="1"]:hover,
    body.is-live-paper-edit #a4-sheets-wrapper .sheet [data-paper-edit="1"]:focus {
        outline: 2px solid #2563eb;
        background-color: rgba(239, 246, 255, 0.55);
    }
}

@media print {
    .ta-toolbar-wrap, .ta-toolbar-card, .ta-quick-templates,
    .ta-edit-banner, .ta-toast, .ta-coffee-card, .ta-bottom-dock {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    #a4-sheets-wrapper .sheet [data-paper-edit="1"] {
        outline: none !important;
        background-color: transparent !important;
    }
}

body.is-exporting-pdf .ta-toolbar-wrap,
body.is-exporting-pdf .ta-coffee-card,
body.is-exporting-pdf .ta-bottom-dock {
    display: none !important;
}

body.hide-writing-lines .ex-scram-item > div[style*="dotted"] { display: none !important; }
body.hide-writing-lines .ex-read-box { white-space: normal; }
body.is-batch-pack-printing #a4-sheets-wrapper > .sheet:not(.batch-pack-sheet) { display: none !important; }

.batch-master-key-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 11.5px; }
.batch-master-key-table th, .batch-master-key-table td { border: 1px solid #334155; padding: 4px 6px; vertical-align: top; }
.batch-master-key-table th { background: #f1f5f9; font-weight: 800; text-align: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
