:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    color: white;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

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

.section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.section h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-color);
    font-weight: 600;
}

.section h3 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--secondary-color);
    font-weight: 600;
}

.rules-config {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.rule-group {
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.rule-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 0.95rem;
    border-radius: 4px;
    padding-left: 8px;
    transition: background-color 0.2s;
    position: relative;
}

.rule-group label span:not(.info-icon) {
    flex: 1;
}

.rule-group label:hover {
    background-color: rgba(37, 99, 235, 0.05);
   
}

/* Info icon tooltip */
.info-icon {
    cursor: help;
    font-size: 1em;
    opacity: 0.6;
    transition: opacity 0.2s;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    padding-right: 8px;
}

.info-icon:hover {
    opacity: 1;
}

.info-icon::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: #1e293b;
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.65rem;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Courier New', Consolas, monospace;
    white-space: pre-wrap;
    word-break: break-word;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-5px);
    transition: opacity 0.2s, transform 0.2s;
    min-width: 280px;
    max-width: 400px;
    line-height: 1.5;
}

.info-icon::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    right: 8px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #1e293b;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.info-icon:hover::before,
.info-icon:hover::after {
    opacity: 1;
    transform: translateY(0);
}

.rule-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

/* Highlight complex rules */

label:has(#rule-jailbreak) span:first-of-type,
label:has(#rule-admin) span:first-of-type {
    font-weight: 500;
}

select {
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.test-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#input-text {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    resize: vertical;
    transition: border-color 0.2s;
}

#input-text:focus {
    outline: none;
    border-color: var(--primary-color);
}

.controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn:active {
    transform: translateY(0);
}

.output-section, .status-section {
    margin-top: 20px;
}

.output-section h3, .status-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
}

.badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge.allow {
    background: var(--success-color);
    color: white;
}

.badge.block {
    background: var(--danger-color);
    color: white;
}

.badge.rewrite {
    background: var(--warning-color);
    color: white;
}

.output {
    padding: 15px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    min-height: 120px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.output.blocked {
    background: #fee2e2;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.output.rewritten {
    background: #fef3c7;
    border-color: var(--warning-color);
}

.status {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    font-size: 0.95rem;
}

.status div {
    display: flex;
    justify-content: space-between;
    padding: 8px;
}

.status span {
    font-weight: 600;
    color: var(--primary-color);
}

footer {
    text-align: center;
    padding: 30px;
    color: var(--secondary-color);
    font-size: 0.9rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--secondary-color);
}

.error {
    background: #fee2e2;
    color: var(--danger-color);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--danger-color);
}
