:root {
    --primary: #6366f1;
    --success: #10b981;
    --bg-body: #f3f4f6;
    --bg-panel: #ffffff;
    --text-main: #1f2937;
    --text-dim: #6b7280;
    --border: #e5e7eb;
    --radius-lg: 12px;
    --radius-btn: 20px; /* Bo tròn chuẩn BigPro */
}
* { box-sizing: border-box; outline: none; }
body { font-family: 'Montserrat', sans-serif; margin: 0; min-height: 100vh; display: flex; flex-direction: column; background-color: var(--bg-body); color: var(--text-main); }
body.loading .tab-content { display: none !important; }

/* SCROLLBAR */
.custom-scrollbar::-webkit-scrollbar { width: 6px; height: 6px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* HEADER */
.app-header { background: white; padding: 0 20px; height: 60px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border); box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.header-left h1 { margin: 0; font-size: 20px; font-weight: 800; background: linear-gradient(135deg, #6366f1, #ec4899); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.tabs { display: flex; gap: 10px; height: 100%; align-items: center; }
.tab-button { border: none; background: transparent; padding: 8px 16px; cursor: pointer; font-weight: 600; color: var(--text-dim); font-size: 13px; text-transform: uppercase; border-radius: 20px; transition: 0.2s; }
.tab-button:hover { background: #eef2ff; color: var(--primary); }
.tab-button.active { background: linear-gradient(135deg, #6366f1, #4f46e5); color: white; box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3); }

/* BODY */
.app-body { flex: 1; padding: 15px; width: 100%; max-width: 100%; display: flex; flex-direction: column; overflow-x: hidden; }
.tab-content { display: none; width: 100%; flex: 1; }
.tab-content.active { display: flex; }

/* SETTINGS */
.settings-layout { display: flex; gap: 20px; height: calc(100vh - 100px); }
.settings-sidebar { width: 250px; background: var(--bg-panel); border-radius: var(--radius-lg); padding: 15px; display: flex; flex-direction: column; gap: 5px; overflow-y: auto; flex-shrink: 0; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.sidebar-category-title { padding: 10px 10px 5px; font-size: 11px; font-weight: 800; color: #9ca3af; }
.sidebar-btn { text-align: left; padding: 12px 15px; border: none; background: transparent; font-size: 13px; font-weight: 600; color: var(--text-dim); cursor: pointer; border-radius: 10px; transition: 0.2s; }
.sidebar-btn:hover { background: #f9fafb; }
.sidebar-btn.active { background: #eef2ff; color: var(--primary); font-weight: 700; }

.settings-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.setting-panel { display: none; flex-direction: column; background: var(--bg-panel); border-radius: var(--radius-lg); padding-bottom: 10px; height: 100%; overflow: hidden; box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.setting-panel.active { display: flex; }

.panel-header { padding: 15px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.panel-header h2 { margin: 0; font-size: 16px; font-weight: 700; }
.mode-actions { display: flex; gap: 8px; align-items: center; }
#mode-select { padding: 6px; font-size: 13px; border: 1px solid var(--border); border-radius: 6px; }
.btn-icon { width: 30px; height: 30px; padding: 0; border-radius: 50%; background: #f3f4f6; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.btn-icon:hover { background: #e5e7eb; color: #111827; }

/* TOP ACTIONS BAR */
.top-actions-bar { padding: 12px 20px; display: flex; gap: 10px; border-bottom: 1px solid var(--border); background: #fafafa; }

/* TOOLBAR */
.toolbar { padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.toolbar-group { display: flex; gap: 8px; }
.list-container { padding: 15px 20px; overflow-y: auto; flex: 1; }

.punctuation-item { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.punctuation-item input { flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; background: #f9fafb; transition: 0.2s; }
.punctuation-item input:focus { background: white; border-color: var(--primary); }
.punctuation-item .remove { width: 30px; height: 30px; background: #fee2e2; border: none; color: #ef4444; border-radius: 50%; cursor: pointer; font-size: 16px; }

/* FORMAT CARDS */
.format-container { padding: 20px; overflow-y: auto; }
.format-options-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }
.format-card { border: 2px solid var(--border); border-radius: 12px; padding: 15px; cursor: pointer; background: white; transition: 0.2s; text-align: center; }
.format-card:hover { border-color: #c7d2fe; transform: translateY(-2px); }
.format-card.active { border-color: var(--primary); background: #eef2ff; }
.big-desc { font-size: 13px; font-weight: 500; color: #6b7280; line-height: 1.5; margin: 5px 0; }
.card-content h3 { margin: 0; font-size: 15px; color: var(--primary); font-weight: 700; }

.modern-input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-family: monospace; }

/* REPLACE UI */
.split-pane { display: flex; gap: 20px; height: calc(100vh - 90px); width: 100%; }
.pane { flex: 1; display: flex; flex-direction: column; background: white; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.pane-header { padding: 12px 20px; background: #f9fafb; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; align-items: center; }
.counters-group { display: flex; align-items: center; gap: 8px; }
.pane textarea { flex: 1; border: none; padding: 20px; resize: none; font-size: 15px; background: #fff; line-height: 1.6; }
.output-div { flex: 1; border: none; padding: 20px; font-size: 15px; overflow-y: auto; background: white; white-space: pre-wrap; line-height: 1.6; color: #374151; }
.pane-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: #f9fafb; }

/* BADGES & LEGEND */
.badge { padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 700; color: white; }
.badge.green { background: var(--success); }
.badge.yellow { background: #eab308; color: white; } /* Vàng đậm chuẩn */
.badge.blue { background: #3b82f6; }
.legend-inline { font-size: 11px; color: #f97316; font-weight: 700; display: flex; align-items: center; gap: 5px; margin-left: 10px; background: #fff7ed; padding: 3px 8px; border-radius: 6px; }
.dot.orange { width: 8px; height: 8px; background: #f97316; border-radius: 50%; }

/* BUTTONS */
.btn { padding: 8px 16px; border-radius: var(--radius-btn); border: none; cursor: pointer; font-size: 13px; font-weight: 600; transition: 0.2s; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: linear-gradient(135deg, #6366f1, #4f46e5); color: white; box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4); }
.btn-success { background: linear-gradient(135deg, #10b981, #059669); color: white; box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3); }
.big-btn { padding: 12px 0; font-size: 14px; text-transform: uppercase; letter-spacing: 0.5px; }
.full-width { width: 100%; }

.btn-toggle.blue-toggle { background: white; border: 1px solid var(--border); color: var(--text-dim); }
.btn-toggle.blue-toggle.active { background: #3b82f6; color: white; border-color: #3b82f6; }

/* SPLIT UI - GRID FIX */
.split-controls-wrapper { background: white; padding: 15px; border-radius: var(--radius-lg); margin-bottom: 20px; border: 1px solid var(--border); box-shadow: 0 2px 10px rgba(0,0,0,0.02); }
.split-controls-wrapper.left-align { align-items: flex-start; }
.split-mode-selector { display: flex; gap: 20px; margin-bottom: 10px; }
.split-buttons-group { display: flex; gap: 8px; }
.split-mode-btn { width: 35px; height: 35px; border: 1px solid var(--border); background: white; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; transition: 0.2s; }
.split-mode-btn.active { background: var(--primary); color: white; border-color: var(--primary); box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3); }

/* GRID LAYOUT CHO SPLIT */
.split-grid-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; padding-bottom: 20px; }
.split-box { background: white; border-radius: 12px; border: 1px solid var(--border); height: 350px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.03); }
.main-split-input { grid-column: 1 / -1; height: 250px; border: 2px solid var(--primary); }
.split-header { padding: 10px 15px; background: #f9fafb; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 700; display: flex; justify-content: space-between; }
.split-box textarea { flex: 1; border: none; padding: 15px; resize: none; font-size: 13px; }

/* Highlight Colors */
mark.hl-yellow { background-color: #fef08a; color: black; padding: 0 2px; border-radius: 4px; }
mark.hl-blue { background-color: #bae6fd; color: black; padding: 0 2px; border-radius: 4px; }
mark.hl-orange { background-color: #fed7aa; color: black; padding: 0 2px; border-radius: 4px; }

.hidden { display: none !important; }
