/* ========== RESET & BASE ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
    font-family: 'Nunito', -apple-system, sans-serif;
    background: #fef0f5;
    color: #4a3040;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea {
    font-family: inherit;
    font-size: 1rem;
    border: 2px solid #f0d0e0;
    border-radius: 12px;
    padding: 12px 16px;
    background: #fff;
    color: #4a3040;
    width: 100%;
    outline: none;
    transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { border-color: #f8a5c2; }

/* ========== SCREENS ========== */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* ========== SPLASH & AUTH ========== */
#splash-screen, #login-screen, #register-screen {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 50%, #f48fb1 100%);
    justify-content: center; align-items: center;
    padding: 24px;
}
.splash-content { text-align: center; max-width: 380px; width: 100%; }
.splash-icon { font-size: 80px; margin-bottom: 8px; }
#splash-screen h1, #login-screen h1, #register-screen h1 {
    font-size: 2.2rem; font-weight: 800;
    color: #880e4f; margin-bottom: 4px;
}
.splash-subtitle { color: #ad1457; font-size: 1rem; margin-bottom: 32px; }
.onboarding-form { display: flex; flex-direction: column; gap: 12px; }
.onboarding-form input, .onboarding-form select {
    background: rgba(255,255,255,.9); border: 2px solid rgba(255,255,255,.5);
}
.onboarding-form input:focus, .onboarding-form select:focus { border-color: #fff; }

.auth-error {
    color: #c62828;
    font-size: .85rem;
    font-weight: 700;
    margin-top: 8px;
    min-height: 20px;
}

/* ========== BUTTONS ========== */
.btn-primary {
    background: linear-gradient(135deg, #f48fb1, #ec407a);
    color: #fff; border: none; border-radius: 14px;
    padding: 14px 28px; font-weight: 700; font-size: 1rem;
    box-shadow: 0 4px 15px rgba(236,64,122,.3);
    transition: transform .15s, box-shadow .15s;
}
.btn-primary:active { transform: scale(.97); box-shadow: 0 2px 8px rgba(236,64,122,.2); }
.btn-large { padding: 16px 32px; font-size: 1.1rem; }
.btn-sm { padding: 8px 16px; border-radius: 10px; font-size: .85rem; font-weight: 700; }
.btn-danger { background: #ef5350; color: #fff; }
.btn-outline {
    border: 2px solid #f48fb1; color: #ec407a; border-radius: 10px;
    padding: 8px 16px; font-weight: 700; font-size: .85rem;
}
.btn-danger-outline { border-color: #ef5350; color: #ef5350; }
.btn-icon { font-size: 1.4rem; padding: 4px 8px; }
.btn-close { font-size: 1.5rem; line-height: 1; color: #999; }

/* ========== HEADER ========== */
.app-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 20px; background: #fff;
    border-bottom: 1px solid #fce4ec;
    position: sticky; top: 0; z-index: 100;
}
.baby-name-header { font-weight: 800; font-size: 1.15rem; color: #880e4f; }
.baby-age-header { font-size: .8rem; color: #ad1457; margin-left: 8px; }

/* ========== BOTTOM NAV ========== */
.bottom-nav {
    display: flex; justify-content: space-around;
    background: #fff; border-top: 1px solid #fce4ec;
    padding: 6px 0 max(6px, env(safe-area-inset-bottom));
    position: sticky; bottom: 0; z-index: 100;
}
.nav-btn {
    display: flex; flex-direction: column; align-items: center;
    padding: 4px 2px; font-size: .65rem; color: #bbb;
    transition: color .2s; min-width: 48px;
}
.nav-btn.active { color: #ec407a; }
.nav-icon { font-size: 1.3rem; margin-bottom: 2px; }
.nav-label { font-weight: 700; }

/* ========== TAB CONTENT ========== */
.tab-content {
    flex: 1; overflow-y: auto; padding: 16px;
    padding-bottom: 100px;
    -webkit-overflow-scrolling: touch;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.section-title {
    font-size: 1.3rem; font-weight: 800; color: #880e4f;
    margin-bottom: 16px;
}

/* ========== CARDS ========== */
.card {
    background: #fff; border-radius: 16px;
    padding: 16px; margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(136,14,79,.06);
}
.card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 12px;
}
.card-title { font-weight: 700; font-size: 1rem; color: #880e4f; }

/* ========== QUICK ACTIONS ========== */
.quick-actions {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 10px; margin-bottom: 16px;
}
.quick-btn {
    display: flex; flex-direction: column; align-items: center;
    background: #fff; border-radius: 16px; padding: 16px 8px;
    box-shadow: 0 2px 12px rgba(136,14,79,.06);
    transition: transform .15s, box-shadow .15s;
}
.quick-btn:active { transform: scale(.95); box-shadow: 0 1px 6px rgba(136,14,79,.1); }
.quick-icon { font-size: 2rem; margin-bottom: 6px; }
.quick-label { font-size: .8rem; font-weight: 700; color: #880e4f; }

/* ========== TIMER CARD ========== */
.timer-card {
    background: linear-gradient(135deg, #fce4ec, #f8bbd0);
    display: flex; justify-content: space-between; align-items: center;
    animation: pulse-soft 2s infinite;
}
.timer-label { font-weight: 700; color: #880e4f; font-size: 1rem; }
.timer-display { font-size: 2rem; font-weight: 800; color: #c2185b; font-variant-numeric: tabular-nums; }
.timer-actions { display: flex; gap: 8px; }
@keyframes pulse-soft {
    0%, 100% { box-shadow: 0 2px 12px rgba(236,64,122,.15); }
    50% { box-shadow: 0 2px 24px rgba(236,64,122,.3); }
}

/* ========== BREAST INDICATOR ========== */
.breast-indicator-card { text-align: center; }
.breast-indicator {
    display: flex; justify-content: center; align-items: center; gap: 20px;
    margin-bottom: 8px;
}
.breast-circle {
    width: 80px; height: 80px; border-radius: 50%;
    background: #fce4ec; display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    border: 3px solid #f0d0e0; transition: all .3s;
}
.breast-circle.active {
    background: linear-gradient(135deg, #f48fb1, #ec407a);
    border-color: #ec407a;
}
.breast-circle.active .breast-letter { color: #fff; }
.breast-circle.active .breast-time { color: rgba(255,255,255,.8); }
.breast-letter { font-weight: 800; font-size: 1.5rem; color: #c2185b; }
.breast-time { font-size: .7rem; color: #ad1457; margin-top: 2px; }
.breast-arrow { font-size: 1.5rem; color: #ec407a; font-weight: 800; }
.breast-suggestion { font-size: .85rem; color: #ad1457; font-weight: 600; }

/* ========== SUMMARY GRID ========== */
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.summary-item { text-align: center; }
.summary-value { display: block; font-size: 1.5rem; font-weight: 800; color: #c2185b; }
.summary-label { font-size: .7rem; color: #ad1457; font-weight: 600; }

/* ========== STATS ROW ========== */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card {
    background: #fff; border-radius: 14px; padding: 14px 8px;
    text-align: center; box-shadow: 0 2px 12px rgba(136,14,79,.06);
}
.stat-number { display: block; font-size: 1.4rem; font-weight: 800; color: #c2185b; }
.stat-desc { font-size: .7rem; color: #ad1457; font-weight: 600; }

/* ========== BALANCE BAR ========== */
.breast-balance { margin-bottom: 8px; }
.balance-bar-container {
    display: flex; height: 36px; border-radius: 18px; overflow: hidden;
    background: #fce4ec;
}
.balance-bar-left {
    background: linear-gradient(90deg, #f48fb1, #ec407a);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: .8rem;
    transition: width .5s;
}
.balance-bar-right {
    background: linear-gradient(90deg, #ce93d8, #ab47bc);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: .8rem;
    transition: width .5s;
}
.breast-balance-detail { font-size: .8rem; color: #666; text-align: center; }

/* ========== LAST FEED ========== */
.last-feed-info { text-align: center; }
.last-feed-time { font-size: 1.5rem; font-weight: 800; color: #c2185b; }
.last-feed-detail { font-size: .85rem; color: #ad1457; margin-top: 4px; }
.last-feed-ago { font-size: .9rem; color: #666; margin-top: 4px; font-weight: 600; }

/* ========== TIMELINE ========== */
.timeline { max-height: 300px; overflow-y: auto; }
.timeline-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid #fce4ec;
}
.timeline-item:last-child { border-bottom: none; }
.timeline-icon { font-size: 1.5rem; width: 36px; text-align: center; }
.timeline-info { flex: 1; }
.timeline-title { font-weight: 700; font-size: .9rem; }
.timeline-subtitle { font-size: .75rem; color: #999; }
.timeline-time { font-size: .75rem; color: #ad1457; font-weight: 700; text-align: right; }
.timeline-delete { color: #ef5350; font-size: .75rem; font-weight: 700; padding: 4px; }

/* ========== HISTORY LIST ========== */
.history-list { max-height: 400px; overflow-y: auto; }
.history-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid #fce4ec;
}
.history-item:last-child { border-bottom: none; }
.history-icon { font-size: 1.3rem; }
.history-info { flex: 1; }
.history-title { font-weight: 700; font-size: .85rem; }
.history-detail { font-size: .75rem; color: #999; }
.history-time { font-size: .75rem; color: #ad1457; font-weight: 700; }

/* ========== DIAPER ========== */
.diaper-quick-add {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin-bottom: 16px;
}
.diaper-btn {
    display: flex; flex-direction: column; align-items: center;
    background: #fff; border-radius: 14px; padding: 14px 8px;
    box-shadow: 0 2px 12px rgba(136,14,79,.06);
    transition: transform .15s;
}
.diaper-btn:active { transform: scale(.95); }
.diaper-icon { font-size: 1.5rem; margin-bottom: 4px; }
.diaper-btn span:last-child { font-size: .75rem; font-weight: 700; color: #880e4f; }

/* ========== SLEEP ========== */
.sleep-toggle-area { text-align: center; margin-bottom: 20px; }
.sleep-toggle-btn {
    background: linear-gradient(135deg, #7e57c2, #5c6bc0);
    color: #fff; border-radius: 50%; width: 120px; height: 120px;
    display: inline-flex; flex-direction: column; align-items: center;
    justify-content: center; box-shadow: 0 6px 20px rgba(126,87,194,.3);
    transition: transform .15s, box-shadow .15s;
}
.sleep-toggle-btn.sleeping {
    background: linear-gradient(135deg, #ef5350, #e53935);
    box-shadow: 0 6px 20px rgba(239,83,80,.3);
    animation: pulse-soft 2s infinite;
}
.sleep-toggle-icon { font-size: 2.5rem; }
.sleep-toggle-text { font-size: .75rem; font-weight: 700; margin-top: 4px; }
.sleep-timer-display { margin-top: 12px; }
#sleep-timer-value { font-size: 2rem; font-weight: 800; color: #5c6bc0; font-variant-numeric: tabular-nums; }
.sleep-timer-label { display: block; font-size: .8rem; color: #7e57c2; }

/* ========== GROWTH ========== */
.growth-add { margin-bottom: 16px; }

/* ========== HEALTH ========== */
.health-quick-actions {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 10px; margin-bottom: 16px;
}
.health-btn {
    display: flex; flex-direction: column; align-items: center;
    background: #fff; border-radius: 14px; padding: 14px 8px;
    box-shadow: 0 2px 12px rgba(136,14,79,.06);
    transition: transform .15s;
}
.health-btn:active { transform: scale(.95); }
.health-icon { font-size: 1.5rem; margin-bottom: 4px; }
.health-btn span:last-child { font-size: .75rem; font-weight: 700; color: #880e4f; }

/* ========== MILESTONES ========== */
.milestones-list { max-height: 300px; overflow-y: auto; }
.milestone-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid #fce4ec;
}
.milestone-check {
    width: 24px; height: 24px; border-radius: 50%;
    border: 2px solid #f48fb1; display: flex; align-items: center;
    justify-content: center; font-size: .8rem; color: #fff; cursor: pointer;
    transition: background .2s;
}
.milestone-check.done { background: #ec407a; border-color: #ec407a; }
.milestone-text { flex: 1; font-size: .85rem; }
.milestone-text.done { text-decoration: line-through; color: #999; }
.milestone-age { font-size: .7rem; color: #999; }

/* ========== MODALS ========== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.5);
    display: flex; justify-content: center; align-items: flex-end;
    z-index: 1000; backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal {
    background: #fff; border-radius: 20px 20px 0 0;
    padding: 24px; width: 100%; max-width: 500px;
    max-height: 85vh; overflow-y: auto;
    animation: slide-up .3s ease;
}
.modal-settings { border-radius: 20px 20px 0 0; }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 20px;
}
.modal-header h3 { font-weight: 800; color: #880e4f; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.setting-group label { display: block; font-weight: 700; color: #880e4f; font-size: .85rem; margin-bottom: 4px; }
@keyframes slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ========== EMPTY STATE ========== */
.empty-state { text-align: center; color: #ccc; font-size: .9rem; padding: 20px 0; }

/* ========== HIDDEN ========== */
.hidden { display: none !important; }

/* ========== CHART CANVAS ========== */
canvas { width: 100% !important; max-height: 200px; }

/* ========== TOAST ========== */
.toast {
    position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
    background: #333; color: #fff; padding: 12px 24px;
    border-radius: 12px; font-weight: 700; font-size: .85rem;
    z-index: 2000; animation: toast-in .3s ease;
    max-width: 90%;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ========== RESPONSIVE ========== */
@media (min-width: 600px) {
    .tab-content { max-width: 500px; margin: 0 auto; }
    .modal { max-width: 450px; margin: 0 auto; border-radius: 20px; align-self: center; }
}

/* Form in modal */
.modal-form { display: flex; flex-direction: column; gap: 12px; }
.modal-form label { font-weight: 700; color: #880e4f; font-size: .85rem; }
.modal-form .form-row { display: flex; gap: 8px; }
.modal-form .form-row > * { flex: 1; }
.note-input { min-height: 60px; resize: vertical; }

/* Color dots for stool */
.stool-colors { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.stool-color {
    width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent;
    cursor: pointer; transition: border-color .2s;
}
.stool-color.selected { border-color: #ec407a; }
