/**
 * File: assets/css/style.css
 * Giao diện App toàn màn hình cho Mr Khang AI
 */

/* ==========================================================================
   1. RESET & BASE (Cách ly khỏi Theme WordPress)
   ========================================================================== */
.mk-fullscreen-app {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #f3f4f6;
    z-index: 999999; /* Đè lên cả Admin Bar của WordPress */
    display: flex;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1f2937;
    overflow: hidden;
    box-sizing: border-box;
}

.mk-fullscreen-app * {
    box-sizing: border-box;
}

/* ==========================================================================
   2. SIDEBAR CÔNG CỤ (Cột trái)
   ========================================================================== */
.mk-sidebar {
    width: 340px;
    background-color: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

.mk-brand-header {
    padding: 24px 20px;
    border-bottom: 1px solid #e5e7eb;
    text-align: center;
    background-color: #fafaf9;
}

.mk-app-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #b91c1c; /* Đỏ sẫm trang trọng */
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mk-app-subtitle {
    display: block;
    font-size: 13px;
    color: #6b7280;
    margin-top: 5px;
    font-weight: 500;
}

.mk-sidebar-section {
    padding: 20px;
    border-bottom: 1px solid #f3f4f6;
}

.mk-section-title {
    margin: 0 0 10px 0;
    font-size: 15px;
    font-weight: 600;
    color: #374151;
}

.mk-section-desc {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 12px 0;
    line-height: 1.5;
}

/* Khu vực tải file */
.mk-file-upload-wrapper {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    background-color: #f9fafb;
    transition: all 0.2s ease;
}

.mk-file-upload-wrapper:hover {
    border-color: #b91c1c;
    background-color: #fef2f2;
}

#mk-file-input {
    width: 100%;
    font-size: 13px;
    color: #4b5563;
    cursor: pointer;
}

.mk-status-text {
    font-size: 13px;
    color: #059669; /* Xanh lá báo thành công */
    margin-top: 8px;
    font-weight: 500;
}

.mk-file-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    font-size: 13px;
    color: #4b5563;
}

.mk-file-list li {
    padding: 5px 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
}

.mk-file-list li::before {
    content: "📎";
    margin-right: 6px;
}

/* Khu vực Option (Stick) */
.mk-options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mk-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
}

.mk-option-checkbox {
    margin-top: 3px;
    margin-right: 10px;
    accent-color: #b91c1c;
    cursor: pointer;
}

.mk-checkbox-text {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.4;
}

/* Nút bấm ở Sidebar */
.mk-sidebar-bottom {
    padding: 20px;
    margin-top: auto; /* Đẩy xuống cuối cùng */
    background-color: #fafaf9;
    border-top: 1px solid #e5e7eb;
}

/* ==========================================================================
   3. KHÔNG GIAN LÀM VIỆC (Cột phải)
   ========================================================================== */
.mk-main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: #e5e7eb; /* Màu nền tối hơn giấy để làm nổi bật trang A4 */
}

/* Toolbar phía trên */
.mk-top-toolbar {
    height: 60px;
    background-color: #ffffff;
    border-bottom: 1px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    z-index: 10;
}

.mk-doc-status {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* Vùng chứa Editor (Cuộn trang) */
.mk-editor-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 40px 20px;
    display: flex;
    justify-content: center;
}

/* Tờ giấy A4 (Quill Editor Container) */
#mk-editor-container {
    width: 100%;
    max-width: 850px; /* Chiều rộng chuẩn A4 */
    background-color: #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    border: none;
    min-height: 1056px; /* Chiều cao tối thiểu trang A4 */
}

/* Tùy chỉnh trực tiếp giao diện bên trong QuillJS */
.ql-container.ql-snow {
    border: none !important;
}

.ql-editor {
    padding: 60px 70px !important; /* Lề trang giấy hành chính */
    font-family: "Times New Roman", Times, serif; /* Phông chuẩn Nghị định 30 */
    font-size: 14pt; /* Cỡ chữ 14 */
    line-height: 1.5;
    color: #000000;
    min-height: 100%;
}

.ql-editor p {
    margin-bottom: 10px;
    text-align: justify;
}

.ql-editor h2, .ql-editor h3 {
    text-align: center;
    font-weight: bold;
    margin-top: 20px;
    margin-bottom: 15px;
}

/* ==========================================================================
   4. KHU VỰC CHAT (Dưới cùng)
   ========================================================================== */
.mk-chat-panel {
    background-color: #ffffff;
    border-top: 1px solid #d1d5db;
    padding: 20px 40px;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.03);
    z-index: 10;
}

.mk-chat-input-wrapper {
    display: flex;
    gap: 15px;
    max-width: 1000px;
    margin: 0 auto;
}

.mk-prompt-textarea {
    flex: 1;
    height: 60px;
    min-height: 60px;
    max-height: 150px;
    padding: 15px 20px;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    resize: vertical;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05);
    transition: border-color 0.2s;
}

.mk-prompt-textarea:focus {
    outline: none;
    border-color: #b91c1c;
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.mk-chat-footer-note {
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 12px;
}

/* ==========================================================================
   5. BUTTONS & COMPONENTS
   ========================================================================== */
.mk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    font-family: inherit;
    width: 100%;
}

.mk-mt-2 {
    margin-top: 10px;
}

.mk-btn-primary {
    background-color: #2563eb;
    color: #ffffff;
    width: auto;
}
.mk-btn-primary:hover { background-color: #1d4ed8; }

.mk-btn-outline {
    background-color: transparent;
    border: 1px solid #d1d5db;
    color: #374151;
}
.mk-btn-outline:hover { background-color: #f3f4f6; border-color: #9ca3af; }

.mk-btn-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}
.mk-btn-danger:hover { background-color: #fecaca; }

.mk-btn-submit {
    background-color: #b91c1c;
    color: white;
    width: auto;
    padding: 0 32px;
    border-radius: 24px;
    font-size: 16px;
}
.mk-btn-submit:hover { background-color: #991b1b; }
.mk-btn-submit:disabled { background-color: #9ca3af; cursor: not-allowed; }

/* Tooltip đơn giản */
.mk-tooltip {
    position: relative;
}
.mk-tooltip[title]:hover::after {
    content: attr(title);
    position: absolute;
    top: 100%; left: 50%; transform: translateX(-50%);
    background: #1f2937; color: white;
    padding: 6px 10px; border-radius: 4px;
    font-size: 12px; font-weight: normal;
    white-space: nowrap; margin-top: 8px;
    z-index: 100;
}

/* ==========================================================================
   6. LOADING ANIMATION (Con xoay khi AI xử lý)
   ========================================================================== */
.mk-loader {
    display: flex;
    align-items: center;
    justify-content: center;
}
.mk-spinner {
    animation: rotate 2s linear infinite;
    z-index: 2;
    width: 24px;
    height: 24px;
}
.mk-spinner .path {
    stroke: #ffffff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}
@keyframes rotate { 100% { transform: rotate(360deg); } }
@keyframes dash {
    0% { stroke-dasharray: 1, 150; stroke-dashoffset: 0; }
    50% { stroke-dasharray: 90, 150; stroke-dashoffset: -35; }
    100% { stroke-dasharray: 90, 150; stroke-dashoffset: -124; }
}