/* ==========================================================================
   1. GLOBAL SETTINGS & RESET
   ========================================================================== */
body, h1, h2, h3, h4, h5, h6, input, button, select, textarea, .thx-survey-container * { 
    margin: 0; 
    padding: 0;
    font-family: 'Be Vietnam Pro', sans-serif !important; 
    -webkit-font-smoothing: antialiased; 
    box-sizing: border-box;
}

/* Wrapper chung */
.thx-survey-wrapper-global {
    background: #f8fafc;
    min-height: 80vh;
    width: 100%;
    color: #334155;
    line-height: 1.6;
}

/* Link quay lại */
.back-link { 
    text-decoration: none; color: #64748b; font-size: 14px; font-weight: 600; 
    display: flex; align-items: center; gap: 6px; padding: 6px 12px; 
    border-radius: 6px; transition: all 0.2s; 
}
.back-link:hover { background: #f1f5f9; color: #0f172a; }


/* ==========================================================================
   2. BUTTONS STANDARD (ĐỒNG BỘ HÓA TẤT CẢ NÚT)
   ========================================================================== */
/* Nút Chính (Cam) */
.thx-submit-btn { 
    background: #dd6b20; 
    color: #fff; 
    border: none; 
    height: 48px; /* Chiều cao chuẩn cho mọi nơi */
    padding: 0 30px; 
    font-size: 16px; 
    font-weight: 700; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: all 0.2s; 
    box-shadow: 0 4px 6px rgba(221, 107, 32, 0.25); 
    display: inline-flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px;
    text-decoration: none; 
    line-height: 1;
}
.thx-submit-btn:hover { background: #c05621; transform: translateY(-1px); box-shadow: 0 6px 12px rgba(221, 107, 32, 0.35); }
.thx-submit-btn:disabled { background: #cbd5e0; cursor: not-allowed; transform: none; box-shadow: none; }

/* Nút Phụ (Viền cam) */
.thx-secondary-btn { 
    background: #fff; 
    color: #dd6b20; 
    border: 2px solid #dd6b20; 
    height: 48px; /* Cùng chiều cao với nút chính */
    padding: 0 30px; 
    font-size: 16px; 
    font-weight: 700; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: all 0.2s; 
    display: inline-flex;
    gap: 5px;
    align-items: center; 
    justify-content: center; 
    text-decoration: none; 
    line-height: 1;
    box-sizing: border-box;
}
.thx-secondary-btn:hover { background: #fff7ed; border-color: #c05621; color: #c05621; }


/* ==========================================================================
   3. SUB-HEADER
   ========================================================================== */
.thx-sub-header { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 12px 20px; box-shadow: 0 2px 4px rgba(0,0,0,0.02); position: sticky; top: 0; z-index: 999; }
.thx-container-fluid { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.thx-brand-link { display: flex; align-items: center; text-decoration: none !important; transition: opacity 0.2s; }
.thx-brand-link:hover { opacity: 0.8; }
.thx-header-actions { display: flex; gap: 10px; align-items: center; }
.thx-mini-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; font-size: 13px; font-weight: 600; text-decoration: none !important; background: #f1f5f9; color: #475569; border: 1px solid transparent; transition: all 0.2s; }
.thx-mini-btn:hover { background: #e2e8f0; color: #1e293b; }
.thx-mini-btn.outline { background: #fff; border-color: #e2e8f0; }
.thx-mini-btn.outline:hover { border-color: #cbd5e0; background: #f8fafc; }


/* ==========================================================================
   4. DASHBOARD (GRID CARD STYLE)
   ========================================================================== */
.thx-dashboard-wrap { max-width: 1100px; margin: 40px auto; width: 100%; padding: 0 20px; }

.thx-dash-header { 
    display: flex; justify-content: space-between; align-items: flex-end; 
    margin-bottom: 40px; padding-bottom: 20px; border-bottom: 1px solid #e2e8f0; 
}
.thx-dash-header h1 { font-size: 28px; font-weight: 800; color: #1e293b; margin: 0; line-height: 1.2; }

/* [FIXED] Không ép chiều cao nút ở đây nữa, dùng chuẩn chung */
.thx-dash-header .thx-submit-btn, 
.thx-dash-header .thx-secondary-btn { margin: 0; }

/* GRID LAYOUT */
.thx-dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 25px; }

/* CARD ITEM */
.thx-dash-card { background: #fff; border-radius: 12px; border: 1px solid #e2e8f0; overflow: hidden; transition: all 0.3s ease; display: flex; flex-direction: column; position: relative; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.thx-dash-card:hover { transform: translateY(-5px); box-shadow: 0 12px 20px -5px rgba(0,0,0,0.1); border-color: #cbd5e0; }

/* Card Header */
.thx-card-header { padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px dashed #f1f5f9; }
.thx-status-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 4px 10px; border-radius: 20px; letter-spacing: 0.5px; }
.thx-status-badge.active { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.thx-status-badge.locked { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.thx-sharing-badge { color: #94a3b8; font-size: 16px; }

/* Card Body */
.thx-card-body { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.thx-card-title { font-size: 16px; font-weight: 700; margin: 0 0 15px 0; line-height: 1.5; height: 48px; overflow: hidden; }
.thx-card-title a { text-decoration: none; color: #1e293b; transition: color 0.2s; }
.thx-card-title a:hover { color: #dd6b20; }
.thx-card-stats { margin-top: auto; display: flex; align-items: flex-end; gap: 8px; padding-top: 15px; }
.stat-number { font-size: 28px; font-weight: 800; color: #2c3e50; line-height: 1; }
.stat-label { font-size: 12px; color: #64748b; font-weight: 600; padding-bottom: 4px; }
.thx-card-date { font-size: 12px; color: #94a3b8; margin-top: 10px; display: flex; align-items: center; gap: 5px; }

/* Card Footer */
.thx-card-footer { background: #f8fafc; border-top: 1px solid #e2e8f0; padding: 10px 20px; display: flex; justify-content: space-between; }
.card-btn { text-decoration: none; color: #64748b; font-size: 16px; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; transition: all 0.2s; }
.card-btn:hover { background: #fff; color: #dd6b20; box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.card-btn.delete:hover { color: #ef4444; }

/* Empty State & Pagination */
.thx-empty-state { text-align: center; padding: 80px 20px; background: #fff; border-radius: 12px; border: 2px dashed #cbd5e0; }
.thx-empty-state p { font-size: 16px; color: #64748b; margin-bottom: 25px; }
.thx-pagination { margin-top: 40px; text-align: center; }
.thx-pagination .page-numbers { display: inline-block; padding: 8px 16px; margin: 0 4px; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; text-decoration: none; color: #475569; font-weight: 600; transition: all 0.2s; }
.thx-pagination .page-numbers:hover, .thx-pagination .page-numbers.current { background: #dd6b20; color: #fff; border-color: #dd6b20; }


/* ==========================================================================
   5. EDITOR (SOẠN THẢO)
   ========================================================================== */
.thx-survey-editor-wrap { max-width: 900px; margin: 40px auto; padding: 40px; background: #fff; border-radius: 12px; box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05); }
.thx-editor-toolbar { background: #f8fafc; padding: 12px 15px; border-radius: 6px; border: 1px solid #e2e8f0; margin-bottom: 25px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.thx-meta-badge { font-size: 12px; font-weight: 600; color: #64748b; }
.thx-meta-badge span { color: #dd6b20; font-weight: 800; text-transform: uppercase; }
.thx-editor-section { margin-bottom: 30px; }
.thx-editor-section label { display: block; font-weight: 600; font-size: 14px; color: #334155; margin-bottom: 8px; }
.thx-form-control { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #cbd5e0; border-radius: 6px; font-size: 14px; color: #1e293b; transition: border-color 0.2s; }
.thx-form-control:focus { border-color: #2b6cb0; outline: none; }
.thx-form-control.sm { height: 36px; font-size: 13px; }
textarea.thx-form-control { height: auto; min-height: 100px; padding: 12px; resize: vertical; }
.thx-editor-option-row { background: #f8fafc; border: 1px solid #e2e8f0; padding: 15px; border-radius: 8px; margin-bottom: 12px; position: relative; }
.thx-opt-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 11px; font-weight: 700; color: #94a3b8; text-transform: uppercase; }
.thx-btn-remove { background: none; border: none; color: #ef4444; font-size: 18px; cursor: pointer; opacity: 0.6; padding: 0; }
.thx-opt-meta { display: flex; gap: 10px; margin-top: 10px; } .thx-opt-meta input { flex: 1; }
.thx-btn-add { width: 100%; padding: 12px; border: 2px dashed #cbd5e0; background: #fff; color: #64748b; font-weight: 600; cursor: pointer; border-radius: 8px; transition: all 0.2s; }
.thx-btn-add:hover { border-color: #dd6b20; color: #dd6b20; background: #fff7ed; }
.bg-light { background: #f8fafc; padding: 20px; border-radius: 8px; border: 1px solid #f1f5f9; }
.thx-row { display: flex; gap: 20px; margin-bottom: 15px; } .thx-col { flex: 1; }
.thx-toggles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 20px; }
.thx-toggles label { display: flex; align-items: center; gap: 10px; padding: 10px 15px; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; cursor: pointer; font-size: 14px; transition: all 0.2s; }
.thx-toggles label:hover { border-color: #cbd5e0; }
.thx-toggles input { width: 16px; height: 16px; accent-color: #dd6b20; }
.thx-editor-actions { display: flex; align-items: center; gap: 15px; margin-top: 30px; padding-top: 20px; border-top: 1px solid #f1f5f9; }
.thx-cancel-btn { text-decoration: none; color: #64748b; font-size: 14px; font-weight: 600; }


/* ==========================================================================
   6. SINGLE SURVEY DISPLAY (FORM VOTE - BẢN GỐC)
   ========================================================================== */
.thx-survey-content { flex: 1; display: flex; justify-content: center; padding: 50px 20px; }
.survey-card { background: #fff; width: 100%; max-width: 900px; padding: 50px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.05); border: 1px solid #edf2f7; margin: 0 auto; }
.thx-survey-embed { box-shadow: none; border: 1px solid #e2e8f0; padding: 30px; }

.survey-title { margin-top: 0; font-family: 'Great Vibes', cursive !important; font-size: 70px; font-weight: 400; color: #1a202c; line-height: 1.2; margin-bottom: 15px; text-align: center; text-shadow: 1px 1px 2px rgba(0,0,0,0.1); }

/* Meta Info [FIXED] */
.survey-meta { font-size: 14px; color: #718096; display: inline-flex; align-items: center; justify-content: center; margin: 0 auto 25px auto; padding: 5px 16px; border-radius: 20px; background: #f7fafc; font-weight: 500; position: relative; left: 50%; transform: translateX(-50%); }
.survey-meta.upcoming { color: #d69e2e; background: #fffff0; border: 1px solid #fefcbf; }
.survey-meta.ended { color: #e53e3e; background: #fff5f5; border: 1px solid #fed7d7; }
.thx-meta-divider { margin: 0 10px; color: #cbd5e0; }
.thx-voter-count { color: #4a5568; font-weight: 600; }

.survey-desc { font-size: 17px; line-height: 1.6; color: #4a5568; margin-bottom: 35px; border-bottom: 2px solid #edf2f7; padding-bottom: 25px; }
.thx-instruction { font-size: 13px; color: #718096; font-style: italic; }
.show-results .thx-instruction { display: none !important; }

/* Grid & Options */
.thx-options-list { display: grid; gap: 15px; width: 100%; }
.thx-grid-1 { grid-template-columns: 1fr; }
.thx-grid-2 { grid-template-columns: repeat(2, 1fr); }
.thx-grid-3 { grid-template-columns: repeat(3, 1fr); }

.thx-option-row { padding: 15px; border: 2px solid #e2e8f0; border-radius: 8px; background: #fff; transition: all 0.2s; display: flex; flex-direction: column; justify-content: flex-start; height: 100%; box-sizing: border-box; position: relative; }
.thx-option-row:hover { border-color: #f6ad55; background: #fffaf0; }
.thx-option-row.thx-row-voted { border-color: #dd6b20; background: #fffaf0; }
.thx-option-row.thx-row-priority { border-color: #38a169; background: #f0fff4; }
.thx-option-row input:disabled { cursor: not-allowed; }
.thx-option-row label[disabled] { cursor: not-allowed; color: #a0aec0; }

.thx-input-label { display: flex; align-items: flex-start; cursor: pointer; width: 100%; position: relative; gap: 12px; z-index: 2; }
.thx-input-label input { margin: 0; margin-top: 3px; transform: scale(1.3); flex-shrink: 0; cursor: pointer; accent-color: #dd6b20; }
.thx-label-content { flex: 1; display: block; position: relative; line-height: 1.4; }
.thx-radio-text { font-size: 16px; font-weight: 600; color: #2d3748; display: inline; }

.thx-info-btn { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: 1px solid #a0aec0; color: #a0aec0; font-family: serif; font-size: 11px; font-weight: bold; cursor: pointer; transition: all 0.2s; opacity: 0; visibility: hidden; transform: translateX(-3px); background: #fff; margin-left: 5px; vertical-align: middle; position: relative; top: -1px; }
.thx-option-row:hover .thx-info-btn, .thx-info-btn.active { opacity: 1; visibility: visible; transform: translateX(0); }
.thx-info-btn:hover, .thx-info-btn.active { border-color: #dd6b20; background: #dd6b20; color: #fff; }

.thx-info-content { width: 100%; display: none; margin-top: 12px; padding: 12px; background: #fff; border: 1px solid #eee; border-left: 3px solid #ccc; font-size: 14px; color: #4a5568; border-radius: 4px; box-sizing: border-box; }
.thx-row-voted .thx-info-content { border-left-color: #dd6b20; background: #fffaf0; }
.thx-row-priority .thx-info-content { border-left-color: #38a169; background: #f0fff4; }
.thx-info-content img { max-width: 100%; height: auto; border-radius: 4px; margin-bottom: 10px; display: block; }
.thx-info-content a { color: #dd6b20; font-weight: bold; text-decoration: none; }

/* Progress Bars */
.thx-progress-bg { width: 100%; height: 6px; background: #edf2f7; border-radius: 3px; margin-top: 10px; overflow: hidden; display: none; position: relative; z-index: 1; }
.thx-progress-bar { height: 100%; background: #dd6b20; width: 0%; transition: width 1s ease; }
.thx-priority-bg { width: 100%; height: 6px; background: #e6fffa; border-radius: 3px; margin-top: 4px; overflow: hidden; display: none; position: relative; z-index: 1; }
.thx-priority-bar { height: 100%; background: #2f855a; width: 0%; transition: width 1s ease; }
.show-results .thx-progress-bg, .show-results .thx-priority-bg { display: block !important; }
.thx-percent-text { font-size: 13px; color: #2d3748; font-weight: bold; display: block; margin-top: 4px; text-align: right; display: none; }
.show-results .thx-percent-text { display: block; }
.show-results input { display: none; }
.show-results .thx-input-label { pointer-events: none; cursor: default; }
.show-results .thx-info-btn { pointer-events: auto; cursor: pointer; }

/* Form Actions */
.thx-form-actions { margin-top: 35px; text-align: center; }
.alert { padding: 15px 20px; border-radius: 8px; text-align: center; font-weight: 500; margin-bottom: 20px; }
.alert-info { background: #e6fffa; color: #2c7a7b; border: 1px solid #b2f5ea; }
.alert-warning { background: #fffaf0; color: #c05621; border: 1px solid #fbd38d; }
.alert-success { background: #f0fff4; color: #276749; border: 1px solid #c6f6d5; }
.alert-locked { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; font-weight: bold; font-size: 16px; padding: 20px; }
#thx-voted-message { margin-bottom: 30px; }
.thx-result-toggle-wrap { text-align: center; margin-top: 15px; }
#thx-toggle-all-info { color: #718096; text-decoration: underline; cursor: pointer; font-size: 13px; transition: color 0.2s; font-style: italic; user-select: none; }
#thx-toggle-all-info:hover { color: #dd6b20; }

/* Login Form */
.thx-login-wrap { max-width: 450px; margin: 30px auto; padding: 40px; background: #fff; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,0.08); text-align: center; border: 1px solid #f0f0f0; }
.thx-login-wrap.thx-dual-login { max-width: 900px; }
.thx-login-row { display: flex; justify-content: space-between; align-items: stretch; gap: 0; }
.thx-login-col { flex: 1; padding: 0 20px; }
.thx-auth-divider { position: relative; width: 1px; background: #e2e8f0; margin: 0 20px; flex-shrink: 0; }
.thx-auth-or { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; border: 1px solid #e2e8f0; color: #718096; font-size: 12px; font-weight: bold; text-transform: uppercase; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; z-index: 2; }
@media (max-width: 768px) { .thx-login-row { flex-direction: column; } .thx-auth-divider { width: 100%; height: 1px; margin: 40px 0; } .thx-login-col { padding: 0; } }
.thx-login-wrap h3 { font-size: 24px; font-weight: 800; color: #1a202c; margin-bottom: 10px; }
.thx-guest-col h3 { color: #dd6b20; }
.thx-login-wrap p { color: #718096; font-size: 15px; margin-bottom: 30px; line-height: 1.5; }
.thx-login-wrap label { font-weight: 700; color: #4a5568; margin-bottom: 8px; display: block; font-size: 15px; text-align: left; }
.thx-login-wrap input[type="text"], .thx-login-wrap input[type="password"], .thx-login-wrap input[type="tel"] { width: 100%; height: 48px; padding: 0 15px; border: 2px solid #e2e8f0; border-radius: 8px; font-size: 16px; background: #f8fafc; transition: all 0.2s; box-sizing: border-box; color: #2d3748; margin-bottom: 15px; }
.thx-login-wrap input:focus { border-color: #dd6b20; background: #fff; outline: none; box-shadow: 0 0 0 3px rgba(221, 107, 32, 0.1); }
.thx-login-wrap input[type="submit"] { width: 100%; height: 52px; background: #dd6b20; border: none; border-radius: 8px; color: #fff; font-size: 18px !important; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; transition: all 0.2s; margin: 0; box-shadow: 0 4px 12px rgba(221, 107, 32, 0.3); -webkit-appearance: none; }
.thx-login-wrap input[type="submit"]:hover { background: #c05621; transform: translateY(-2px); box-shadow: 0 6px 15px rgba(221, 107, 32, 0.4); }
.thx-register-link { margin-top: 30px; padding-top: 20px; border-top: 1px solid #edf2f7; font-size: 15px; color: #718096; }
.thx-register-link a { color: #dd6b20; font-weight: 700; text-decoration: none; }
.thx-register-link a:hover { text-decoration: underline; }

/* White Vote */
.thx-white-vote-section { margin-bottom: 25px; padding-bottom: 25px; border-bottom: 1px dashed #e2e8f0; }
.thx-white-vote-section .thx-option-row { padding: 10px 15px; min-height: auto; border-color: #cbd5e0; }
.thx-white-vote-section .thx-radio-text { font-size: 14px; font-style: italic; color: #4a5568; }
.thx-white-vote-section input { transform: scale(1.1); margin-top: 2px; }

/* Responsive */
@media (max-width: 768px) {
    .thx-dash-header { flex-direction: column; align-items: flex-start; gap: 15px; }
    .thx-dash-header .thx-submit-btn { width: 100%; }
    .thx-sub-header .thx-container-fluid { flex-direction: column; gap: 10px; }
    .survey-card { padding: 30px; }
    .survey-title { font-size: 40px; }
    .thx-dash-actions { width: 100%; justify-content: flex-end; border-top: 1px dashed #eee; padding-top: 10px; margin-top: 5px; }
    .thx-editor-toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
    .thx-row { flex-direction: column; gap: 10px; }
    .thx-toggles { grid-template-columns: 1fr; }
}

/* Owner Badge Display */
.thx-survey-owner {
    font-size: 14px;
    color: #64748b;
    text-align: center;
    margin-top: -15px; /* Kéo lên gần meta */
    margin-bottom: 25px;
    font-weight: 600;
}
.thx-survey-owner span {
    color: #dd6b20; /* Màu cam thương hiệu */
    background: #fff7ed;
    padding: 2px 8px;
    border-radius: 4px;
}

/* Style cho link Owner trong Meta */
.thx-owner-link { 
    color: #dd6b20 !important; 
    font-weight: 600; 
    text-decoration: none; 
    margin-left: 4px; 
    transition: all 0.2s; 
}
.thx-owner-link:hover { 
    text-decoration: underline; 
    color: #c05621 !important; 
}
/* Style cho text Owner (không có link) */
.thx-owner-text {
    color: #dd6b20;
    font-weight: 600;
    margin-left: 4px;
}