:root {
    --primary: #E17055;
    --primary-hover: #D63031;
    --secondary: #FAB1A0;
    --accent: #FFEAA7;
    --bg-main: #1A100E;
    --bg-card: rgba(45, 30, 26, 0.6);
    --border-color: rgba(250, 177, 160, 0.2);
    --text-main: #FDFBF7;
    --text-muted: #D1C4E9;
    /* Slight purple/grey tint */
    --text-subtle: #A39D9C;

    --success: #00B894;
    --warning: #FDCB6E;
    --danger: #FF7675;

    --radius: 12px;
    --font: 'Inter', system-ui, sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font);
    line-height: 1.5;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(225, 112, 85, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(250, 177, 160, 0.05) 0%, transparent 50%);
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Header */
.glass-header {
    background: rgba(26, 16, 14, 0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 24px;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

/* Typography */
h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
    font-weight: 600;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.mt-4 {
    margin-top: 16px;
}

/* Buttons */
button {
    font-family: var(--font);
    cursor: pointer;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--primary);
    color: #fff;
    padding: 10px 20px;
    box-shadow: 0 4px 14px rgba(225, 112, 85, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
}

.btn-secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-text {
    background: transparent;
    color: var(--text-subtle);
    padding: 10px 16px;
}

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

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(8px);
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
}

textarea {
    width: 100%;
    height: 180px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    color: var(--accent);
    font-family: 'Fira Code', 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

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

.input-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
}

/* Loading State */
#loading-state {
    text-align: center;
    padding: 40px 0;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(225, 112, 85, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.progress-bar-bg {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 3px;
    margin: 16px auto 0;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
}

/* Results Dashboard */
.slide-up {
    animation: slideUp 0.4s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 2.5rem;
    margin-top: 8px;
    font-weight: 700;
}

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

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.bg-success {
    background: var(--success);
}

.bg-danger {
    background: var(--danger);
}

.bg-warning {
    background: var(--warning);
}

.bg-unknown {
    background: var(--text-subtle);
}

.split-view {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    margin-top: 24px;
}

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

/* Matrix & Compliance */
.matrix-section h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.risk-bar {
    width: 100%;
    height: 12px;
    border-radius: 6px;
    display: flex;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
    margin-bottom: 12px;
}

.risk-segment {
    height: 100%;
    transition: width 0.5s ease;
}

.risk-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-subtle);
}

.risk-legend span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.dist-list {
    list-style: none;
    font-size: 0.9rem;
}

.dist-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dist-list li:last-child {
    border-bottom: none;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-top: 16px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table th {
    color: var(--text-subtle);
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.badge-permissive {
    background: rgba(0, 184, 148, 0.15);
    color: var(--success);
    border: 1px solid rgba(0, 184, 148, 0.3);
}

.badge-weak-copyleft {
    background: rgba(253, 203, 110, 0.15);
    color: var(--warning);
    border: 1px solid rgba(253, 203, 110, 0.3);
}

.badge-strong-copyleft {
    background: rgba(255, 118, 117, 0.15);
    color: var(--danger);
    border: 1px solid rgba(255, 118, 117, 0.3);
}

.badge-unknown {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--danger);
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: opacity 0.3s, transform 0.3s;
}

.hidden {
    display: none !important;
}