/* ============================================================
   Data Masking Tool — Styles
   Minimalist utility-focused dark mode
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --primary: #6366F1;
    --primary-light: #818CF8;
    --bg: #0F172A;
    --bg-elevated: #1E293B;
    --bg-surface: #334155;
    --bg-card: #1E293B;
    --bg-hover: #2D3B55;
    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --border: #334155;
    --success: #22C55E;
    --warning: #EAB308;
    --danger: #EF4444;
    --mask-color: #F59E0B;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 16px rgba(0, 0, 0, .3);
    --transition: 200ms ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg: #F8FAFC;
        --bg-elevated: #FFF;
        --bg-surface: #F1F5F9;
        --bg-card: #FFF;
        --bg-hover: #E2E8F0;
        --text-primary: #0F172A;
        --text-secondary: #475569;
        --text-muted: #94A3B8;
        --border: #E2E8F0;
        --shadow: 0 4px 16px rgba(0, 0, 0, .06);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.app {
    max-width: 1000px;
    margin: 0 auto;
    padding: 24px 16px 80px;
}

.header {
    text-align: center;
    padding: 28px 0 20px;
}

.header-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
}

.header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--mask-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: var(--text-secondary);
    font-size: .9rem;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn:hover {
    background: var(--bg-hover);
}

.btn:active {
    transform: scale(.97);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: .8rem;
}

.controls {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.control-input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: .85rem;
    outline: none;
}

.control-input:focus {
    border-color: var(--primary);
}

select.control-input {
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2394A3B8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
}

/* --- Detected PII --- */
.pii-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.pii-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    background: rgba(245, 158, 11, .12);
    color: var(--mask-color);
    border: 1px solid rgba(245, 158, 11, .3);
}

/* --- Editor Panels --- */
.editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.editor-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.editor-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: .85rem;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-body {
    padding: 14px;
}

textarea.editor-input {
    width: 100%;
    min-height: 200px;
    resize: vertical;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: .8rem;
    line-height: 1.7;
    outline: none;
}

textarea.editor-input:focus {
    border-color: var(--primary);
}

.output-pre {
    font-family: var(--font-mono);
    font-size: .8rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 200px;
    color: var(--text-primary);
}

.masked {
    color: var(--mask-color);
    font-weight: 700;
}

/* --- Stats --- */
.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.stat {
    font-size: .8rem;
    color: var(--text-secondary);
}

.stat strong {
    color: var(--mask-color);
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: .85rem;
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transition: all var(--transition);
    z-index: 200;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
    .editor-grid {
        grid-template-columns: 1fr;
    }
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}