:root {
    --bg: #0b0f19;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.05);
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --primary-color: #6366f1;
    --secondary-color: #a855f7;
    --accent: #ec4899;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

.background-elements {
    position: absolute;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 10s infinite ease-in-out alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary-color);
    bottom: -150px;
    right: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translateY(0px) scale(1); }
    100% { transform: translateY(50px) scale(1.1); }
}

.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 700px;
    z-index: 1;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    position: relative;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.highlight {
    background: linear-gradient(to right, var(--primary-color), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    color: var(--text-secondary);
    margin-top: 5px;
    font-size: 1rem;
}

form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.input-row {
    display: flex;
    gap: 20px;
}

@media (max-width: 600px) {
    .input-row { flex-direction: column; }
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.full-width { width: 100%; }

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color 0.3s;
}

input, textarea {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

textarea {
    resize: vertical;
    min-height: 120px;
    font-family: monospace;
}

input:focus, textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.glow-on-hover {
    margin-top: 10px;
    padding: 14px;
    border: none;
    outline: none;
    color: #fff;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--accent));
    background-size: 200% auto;
    cursor: pointer;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    transition: 0.5s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.glow-on-hover:hover {
    background-position: right center;
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
    transform: translateY(-2px);
}

.notification {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
}

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

.divider {
    border: 0;
    border-top: 1px solid var(--glass-border);
    margin: 40px -40px 30px -40px;
}

.management-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.search-box { flex: 1; max-width: 300px; }
.search-box input { width: 100%; padding: 8px 16px; font-size: 0.9rem; }

.table-wrapper {
    overflow-x: auto;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
}

table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.9rem; }
th, td { padding: 14px 16px; border-bottom: 1px solid var(--glass-border); }
th { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); font-weight: 600; }

.rules-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
}

.actions { display: flex; gap: 10px; }
.btn-icon { background: none; border: none; cursor: pointer; padding: 6px; border-radius: 8px; transition: all 0.2s; display: flex; }
.btn-edit { color: var(--primary-color); background: rgba(99, 102, 241, 0.1); }
.btn-delete { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.page-btn { background: rgba(255, 255, 255, 0.05); border: 1px solid var(--glass-border); color: var(--text-secondary); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; transition: all 0.2s; }
.page-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }

/* --- AI Playground --- */
.test-section { padding-bottom: 40px; }
.test-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 20px; }
@media (max-width: 768px) { .test-grid { grid-template-columns: 1fr; } }

.file-upload-zone {
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    background: rgba(255,255,255,0.02);
    transition: all 0.3s ease;
}
.file-upload-zone:hover, .file-upload-zone.dragover {
    border-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}
.file-upload-zone svg { color: var(--text-secondary); margin-bottom: 15px; }
.file-upload-zone p span { color: var(--primary-color); font-weight: 600; }

.json-viewer {
    background: #05070a;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #a5b4fc;
    min-height: 250px;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

.v-section {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
}
.v-pass { background: rgba(16, 185, 129, 0.1); border: 1px solid rgba(16, 185, 129, 0.2); color: #10b981; }
.v-fail { background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.2); color: #ef4444; }

.loader-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto 10px;
}
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }