:root {
    /* Modern Dark Palette */
    --primary: #6366F1;
    --primary-hover: #4f46e5;
    --secondary: #818cf8;
    --accent: #14b8a6;
    --bg-dark: #0F1219;
    --bg-panel: #1E222D;
    --bg-input: #0F1219;
    --bg-card: #252A36;
    --border: #2D3342;
    --border-focus: #6366F1;

    --text-main: #F3F4F6;
    --text-muted: #9CA3AF;

    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --success: #10b981;
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --info: #3b82f6;

    --radius: 12px;
    --radius-sm: 8px;
    --transition: 200ms ease;
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    /* Very subtle noisy/glassmorphism background */
    background-image:
        radial-gradient(circle at 10% 0%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 90% 100%, rgba(20, 184, 166, 0.03) 0%, transparent 40%);
    background-attachment: fixed;
}

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

/* Header */
.app-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.2);
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

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

/* Layout */
.main-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
}

/* Panels */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.panel-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Input Section */
.input-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.flex-1 {
    flex: 1;
}

textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    transition: border-color var(--transition);
    outline: none;
    width: 100%;
    resize: none;
    flex: 1;
    min-height: 250px;
}

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

/* Alerts */
.info-alert {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.info-alert svg {
    flex-shrink: 0;
    color: var(--info);
    margin-top: 2px;
}

code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85em;
    color: var(--accent);
}

/* Buttons */
.btn {
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

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

.btn.primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

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

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn.outline {
    background: transparent;
    border: 1px solid var(--border);
}

.btn.outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn.ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 0.4rem 0.8rem;
}

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

.btn.danger:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.btn.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    height: 32px;
}

.full-width {
    width: 100%;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

.action-row {
    margin-top: 1rem;
}

/* Results Section */
.results-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    text-align: center;
}

/* Dashboard */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.card {
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.card.bg-panel {
    background: var(--bg-card);
}

.card.bg-error {
    background: var(--error-bg);
    border-color: rgba(239, 68, 68, 0.3);
}

.card.bg-warning {
    background: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.3);
}

.card-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.card-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    font-family: 'JetBrains Mono', monospace;
}

.compliance-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--radius-sm);
}

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

.desc {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Badges */
.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.flag-tracker {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge.flag-insecure {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

#compliance-score {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Detailed Cookie List */
.cookie-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cookie-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.cookie-header {
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cookie-name-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cookie-name {
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    color: var(--text-main);
    word-break: break-all;
}

.cookie-size {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.cookie-body {
    padding: 1rem;
}

.cookie-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.lbl-col {
    width: 80px;
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    padding-top: 0.2rem;
}

.val-col {
    flex: 1;
    min-width: 0;
}

.val-col code {
    display: block;
    background: var(--bg-input);
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border);
    font-size: 0.8rem;
    word-break: break-word;
    white-space: pre-wrap;
    color: var(--text-main);
}

.text-success {
    color: var(--accent) !important;
}

/* Flags Grid */
.flags-grid {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.flag-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.flag-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid var(--border);
}

.flag-item.active .flag-icon {
    background: var(--success);
    border-color: var(--success);
}

.flag-item.inactive .flag-icon {
    background: var(--error);
    border-color: var(--error);
}

.flag-val {
    font-family: 'JetBrains Mono', monospace;
    font-weight: bold;
    padding: 0.1rem 0.4rem;
    background: var(--bg-input);
    border-radius: 4px;
    border: 1px solid var(--border);
}


/* Utils */
.hidden {
    display: none !important;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: var(--success);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    z-index: 100;
    transition: all 0.3s ease;
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    pointer-events: none;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
    .main-layout {
        grid-template-columns: 1fr;
    }

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

    .input-panel {
        margin-bottom: 1.5rem;
        max-height: 500px;
    }

    .results-panel {
        min-height: 600px;
    }
}