:root {
    /* Royal Purple Palette */
    --primary: #6C5CE7;
    --primary-hover: #5a4bcf;
    --secondary: #A29BFE;
    --accent: #81ECEC;
    --bg-dark: #0F0A1A;
    --bg-panel: rgba(255, 255, 255, 0.03);
    --bg-input: rgba(0, 0, 0, 0.2);
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(108, 92, 231, 0.5);

    --success: #00b894;
    --warning: #fdcb6e;
    --error: #d63031;

    --js-color: #f1c40f;
    --css-color: #3498db;
    --img-color: #e74c3c;
    --font-color: #9b59b6;
    --html-color: #e67e22;

    --text-main: #FFFFFF;
    --text-muted: rgba(255, 255, 255, 0.6);

    --radius: 12px;
    --radius-sm: 8px;
    --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(108, 92, 231, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(129, 236, 236, 0.05) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Layout */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: rgba(0, 0, 0, 0.3);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(10px);
}

.logo {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
}

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

.route-nav {
    flex: 1;
    padding: 1.5rem 0;
    overflow-y: auto;
}

.nav-header {
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.nav-header h2 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.nav-list {
    list-style: none;
}

.nav-item {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-left: 3px solid transparent;
    color: var(--text-muted);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-main);
}

.nav-item.active {
    background: rgba(108, 92, 231, 0.1);
    border-left-color: var(--primary);
    color: var(--text-main);
    font-weight: 500;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.top-bar {
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.01);
}

.route-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.route-info h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.template {
    background: rgba(129, 236, 236, 0.1);
    color: var(--accent);
    border: 1px solid rgba(129, 236, 236, 0.2);
}

/* Content Grid */
.content-grid {
    padding: 2.5rem;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

/* Panels */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    backdrop-filter: blur(10px);
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: -1rem;
    margin-bottom: 2rem;
}

/* Score Card */
.score-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.score-circle {
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.score-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

.score-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 4px;
}

/* SVG Circle styling applied via JS inline styles/classes */
.circle-bg {
    fill: none;
    stroke: var(--border);
    stroke-width: 6;
}

.circle-progress {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dasharray 0.5s ease;
}

.score-circle.success .circle-progress {
    stroke: var(--success);
}

.score-value.success {
    color: var(--success);
}

.score-circle.warning .circle-progress {
    stroke: var(--warning);
}

.score-value.warning {
    color: var(--warning);
}

.score-circle.error .circle-progress {
    stroke: var(--error);
}

.score-value.error {
    color: var(--error);
}

.score-details h4 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

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

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

.status-error {
    color: var(--error);
}

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

/* Total Meter */
.total-budget-meter {
    margin-top: 1rem;
}

.meter-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.meter-labels .value {
    font-family: ui-monospace, monospace;
    font-weight: 600;
}

.meter-track {
    height: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
}

.meter-fill {
    height: 100%;
    border-radius: 99px;
    transition: width var(--transition), background var(--transition);
}

/* Resource List */
.resource-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.resource-item {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 3fr;
    align-items: center;
    gap: 1.5rem;
}

.res-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.res-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.input-field label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-field input {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    padding: 0.5rem 0.75rem;
    font-family: ui-monospace, monospace;
    font-size: 0.9rem;
    transition: all var(--transition);
    width: 100%;
}

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

.res-meter-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 1.1rem;
}

.res-meter-track {
    height: 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 99px;
    overflow: hidden;
}

.res-meter-fill {
    height: 100%;
    transition: width var(--transition);
    border-radius: 99px;
}

/* Recommendations */
.recommendations {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    animation: slideIn 0.3s ease forwards;
}

.alert svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-warning {
    background: rgba(253, 203, 110, 0.1);
    border: 1px solid rgba(253, 203, 110, 0.3);
    color: var(--warning);
}

.alert-error {
    background: rgba(214, 48, 49, 0.1);
    border: 1px solid rgba(214, 48, 49, 0.3);
    color: #ff7675;
}

.alert-info {
    background: rgba(129, 236, 236, 0.1);
    border: 1px solid rgba(129, 236, 236, 0.3);
    color: var(--accent);
}

/* Common UI */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
}

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

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

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

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

.full-width {
    width: 100%;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
    padding: 0.25rem;
}

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

.dropdown {
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 2rem 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23FFFFFF%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem top 50%;
    background-size: 0.65rem auto;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 1;
    transition: opacity var(--transition);
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal {
    background: #1a1525;
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform var(--transition);
}

.modal-overlay.hidden .modal {
    transform: translateY(20px);
}

.modal h3 {
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.modal .actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
}

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

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

/* Responsive Grid */
@media (max-width: 1100px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        overflow: visible;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .top-bar,
    .content-grid {
        padding: 1.5rem;
    }

    .resource-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding-bottom: 1.5rem;
        border-bottom: 1px solid var(--border);
    }
}