:root {
    --primary: #2196F3;
    --primary-dark: #1976D2;
    --secondary: #4FC3F7;
    --accent: #FF7043;
    --bg: #E3F2FD;
    --card-bg: #FFFFFF;
    --text: #37474F;
    --text-light: #78909C;
    --success: #66BB6A;
    --font-family: 'Poppins', sans-serif;
    --radius: 16px;
    --shadow: 0 4px 20px rgba(0,0,0,0.05);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 80px; /* Space for mobile FABs */
}

/* Header */
header {
    text-align: center;
    padding: 40px 20px 20px;
}

header h1 {
    color: var(--primary-dark);
    font-size: 2rem;
    font-weight: 700;
}

header p {
    color: var(--text-light);
}

/* Layout */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    transition: transform 0.2s;
}

.hidden {
    display: none;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Form Styles */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 600px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

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

label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

input, select {
    padding: 12px;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
}

.input-wrapper {
    display: flex;
}

.input-wrapper input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex: 1;
}

.input-wrapper select {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    background-color: #F5F5F5;
    border-left: none;
    width: 70px;
}

.toggles {
    display: flex;
    gap: 20px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-primary {
    width: 100%;
    margin-top: 24px;
    padding: 14px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

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

/* Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

@media (min-width: 600px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Water Wave Visualization */
.water-visual-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.wave-container {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 4px solid var(--primary-dark);
    position: relative;
    overflow: hidden;
    background: white;
    margin-bottom: 20px;
    z-index: 1;
}

.water-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%; /* Dynamic */
    background: var(--secondary);
    transition: height 1s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

/* Creating the wave effect using pseudo elements is complex in static CSS without extra markup or JS canvas, 
   so using a simple CSS gradient animation or just a rising block for robustness. 
   Adding a subtle pulse animation. */
.water-wave::after {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 20px;
    background: inherit;
    border-radius: 50%;
    transform: scaleX(1.5);
    opacity: 0.5;
}

.water-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
}

.water-info h3 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text);
}

.water-info p {
    font-size: 0.8rem;
    color: var(--text-light);
}

.daily-stats {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 10px;
}

.daily-stats div {
    text-align: center;
}

.daily-stats .label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
}

.daily-stats .value {
    font-weight: 600;
    color: var(--primary-dark);
}

/* Controls */
.controls-card h3 {
    margin-bottom: 16px;
    text-align: center;
}

.cup-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.btn-cup {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px;
    border: 2px solid var(--bg);
    background: transparent;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.btn-cup:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.btn-cup .icon {
    font-size: 1.2rem;
}

.btn-undo {
    width: 100%;
    padding: 8px;
    background: transparent;
    border: none;
    color: #ef5350;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: underline;
}

/* Settings */
.settings-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.small-text {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-top: 10px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Snacks */
.snack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.snack-item {
    background: #FFF3E0;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.85rem;
    color: #E65100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.snack-icon {
    font-size: 1.5rem;
}

.recalc-container {
    text-align: center;
    margin-top: 20px;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    text-decoration: underline;
    font-size: 0.9rem;
}

/* Floating Action Buttons */
.floating-actions {
    position: fixed;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.fab {
    padding: 12px 20px;
    border-radius: 50px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: transform 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.fab:hover {
    transform: scale(1.05);
}

.btn-coffee {
    background-color: #00C853; /* Green */
}
.btn-coffee:hover {
    background-color: #D50000; /* Red on hover per spec */
}

.btn-share {
    background-color: #2979FF; /* Blue */
}
.btn-share:hover {
    background-color: #1565C0;
}

/* Responsive FAB positioning */
/* Desktop (>= 1024px) */
@media (min-width: 1024px) {
    .floating-actions {
        flex-direction: column;
        right: 30px;
        top: 50%;
        transform: translateY(-50%);
    }
}

/* Mobile (< 1024px) */
@media (max-width: 1023px) {
    .floating-actions {
        flex-direction: row;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: max-content;
    }
}
