:root {
    --primary: #E84393;
    --secondary: #FD79A8;
    --accent: #00CEC9;
    --bg-color: #1A0A14;
    --panel-bg: rgba(45, 15, 30, 0.6);
    --panel-border: rgba(232, 67, 147, 0.2);
    --text-main: #FDF2F8;
    --text-muted: #FBCFE8;
    --danger: #FF4757;
    --warning: #FFA502;
    --radius: 12px;
    --transition: all 0.25s ease;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(232, 67, 147, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(0, 206, 201, 0.08) 0%, transparent 40%);
    color: var(--text-main);
    min-height: 100vh;
    line-height: 1.5;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100vh;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

header {
    text-align: center;
    flex-shrink: 0;
}

header h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

main {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(253, 121, 168, 0.1);
}

.builder-section {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.directives-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 0.5rem;
}

.directives-list::-webkit-scrollbar {
    width: 6px;
}

.directives-list::-webkit-scrollbar-thumb {
    background: var(--panel-border);
    border-radius: 3px;
}

.directive-box {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(253, 121, 168, 0.15);
    border-radius: 8px;
    padding: 1rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.directive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.directive-name {
    color: var(--accent);
    font-family: monospace;
    font-size: 1.1rem;
}

.sources-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.source-badge {
    background: rgba(253, 121, 168, 0.2);
    color: var(--text-main);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(253, 121, 168, 0.3);
}

.source-badge.unsafe {
    background: rgba(255, 71, 87, 0.2);
    border-color: rgba(255, 71, 87, 0.4);
    color: #FF6B81;
}

.source-badge .remove-src-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    opacity: 0.7;
    font-size: 0.8rem;
}

.source-badge .remove-src-btn:hover {
    opacity: 1;
}

.add-source-ui {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.source-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(253, 121, 168, 0.2);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 6px;
    font-family: monospace;
    width: 100%;
}

.source-input:focus {
    outline: none;
    border-color: var(--primary);
}

.source-suggestions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sugg-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: monospace;
    transition: var(--transition);
}

.sugg-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

.sugg-btn.unsafe-sugg:hover {
    background: rgba(255, 71, 87, 0.2);
    color: #FF6B81;
    border-color: rgba(255, 71, 87, 0.4);
}

.directive-picker {
    display: flex;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    align-items: center;
}

.directive-picker select {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 6px;
    font-family: monospace;
}

.directive-picker.hidden {
    display: none;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--panel-border);
    border-radius: 3px;
}

.output-wrapper {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.output-label {
    background: rgba(253, 121, 168, 0.1);
    padding: 0.5rem 1rem;
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--accent);
    border-bottom: 1px solid var(--panel-border);
}

#csp-output {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 1rem;
    font-family: monospace;
    font-size: 0.95rem;
    resize: vertical;
    min-height: 120px;
    width: 100%;
}

#csp-output:focus {
    outline: none;
}

.meta-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(253, 121, 168, 0.1);
}

.tool-group {
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tool-group h3 {
    font-size: 1rem;
    color: var(--secondary);
    margin-bottom: 0.25rem;
}

.tool-group textarea,
.tool-group input[type="text"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 6px;
    font-family: monospace;
}

.hash-actions,
.nonce-actions {
    display: flex;
    gap: 0.5rem;
}

.hash-actions select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.5rem;
    border-radius: 6px;
}

#warnings-list {
    list-style: none;
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#warnings-list li {
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    border-left: 3px solid transparent;
}

.warn-msg {
    background: rgba(255, 165, 2, 0.1);
    border-left-color: var(--warning);
    color: #FFD32A;
}

.danger-msg {
    background: rgba(255, 71, 87, 0.1);
    border-left-color: var(--danger);
    color: #FF6B81;
}

.info-msg {
    background: rgba(0, 206, 201, 0.1);
    border-left-color: var(--accent);
    color: var(--accent);
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 0.5rem;
}

.toggle-switch input {
    display: none;
}

.slider {
    position: relative;
    width: 40px;
    height: 22px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    transition: var(--transition);
}

.slider::before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider::before {
    transform: translateX(18px);
}

/* Buttons */
button {
    font-family: inherit;
    border-radius: 6px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

.primary-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    box-shadow: 0 4px 15px rgba(232, 67, 147, 0.3);
}

.primary-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(232, 67, 147, 0.4);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.text-btn {
    background: transparent;
    color: var(--text-muted);
}

.text-btn:hover {
    color: var(--text-main);
}

.icon-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.25rem 0.5rem;
}

.icon-btn:hover {
    color: var(--danger);
    transform: scale(1.1);
}

.full-width {
    width: 100%;
    text-align: center;
}

@media (max-width: 900px) {
    main {
        grid-template-columns: 1fr;
    }

    .app-container {
        height: auto;
        display: block;
    }

    .builder-section {
        height: 600px;
        margin-bottom: 2rem;
    }
}