/* === RESET & BASE === */
* { box-sizing: border-box; outline: none; }
body {
  font-family: 'Montserrat', sans-serif;
  margin: 0;
  min-height: 100vh; 
  display: flex;
  flex-direction: column;
  background-color: #f3f4f6;
  color: #374151;
}

/* FONT CHỮ TRONG Ô INPUT/OUTPUT */
textarea, input, .output-div { font-family: 'Montserrat', sans-serif !important; }

/* === SCROLLBAR === */
.custom-scrollbar::-webkit-scrollbar { width: 8px; height: 8px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #f1f1f1; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* === HEADER === */
.app-header {
  background: white; border-bottom: 1px solid #e5e7eb; padding: 0 20px; height: 60px;
  display: flex; justify-content: space-between; align-items: center;
  flex-shrink: 0; z-index: 100; position: sticky; top: 0;
}
.header-left { flex: 1.5; }
.header-right { flex: 0.5; }
.header-center { flex: 2; display: flex; justify-content: center; height: 100%; }
.header-left h1 { margin: 0; font-size: 16px; color: #111827; font-weight: 700; margin-bottom: 4px; }

/* DONATE STYLES */
.donate-info { font-size: 11px; display: flex; align-items: center; gap: 5px; }
.donate-label {
    background: #dc2626; color: white; padding: 2px 6px; border-radius: 4px;
    font-weight: 800; font-size: 10px; animation: pulse-red 2s infinite;
}
.donate-details { color: #b91c1c; font-weight: 700; font-size: 12px; letter-spacing: 0.5px; }
@keyframes pulse-red {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(220, 38, 38, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* === TABS === */
.tabs { display: flex; gap: 5px; height: 100%; align-items: flex-end; }
.tab-button {
  border: none; background: transparent; padding: 0 25px; height: 45px;
  cursor: pointer; font-weight: 600; color: #6b7280;
  border-bottom: 3px solid transparent; transition: all 0.2s;
  font-size: 13px; text-transform: uppercase;
}
.tab-button:hover { color: #2563eb; background: #f9fafb; }
.tab-button.active { color: #2563eb; border-bottom-color: #2563eb; background: linear-gradient(to top, #eff6ff, transparent); }

/* === MAIN CONTENT === */
.app-body { flex: 1; padding: 15px; display: flex; flex-direction: column; height: auto; }
.tab-content { display: none; width: 100%; flex-direction: column; }
.tab-content.active { display: flex; }

/* === SETTINGS LAYOUT (NEW) === */
.settings-layout {
    display: flex;
    flex-direction: row;
    height: calc(100vh - 100px); /* Cố định chiều cao để scroll nội dung bên trong */
    background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
    max-width: 1200px; margin: 0 auto; width: 100%;
}

/* Sidebar bên trái */
.settings-sidebar {
    width: 240px; background: #f9fafb; border-right: 1px solid #e5e7eb;
    display: flex; flex-direction: column; padding: 20px 0;
    flex-shrink: 0;
}
.sidebar-title {
    padding: 0 20px 10px; font-size: 11px; font-weight: 800; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px;
}
.sidebar-btn {
    text-align: left; padding: 12px 20px; border: none; background: transparent;
    font-size: 13px; font-weight: 600; color: #4b5563; cursor: pointer;
    border-left: 3px solid transparent; transition: all 0.2s;
}
.sidebar-btn:hover { background: #f3f4f6; color: #111827; }
.sidebar-btn.active { background: white; color: #2563eb; border-left-color: #2563eb; font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

/* Content bên phải */
.settings-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; position: relative; }
.setting-panel { display: none; flex-direction: column; height: 100%; overflow-y: auto; width: 100%; }
.setting-panel.active { display: flex; }

/* === FORMAT UI (NEW) === */
.format-container { padding: 20px; }
.format-desc { font-size: 13px; color: #6b7280; margin-bottom: 20px; margin-top: 0; }
.format-options-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; }

.format-card {
    border: 1px solid #e5e7eb; border-radius: 8px; background: white;
    cursor: pointer; transition: all 0.2s; overflow: hidden; position: relative;
}
.format-card:hover { border-color: #93c5fd; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.format-card.active { border-color: #2563eb; background: #eff6ff; box-shadow: 0 0 0 1px #2563eb; }

.card-header {
    padding: 10px 15px; background: #f9fafb; border-bottom: 1px solid #e5e7eb;
    font-size: 12px; font-weight: 700; color: #374151; display: flex; align-items: center; gap: 8px;
}
.format-card.active .card-header { background: #dbeafe; color: #1e40af; border-bottom-color: #bfdbfe; }

.radio-circle {
    width: 14px; height: 14px; border-radius: 50%; border: 2px solid #d1d5db;
    position: relative;
}
.format-card.active .radio-circle { border-color: #2563eb; background: white; }
.format-card.active .radio-circle::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 6px; height: 6px;
    background: #2563eb; border-radius: 50%;
}

.card-body { padding: 15px; font-size: 14px; color: #1f2937; line-height: 1.4; font-family: 'Montserrat', sans-serif; }
.card-body .dim { color: #9ca3af; }


/* === BUTTONS & COMPONENTS (EXISTING) === */
.btn {
  padding: 8px 16px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600; transition: all 0.2s;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: #2563eb; color: white; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }
.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: #f59e0b; color: white; }
.btn-warning:hover { background: #d97706; }
.btn-sm { padding: 6px 10px; font-size: 11px; }

/* TOGGLE BUTTON STYLE */
.btn-toggle { 
    background: #e5e7eb; color: #6b7280; 
    width: auto; min-width: 140px; padding: 8px 15px; 
    justify-content: flex-start; 
}
.btn-toggle.active { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.btn-toggle.purple { background: #f3e8ff; color: #6b21a8; border: 1px solid #d8b4fe; justify-content: center; }
.btn-toggle.purple:hover { background: #e9d5ff; }

.hidden { display: none !important; }
.full-width { width: 100%; }
.icon-btn { min-width: 120px; }
.input-with-btn { display: flex; gap: 5px; align-items: center; width: 100%; }

/* BADGES */
.badge { background: #1abc9c; color: white; padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-yellow { background: #f59e0b; color: white; }
.badge-blue { background: #3b82f6; color: white; }
.counters-group { display: flex; gap: 5px; align-items: center; }

/* === SETTINGS COMPONENTS === */
.panel-header { padding: 15px 20px; border-bottom: 1px solid #f3f4f6; display: flex; justify-content: space-between; align-items: center; background: white; position: sticky; top: 0; z-index: 10; }
.panel-header h2 { margin: 0; font-size: 16px; color: #111827; }
.mode-actions { display: flex; gap: 8px; align-items: center; }
.select-wrapper { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-right: 10px; }
#mode-select { padding: 6px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 13px; }

.toolbar { padding: 10px 20px; background: #f9fafb; border-bottom: 1px solid #f3f4f6; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.toolbar-group { display: flex; gap: 8px; }

.advanced-settings { padding: 15px 20px; background: #fff; border-bottom: 1px solid #f3f4f6; display: flex; flex-direction: column; gap: 10px; }
.setting-block { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.setting-block label { font-size: 12px; font-weight: 600; color: #4b5563; }
.setting-block input[type="text"] { padding: 8px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 13px; width: 100%; }

.list-actions { padding: 10px 20px; display: flex; gap: 10px; background: white; border-bottom: 1px solid #f3f4f6; }
.scroll-area { padding: 10px 20px; background: #f9fafb; flex: 1; overflow-y: auto; }
.punctuation-item { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; background: white; padding: 6px 10px; border-radius: 6px; border: 1px solid #e5e7eb; }
.punctuation-item input { flex: 1; padding: 8px 12px; border: 1px solid #e5e7eb; border-radius: 4px; font-size: 13px; }
.punctuation-item button.remove { width: 28px; height: 28px; border-radius: 4px; border: none; background: #fee2e2; color: #dc2626; cursor: pointer; }

/* === REPLACE PANE === */
#replace { height: calc(100vh - 100px); } 
.split-pane { display: flex; gap: 15px; height: 100%; min-height: 0; }
.pane { flex: 1; display: flex; flex-direction: column; background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); overflow: hidden; height: 100%; min-height: 0; }
.pane-header { padding: 10px 15px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; flex-shrink: 0; }
.pane textarea { flex: 1; border: none; padding: 15px; resize: none; font-size: 15px; line-height: 1.6; color: #333; overflow-y: auto; min-height: 0; }
.output-div { flex: 1; border: none; padding: 15px; font-size: 15px; line-height: 1.8; white-space: pre-wrap; overflow-y: auto; background-color: #fff; color: #374151; word-wrap: break-word; min-height: 0; }
.output-div > div, .output-div > p { margin-bottom: 1em; }
.output-div:empty::before { content: attr(data-placeholder); color: #9ca3af; pointer-events: none; }
.pane-footer { padding: 10px; border-top: 1px solid #e5e7eb; background: #f9fafb; flex-shrink: 0; }

/* HIGHLIGHT STYLES */
mark.hl-yellow { background-color: #fde047; color: #000; border-radius: 2px; padding: 0 1px; border-bottom: 2px solid #eab308; display: inline; }
mark.hl-blue { background-color: #93c5fd; color: #000; border-radius: 2px; padding: 0 1px; border-bottom: 2px solid #3b82f6; display: inline; }
mark.hl-orange { background-color: #fdba74; color: #000; border-radius: 2px; padding: 0 1px; border-bottom: 2px solid #f97316; display: inline; }

/* === SPLIT TAB === */
.split-controls-wrapper { background: white; padding: 10px 15px; border-radius: 8px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.split-mode-selector { display: flex; gap: 20px; font-size: 13px; font-weight: 600; border-bottom: 1px solid #eee; padding-bottom: 8px; }
.split-mode-selector label { cursor: pointer; display: flex; align-items: center; gap: 5px; }
.split-sub-controls { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.split-buttons-group { display: flex; gap: 5px; flex-wrap: wrap; }
.split-mode-btn { width: 32px; height: 32px; border: 1px solid #d1d5db; background: white; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600; }
.split-mode-btn.active { background: #2563eb; color: white; border-color: #2563eb; }
#split-regex-input { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 4px; width: 300px; font-family: monospace; }

.split-grid-container { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-content: start; }
.outputs-wrapper { display: contents; }
.split-box { background: white; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); display: flex; flex-direction: column; border: 1px solid #e5e7eb; height: 350px; }
.split-header { padding: 8px 12px; background: #f9fafb; border-bottom: 1px solid #e5e7eb; font-size: 12px; font-weight: 600; display: flex; justify-content: space-between; }
.split-box textarea { flex: 1; border: none; padding: 10px; resize: none; font-size: 13px; overflow-y: auto; }
.split-footer { padding: 8px; border-top: 1px solid #e5e7eb; background: #f9fafb; }

@media (max-width: 1200px) { .split-grid-container { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { 
    .split-grid-container { grid-template-columns: 1fr; }
    .settings-layout { flex-direction: column; }
    .settings-sidebar { width: 100%; border-right: none; border-bottom: 1px solid #e5e7eb; padding: 10px 0; }
    .sidebar-btn { padding: 10px 20px; }
}

/* === NOTIFICATION === */
#notification-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.notification { padding: 12px 20px; border-radius: 6px; color: white; font-size: 13px; font-weight: 600; box-shadow: 0 4px 8px rgba(0,0,0,0.15); animation: slideIn 0.3s ease-out; }
.notification.success { background: #10b981; border-left: 4px solid #047857; }
.notification.error { background: #ef4444; border-left: 4px solid #b91c1c; }
.notification.warning { background: #f59e0b; border-left: 4px solid #d97706; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: 0; opacity: 1; } }
