:root {
    --bg-dark: #0f1714;
    --bg-panel: rgba(22, 33, 27, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-main: #f0f8f5;
    --text-muted: #829a90;
    --primary: #00d26a;
    --primary-hover: #00ea76;
    --danger: #ff4757;
    --warning: #ffa502;
    --info: #1e90ff;
    --glass-blur: blur(16px);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(0, 210, 106, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(30, 144, 255, 0.04) 0%, transparent 50%);
    min-height: 100vh;
}

h1,
h2,
h3,
h4 {
    font-family: 'Outfit', sans-serif;
}

.app-container {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* Sidebar styling */
.sidebar {
    width: 440px;
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

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

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.logo-area .icon {
    font-size: 28px;
}

.logo-area h2 {
    font-size: 22px;
    font-weight: 600;
}

.logo-area h2 span {
    color: var(--primary);
    font-weight: 300;
}

.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.form-section h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

.input-group.full-width {
    grid-column: span 2;
}

/* Labels e Tooltips ("i") */
.input-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    cursor: help;
    position: relative;
    transition: 0.2s;
    font-family: 'Inter', sans-serif;
}

.info-icon:hover {
    background: var(--primary);
    color: #000;
}

.info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%);
    background: #111a15;
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    width: max-content;
    max-width: 220px;
    white-space: normal;
    text-align: center;
    border: 1px solid var(--primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, bottom 0.2s;
    z-index: 9999;
    line-height: 1.4;
}

.info-icon:hover::after {
    opacity: 1;
    bottom: 120%;
}

.info-icon::before {
    content: '';
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px;
    border-style: solid;
    border-color: var(--primary) transparent transparent transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, bottom 0.2s;
    z-index: 9999;
}

.info-icon:hover::before {
    opacity: 1;
    bottom: calc(120% - 12px);
}

.input-group input,
.input-group select {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    transition: 0.2s;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 210, 106, 0.05);
}

.btn-primary {
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
    font-family: 'Outfit', sans-serif;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 210, 106, 0.3);
}

.btn-clear {
    background: rgba(255, 71, 87, 0.15);
    border: 1px solid rgba(255, 71, 87, 0.4);
    color: var(--danger);
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-clear:hover {
    background: var(--danger);
    color: #FFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.3);
}

/* Main Area */
.main-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

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

.tabs-nav {
    display: flex;
    gap: 12px;
}

.tab-link {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
}

.tab-link:hover {
    background: rgba(255, 255, 255, 0.05);
}

.tab-link.active {
    background: var(--primary);
    color: #000;
    border-color: var(--primary);
}

.status-badge {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    border: 1px solid var(--border-color);
}

/* Tab contents */
.tab-content {
    display: none;
    padding: 32px 48px;
    overflow-y: auto;
    flex-grow: 1;
}

.tab-content.active {
    display: block;
}

.tab-content.code-tab {
    display: none;
    flex-direction: column;
    padding: 24px;
}

.tab-content.code-tab.active {
    display: flex;
}

/* Editors Toolbar */
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    background: var(--bg-panel);
    padding: 16px 24px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.toolbar-info h3 {
    margin-bottom: 4px;
    font-size: 18px;
}

.toolbar-info p {
    font-size: 13px;
    color: var(--text-muted);
}

.btn-save {
    width: auto;
    padding: 10px 24px;
}

/* CodeMirror customizations */
.editor-wrapper {
    flex-grow: 1;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    height: 100%;
}

.CodeMirror {
    height: 100% !important;
    font-family: Consolas, monospace !important;
    font-size: 14px;
}

/* Dashboard Elements */
.cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.cards-container-4 {
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.glass-card {
    background: var(--bg-panel);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.highlight-card {
    border-color: rgba(0, 210, 106, 0.3);
}

.highlight-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
}

.climate-card {
    border-color: rgba(30, 144, 255, 0.3);
}

.climate-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--info);
}

.card-title {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

/* Numbers in standard cards are scaled down */
.score-value {
    font-family: 'Outfit', sans-serif;
    font-size: 34px;
    font-weight: 700;
}

.score-max {
    color: var(--text-muted);
    font-size: 14px;
}

.card-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.liebig-alert {
    background: rgba(255, 71, 87, 0.1);
    color: var(--danger);
    padding: 10px;
    border-radius: 8px;
    font-size: 11px;
    margin-top: 4px;
    border: 1px solid rgba(255, 71, 87, 0.2);
}

/* To standout, the BIG final card */
.final-result-card {
    background: linear-gradient(135deg, rgba(0, 210, 106, 0.1) 0%, rgba(22, 33, 27, 0.8) 100%);
    border: 1px solid rgba(0, 210, 106, 0.2);
    border-radius: 20px;
    padding: 36px 48px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.result-left h3 {
    font-size: 32px;
    margin-bottom: 12px;
}

.result-left p {
    color: var(--text-muted);
    max-width: 480px;
    line-height: 1.6;
    font-size: 15px;
}

.circular-progress {
    width: 170px;
    height: 170px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) var(--progress), rgba(255, 255, 255, 0.05) 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.5s ease;
    flex-shrink: 0;
}

.inner-circle {
    width: 150px;
    height: 150px;
    background: var(--bg-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Emphasize final text */
.final-text {
    font-family: 'Outfit', sans-serif;
    font-size: 52px;
    font-weight: 700;
    letter-spacing: -1px;
}

.table-responsive {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.glass-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.glass-table th {
    background: rgba(255, 255, 255, 0.02);
    padding: 16px 20px;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.glass-table td {
    padding: 16px 20px;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-A {
    background: rgba(0, 210, 106, 0.15);
    color: var(--primary);
}

.badge-B {
    background: rgba(255, 165, 2, 0.15);
    color: var(--warning);
}

.badge-C {
    background: rgba(30, 144, 255, 0.15);
    color: var(--info);
}