/* 
 * TEXT STUDIO PRO - Clean & Professional Design
 * Style: Technical, Minimalist, High Contrast
 * Multiple Themes Support
 */

:root {
    /* Shared */
    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", monospace;
    --sidebar-width: 240px;
    --header-height: 60px;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --transition: 0.15s ease;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #eab308;
}

/* Theme: Zinc (Default Dark) */
[data-theme="zinc"], :root {
    --bg-app: #09090b;
    --bg-sidebar: #18181b;
    --bg-card: #18181b;
    --bg-card-hover: #27272a;
    --bg-input: #27272a;
    --border-subtle: #27272a;
    --border-strong: #3f3f46;
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
}

/* Theme: Slate (Cool Gray) */
[data-theme="slate"] {
    --bg-app: #0f172a;
    --bg-sidebar: #1e293b;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #334155;
    --border-subtle: #334155;
    --border-strong: #475569;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
}

/* Theme: Emerald (Green Accent) */
[data-theme="emerald"] {
    --bg-app: #022c22;
    --bg-sidebar: #064e3b;
    --bg-card: #064e3b;
    --bg-card-hover: #065f46;
    --bg-input: #065f46;
    --border-subtle: #065f46;
    --border-strong: #047857;
    --text-primary: #ecfdf5;
    --text-secondary: #a7f3d0;
    --text-muted: #6ee7b7;
    --primary: #10b981;
    --primary-hover: #059669;
}

/* Theme: Rose (Warm Pink) */
[data-theme="rose"] {
    --bg-app: #1c1917;
    --bg-sidebar: #292524;
    --bg-card: #292524;
    --bg-card-hover: #44403c;
    --bg-input: #44403c;
    --border-subtle: #44403c;
    --border-strong: #57534e;
    --text-primary: #fafaf9;
    --text-secondary: #d6d3d1;
    --text-muted: #a8a29e;
    --primary: #f43f5e;
    --primary-hover: #e11d48;
}

/* Theme: Amber (Warm Orange) */
[data-theme="amber"] {
    --bg-app: #1c1917;
    --bg-sidebar: #292524;
    --bg-card: #292524;
    --bg-card-hover: #44403c;
    --bg-input: #44403c;
    --border-subtle: #44403c;
    --border-strong: #57534e;
    --text-primary: #fafaf9;
    --text-secondary: #d6d3d1;
    --text-muted: #a8a29e;
    --primary: #f59e0b;
    --primary-hover: #d97706;
}

/* Theme: Violet (Purple) */
[data-theme="violet"] {
    --bg-app: #0c0a09;
    --bg-sidebar: #1c1917;
    --bg-card: #1c1917;
    --bg-card-hover: #292524;
    --bg-input: #292524;
    --border-subtle: #292524;
    --border-strong: #44403c;
    --text-primary: #fafaf9;
    --text-secondary: #d6d3d1;
    --text-muted: #a8a29e;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
}

/* Theme: Cyan (Teal) */
[data-theme="cyan"] {
    --bg-app: #042f2e;
    --bg-sidebar: #134e4a;
    --bg-card: #134e4a;
    --bg-card-hover: #115e59;
    --bg-input: #115e59;
    --border-subtle: #115e59;
    --border-strong: #0d9488;
    --text-primary: #ecfeff;
    --text-secondary: #a5f3fc;
    --text-muted: #67e8f9;
    --primary: #06b6d4;
    --primary-hover: #0891b2;
}

/* Theme: Light (浅色主题) */
[data-theme="light"] {
    --bg-app: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-input: #f1f5f9;
    --border-subtle: #e2e8f0;
    --border-strong: #cbd5e1;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

.app-container { display: flex; height: 100vh; width: 100vw; }

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-subtle);
    gap: 12px;
}

.logo-mark {
    width: 28px;
    height: 28px;
    background: var(--primary);
    border-radius: var(--radius-md);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 16px;
}

.logo h2 { font-size: 15px; font-weight: 600; color: var(--text-primary); }

.nav-items { padding: 16px 12px; flex: 1; overflow-y: auto; list-style: none; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 2px;
    font-size: 13px;
    font-weight: 500;
}

.nav-item:hover { background-color: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active { background-color: rgba(59, 130, 246, 0.1); color: var(--primary); }
.nav-item i { font-size: 16px; }

.nav-item.dropdown { flex-direction: column; align-items: stretch; padding: 0; background: transparent !important; }

.nav-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.nav-header:hover { background-color: var(--bg-card-hover); color: var(--text-primary); }
.arrow-icon { margin-left: auto; font-size: 14px; transition: transform var(--transition); }
.dropdown.open .arrow-icon { transform: rotate(180deg); }

.submenu { list-style: none; max-height: 0; overflow: hidden; transition: max-height 0.3s ease; padding-left: 12px; }
.dropdown.open .submenu { max-height: 500px; padding-bottom: 8px; }
.submenu .nav-item { padding-left: 28px; font-size: 13px; margin-top: 2px; }

.content { flex: 1; display: flex; flex-direction: column; background-color: var(--bg-app); min-width: 0; }

.tool-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-app);
}

