/* Variabel CSS untuk konsistensi dan kemudahan pemeliharaan */
:root {
    --primary: #4CAF50;
    --secondary: #2196F3;
    --background: #f5f7fa;
    --card-bg: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --focus: #74b9ff;
}

/* Mode Gelap */
.dark-mode {
    --background: #2d3436;
    --card-bg: #3b444b;
    --text: #dfe6e9;
    --text-light: #b2bec3;
    --shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: var(--background);
    color: var(--text);
    transition: var(--transition);
    line-height: 1.6;
}

.container {
    display: flex;
    min-height: 100vh;
    flex-direction: column;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary), #388e3c);
    color: white;
    padding: 20px;
    position: fixed;
    height: 100%;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.sidebar__header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.sidebar__toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
}

.sidebar__menu {
    list-style: none;
}

.sidebar__menu li a {
    color: white;
    text-decoration: none;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: var(--transition);
}

.sidebar__menu li a:hover,
.sidebar__menu li a[aria-current="page"] {
    background-color: rgba(255, 255, 255, 0.2);
}

.sidebar__theme-toggle {
    position: absolute;
    bottom: 20px;
    left: 20px;
    cursor: pointer;
    font-size: 1.3rem;
    transition: var(--transition);
}

.sidebar__theme-toggle:hover {
    transform: scale(1.1);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    padding: 30px;
    width: calc(100% - 260px);
    flex: 1;
}

.header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
    text-align: center;
}

.header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.2rem;
    font-weight: 300;
}

.section {
    margin-bottom: 50px;
}

.section h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Card */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.card {
    background-color: var(--card-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeIn 0.5s ease forwards;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.card h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.card__value.non-optimal {
    color: #e74c3c; /* Merah untuk pH kurang optimal */
}

.status-text {
    display: block;
    font-size: 0.9rem;
    color: #e74c3c; /* Merah untuk teks "Kurang Optimal" */
    margin-top: 5px;
}

/* Animasi Fade-In */
@keyframes fadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chart Grid */
.chart-container {
    padding: 25px;
}

.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chart-item h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.chart-item canvas {
    max-width: 100%;
}

.chart-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
}

.chart-controls button {
    padding: 12px 25px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    will-change: transform, background-color;
}

.chart-controls button:hover {
    background-color: #43a047;
    transform: translateY(-2px);
}

.chart-controls button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(116, 185, 255, 0.3);
}

/* Prediction Table */
.prediction-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.prediction-table th,
.prediction-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
}

.prediction-table th {
    background-color: var(--primary);
    color: white;
}

.prediction-table tr:nth-child(even) {
    background-color: #f2f2f2;
}

body.dark-mode .prediction-table tr:nth-child(even) {
    background-color: #34495e;
}

.prediction-table tr:hover {
    background-color: #ddd;
}

body.dark-mode .prediction-table tr:hover {
    background-color: #4a6278;
}

.prediction-table .optimal {
    color: #4CAF50;
    font-weight: 600;
}

.prediction-table .non-optimal {
    color: #FF5733;
    font-weight: 600;
}

/* Footer */
.footer {
    background-color: var(--card-bg);
    padding: 20px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
}

/* Responsivitas */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    .main-content {
        margin-left: 220px;
        width: calc(100% - 220px);
    }
    .header h1 {
        font-size: 2.4rem;
    }
    .section h2 {
        font-size: 1.8rem;
    }
    .chart-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        top: 0;
        transform: translateY(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.active {
        transform: translateY(0);
    }
    .sidebar__toggle {
        display: block;
    }
    .sidebar__menu {
        display: none;
    }
    .sidebar__menu.active {
        display: block;
    }
    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }
    .header {
        padding: 20px;
    }
    .header h1 {
        font-size: 2rem;
    }
    .card-grid {
        grid-template-columns: 1fr;
    }
    .chart-grid {
        grid-template-columns: 1fr;
    }
    .chart-controls {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #43a047;
}

/* Styling untuk tombol umum */
.btn {
    padding: 12px 25px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    will-change: transform, background-color;
}

.btn:hover {
    background-color: #43a047;
    transform: translateY(-2px);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(116, 185, 255, 0.3);
}

.countdown {
  padding: 10px;
  background-color: #f8d7da;
  color: #721c24;
  border-radius: 5px;
  text-align: center;
  margin-bottom: 10px;
}
.countdown span {
  font-weight: bold;
}