:root {
    --bg: #0b1e14;
    --surface: rgba(20, 40, 30, 0.7);
    --text: #e2f0e6;
    --text-secondary: #a0c9b0;
    --accent: #4caf50;
    --accent-glow: rgba(76, 175, 80, 0.3);
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(145deg, #0a1a10 0%, #0f2a1c 100%);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    padding: 24px 16px;
}

.app {
    max-width: 900px;
    margin: 0 auto;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 2.5rem;
}

.logo i {
    color: var(--accent);
    filter: drop-shadow(0 0 10px var(--accent-glow));
}

h1 {
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tagline {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-top: 8px;
}

/* Cards */
.card {
    background: var(--surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

h2 i {
    color: var(--accent);
}

/* Form */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

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

.form-group label {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input, .form-group select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}

.form-group input:focus, .form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-group .unit {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* Buttons */
.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 40px;
    font-weight: 600;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.2);
}

.btn-primary:hover {
    background: #5cbf60;
    transform: scale(1.01);
}

.btn-large {
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
}

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

.btn-small {
    padding: 6px 14px;
    font-size: 0.9rem;
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Results */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.total-box {
    text-align: center;
    margin-bottom: 24px;
}

.total-value {
    font-size: 4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    line-height: 1.2;
}

.total-unit {
    font-size: 1rem;
    color: var(--text-secondary);
    display: block;
}

.metrics {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
}

.metric {
    background: rgba(0,0,0,0.2);
    padding: 12px 20px;
    border-radius: 40px;
    border: 1px solid var(--border);
}

.chart-container {
    height: 250px;
    margin: 20px 0;
}

.recommendations {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.rec-item {
    background: rgba(255,255,255,0.03);
    padding: 14px 18px;
    border-radius: 18px;
    border-left: 4px solid var(--accent);
}

/* History */
.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    justify-content: space-between;
    padding: 14px;
    border-bottom: 1px solid var(--border);
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    max-width: 500px;
    background: var(--surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.cookie-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cookie-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 32px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .card { padding: 20px; }
    .total-value { font-size: 3rem; }
}
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 20px 0 12px 0;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.references {
    margin-top: 16px;
    font-size: 0.8rem;
    opacity: 0.7;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}
/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    position: relative;
}
.modal-close {
    position: absolute;
    top: 16px; right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
}
.ref-link {
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
}
.ref-link:hover { text-decoration: underline; }
/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}
.tooltip .tooltiptext {
    visibility: hidden;
    width: 240px;
    background-color: #1e3a2e;
    color: #e2f0e6;
    text-align: center;
    padding: 8px 12px;
    border-radius: 12px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -120px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Interpretation */
.interpretation {
    background: rgba(76, 175, 80, 0.1);
    border-left: 4px solid var(--accent);
    padding: 12px 16px;
    border-radius: 12px;
    margin: 20px 0;
    font-size: 0.95rem;
}

/* Share section */
.share-section {
    margin-top: 24px;
    text-align: center;
}
.share-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px;
}
.share-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.share-btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Perbaikan undefined pada chart - pastikan canvas tidak overflow */
.chart-container {
    min-height: 250px;
}