.tool-header h1 { font-size: 18px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 12px; }
.tool-header p { color: var(--text-secondary); font-size: 13px; }

.tool-container { flex: 1; overflow-y: auto; padding: 24px; }

.tool-panel { display: none; height: 100%; flex-direction: column; gap: 20px; }
.tool-panel.active { display: flex; }

.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; flex: 1; min-height: 0; }

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.input-card, .output-card { min-height: 300px; }

.panel-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.02);
    flex-shrink: 0;
}

.panel-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

textarea {
    flex: 1;
    width: 100%;
    background-color: transparent;
    border: none;
    padding: 16px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    resize: none;
    outline: none;
}

textarea::placeholder { color: var(--text-muted); }

pre {
    flex: 1;
    padding: 16px;
    margin: 0;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

#tool-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    align-items: center;
}

.tool-options-container { display: none; gap: 16px; flex-wrap: wrap; align-items: center; }
.tool-options-container.active { display: flex; }

.option, .checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; }

input[type="text"], input[type="number"], select {
    background-color: var(--bg-input);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 13px;
    outline: none;
}

input[type="text"]:focus, input[type="number"]:focus, select:focus { border-color: var(--primary); }

.btn, button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
    font-family: var(--font-sans);
    background-color: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn:hover, button:hover { background-color: var(--border-strong); }

.primary-btn {
    background-color: var(--primary) !important;
    color: white !important;
    border-color: transparent !important;
}

.primary-btn:hover { background-color: var(--primary-hover) !important; }

.ghost-btn { background-color: transparent; border-color: transparent; color: var(--text-secondary); }
.ghost-btn:hover { color: var(--text-primary); background-color: var(--bg-card-hover); }

.danger-btn {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger) !important;
    border-color: transparent !important;
}

.danger-btn:hover { background-color: rgba(239, 68, 68, 0.2) !important; }

.action-bar {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: var(--bg-card);
    flex-shrink: 0;
}

.stats { margin-right: auto; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }

.rollcall-layout { display: grid; grid-template-columns: 280px 1fr 280px; gap: 20px; height: 100%; }

.rollcall-display {
    background-color: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.big-name { font-size: 48px; font-weight: 700; color: var(--text-primary); text-align: center; }

#rollcall-member-list, #rollcall-history-list { flex: 1; overflow-y: auto; padding: 8px; }

.member-item, .history-item {
    padding: 10px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.member-item:last-child, .history-item:last-child { border-bottom: none; }
.member-name, .history-item-name { font-weight: 500; color: var(--text-primary); }
.member-info { flex: 1; }

.weight-bar { height: 3px; background-color: var(--bg-input); margin-top: 6px; border-radius: 2px; overflow: hidden; }
.weight-fill { height: 100%; background-color: var(--primary); }

.nav-list { display: flex; flex-direction: column; gap: 0; list-style: none; }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background-color: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-muted); }

.notification {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background-color: var(--bg-card);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: transform 0.3s ease;
    font-weight: 500;
}

.notification.show { transform: translateX(-50%) translateY(0); }
.notification.error { border-color: var(--danger); color: var(--danger); }

.json-key { color: #7dd3fc; }
.json-string { color: #a5d6ff; }
.json-number { color: #d2a8ff; }
.json-boolean { color: #ff7b72; }
.json-null { color: #ff7b72; }
.duplicate { background-color: rgba(234, 179, 8, 0.2); color: #eab308; padding: 0 4px; border-radius: 2px; }
.diff-added { background-color: rgba(34, 197, 94, 0.2); color: #22c55e; }
.diff-removed { background-color: rgba(239, 68, 68, 0.2); color: #ef4444; text-decoration: line-through; }
.regex-match { background-color: rgba(59, 130, 246, 0.3); padding: 0 2px; border-radius: 2px; }

/* Theme Switcher */
.theme-switcher {
    padding: 12px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
}

.theme-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    padding: 0;
    min-width: auto;
}

.theme-btn:hover {
    transform: scale(1.15);
}

.theme-btn.active {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-app);
}

.theme-btn[data-theme="zinc"] { background: linear-gradient(135deg, #3b82f6, #18181b); }
.theme-btn[data-theme="slate"] { background: linear-gradient(135deg, #6366f1, #1e293b); }
.theme-btn[data-theme="emerald"] { background: linear-gradient(135deg, #10b981, #064e3b); }
.theme-btn[data-theme="rose"] { background: linear-gradient(135deg, #f43f5e, #292524); }
.theme-btn[data-theme="amber"] { background: linear-gradient(135deg, #f59e0b, #292524); }
.theme-btn[data-theme="violet"] { background: linear-gradient(135deg, #8b5cf6, #1c1917); }
.theme-btn[data-theme="cyan"] { background: linear-gradient(135deg, #06b6d4, #134e4a); }
.theme-btn[data-theme="light"] { background: linear-gradient(135deg, #3b82f6, #f8fafc); }

@media (max-width: 1024px) {
    .tool-grid { grid-template-columns: 1fr; }
    .rollcall-layout { grid-template-columns: 1fr; gap: 16px; }
}
