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

:root {
    /* Section Colors */
    --jogging-color: #22c55e;
    --jogging-bg: rgba(34, 197, 94, 0.15);
    --water-color: #3b82f6;
    --water-bg: rgba(59, 130, 246, 0.15);
    --weight-color: #f59e0b;
    --weight-bg: rgba(245, 158, 11, 0.15);
    --calories-color: #ef4444;
    --calories-bg: rgba(239, 68, 68, 0.15);
    --sleep-color: #8b5cf6;
    --sleep-bg: rgba(139, 92, 246, 0.15);
    --steps-color: #ec4899;
    --steps-bg: rgba(236, 72, 153, 0.15);
    --walking-color: #14b8a6;
    --walking-bg: rgba(20, 184, 166, 0.15);
    --history-color: #a78bfa;
    --history-bg: rgba(167, 139, 250, 0.15);
}

html {
    scroll-behavior: smooth;
}

/* PIN Lock Screen */
.pin-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pin-overlay.hidden {
    display: none;
}

.pin-container {
    text-align: center;
    padding: 30px;
}

.pin-container h2 {
    color: #fff;
    margin-bottom: 30px;
    font-size: 1.5rem;
    font-weight: 500;
}

.pin-display {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.pin-dot {
    width: 18px;
    height: 18px;
    border: 2px solid #4a5568;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.pin-dot.filled {
    background: var(--jogging-color);
    border-color: var(--jogging-color);
}

.pin-dot.error {
    border-color: #ef4444;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.pin-error {
    color: #ef4444;
    font-size: 0.85rem;
    height: 20px;
    margin-bottom: 10px;
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 70px);
    gap: 15px;
    justify-content: center;
}

.pin-key {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid #4a5568;
    background: transparent;
    color: #fff;
    font-size: 1.8rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pin-key:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #718096;
}

.pin-key:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.95);
}

.pin-key-empty {
    border: none;
    cursor: default;
}

.pin-key-empty:hover {
    background: transparent;
}

.pin-key-delete {
    font-size: 1.5rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    color: #fff;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 40px;
}

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

header h1 {
    font-size: 1.8rem;
    color: #4ade80;
    margin-bottom: 5px;
}

.date {
    color: #94a3b8;
    font-size: 0.95rem;
}

.sync-status {
    display: inline-block;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 10px;
    margin-top: 8px;
    transition: all 0.3s ease;
}

.sync-status.syncing {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.sync-status.synced {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.sync-status.error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    max-width: 100%;
    word-wrap: break-word;
    text-align: center;
    padding: 8px 12px;
    font-size: 0.7rem;
}

.steps-needed-header {
    margin-top: 15px;
    font-size: 1.1rem;
    color: #94a3b8;
}

.steps-needed-header span:last-child {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    color: #f59e0b;
    margin-left: 8px;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 30px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px 10px;
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.stat-card.jogging { background: var(--jogging-bg); border: 1px solid var(--jogging-color); }
.stat-card.water { background: var(--water-bg); border: 1px solid var(--water-color); }
.stat-card.weight { background: var(--weight-bg); border: 1px solid var(--weight-color); }
.stat-card.calories { background: var(--calories-bg); border: 1px solid var(--calories-color); }
.stat-card.sleep { background: var(--sleep-bg); border: 1px solid var(--sleep-color); }
.stat-card.steps { background: var(--steps-bg); border: 1px solid var(--steps-color); }
.stat-card.walking { background: var(--walking-bg); border: 1px solid var(--walking-color); }

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.stat-card.jogging .stat-label { color: var(--jogging-color); }
.stat-card.water .stat-label { color: var(--water-color); }
.stat-card.weight .stat-label { color: var(--weight-color); }
.stat-card.calories .stat-label { color: var(--calories-color); }
.stat-card.sleep .stat-label { color: var(--sleep-color); }
.stat-card.steps .stat-label { color: var(--steps-color); }
.stat-card.walking .stat-label { color: var(--walking-color); }

.stat-value {
    font-size: 1.3rem;
    font-weight: 600;
    color: #fff;
    font-family: 'Courier New', monospace;
}

/* Tracker Sections */
.tracker-section {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid;
}

.section-title.jogging { color: var(--jogging-color); border-color: var(--jogging-color); }
.section-title.water { color: var(--water-color); border-color: var(--water-color); }
.section-title.weight { color: var(--weight-color); border-color: var(--weight-color); }
.section-title.calories { color: var(--calories-color); border-color: var(--calories-color); }
.section-title.sleep { color: var(--sleep-color); border-color: var(--sleep-color); }
.section-title.steps { color: var(--steps-color); border-color: var(--steps-color); }
.section-title.walking { color: var(--walking-color); border-color: var(--walking-color); }
.section-title.history { color: var(--history-color); border-color: var(--history-color); }

/* Stopwatch */
.stopwatch-display {
    font-size: 3.5rem;
    font-weight: 300;
    font-family: 'Courier New', monospace;
    color: #fff;
    text-align: center;
    margin-bottom: 20px;
    letter-spacing: 2px;
}

/* Action Buttons */
.btn-action {
    display: block;
    width: 100%;
    padding: 14px;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #fff;
}

.btn-action.jogging { background: var(--jogging-color); }
.btn-action.water { background: var(--water-color); }
.btn-action.weight { background: var(--weight-color); }
.btn-action.calories { background: var(--calories-color); }
.btn-action.sleep { background: var(--sleep-color); }
.btn-action.steps { background: var(--steps-color); }
.btn-action.walking { background: var(--walking-color); }

.btn-action:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.btn-action.running {
    background: #ef4444 !important;
}

/* Quick Add Buttons */
.quick-add {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.quick-btn {
    flex: 1;
    padding: 12px 8px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 2px solid;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s ease;
}

.quick-btn.water { color: var(--water-color); border-color: var(--water-color); }
.quick-btn.calories { color: var(--calories-color); border-color: var(--calories-color); }
.quick-btn.steps { color: var(--steps-color); border-color: var(--steps-color); }
.quick-btn.walking { color: var(--walking-color); border-color: var(--walking-color); }

.quick-btn:hover {
    color: #fff;
}
.quick-btn.water:hover { background: var(--water-color); }
.quick-btn.calories:hover { background: var(--calories-color); }
.quick-btn.steps:hover { background: var(--steps-color); }
.quick-btn.walking:hover { background: var(--walking-color); }

/* Custom Add Input */
.custom-add {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.custom-add input {
    flex: 1;
    padding: 12px 15px;
    font-size: 1rem;
    border: 2px solid #334155;
    border-radius: 8px;
    background: #0f172a;
    color: #fff;
}

.custom-add input:focus {
    outline: none;
    border-color: #4ade80;
}

.custom-add .btn-action {
    width: auto;
    padding: 12px 18px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Sleep Time Inputs */
.sleep-times {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.sleep-time-input {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sleep-time-input label {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sleep-time-input input[type="time"] {
    padding: 12px;
    font-size: 1.1rem;
    border: 2px solid #334155;
    border-radius: 8px;
    background: #0f172a;
    color: #fff;
    text-align: center;
    color-scheme: dark;
}

.sleep-time-input input[type="time"]::-webkit-calendar-picker-indicator {
    background: none;
    display: none;
}

.sleep-time-input input[type="time"] {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cpolyline points='12 6 12 12 16 14'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.sleep-time-input input[type="time"]:focus {
    outline: none;
    border-color: var(--sleep-color);
}

/* Current Stat Display */
.current-stat {
    text-align: center;
    padding: 20px;
}

.stat-big {
    font-size: 3rem;
    font-weight: 300;
    font-family: 'Courier New', monospace;
}

.stat-unit {
    font-size: 1.2rem;
    color: #94a3b8;
    margin-left: 5px;
}

/* Entries List */
.entries-list {
    list-style: none;
    margin: 15px 0;
    max-height: 200px;
    overflow-y: auto;
}

.entry-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.entry-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.entry-value {
    font-size: 1.2rem;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    transition: background 0.2s ease;
}

.entry-value:hover {
    background: rgba(255, 255, 255, 0.1);
}

.delete-btn {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 5px 10px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.delete-btn:hover {
    opacity: 1;
}

/* Section Total */
.section-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 10px;
}

.section-total span:first-child {
    color: #94a3b8;
}

.section-total span:last-child {
    font-family: 'Courier New', monospace;
    font-weight: 600;
}

.steps-needed span:last-child {
    color: #f59e0b;
}

.water-needed span:last-child {
    color: var(--water-color);
}

.calories-remaining span:last-child {
    color: var(--calories-color);
}

.lbs-to-lose span:last-child {
    color: var(--weight-color);
}

.sleep-needed span:last-child {
    color: var(--sleep-color);
}

.protein-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 20px 0 15px;
}

.subsection-title {
    font-size: 0.95rem;
    color: var(--calories-color);
    margin-bottom: 15px;
    font-weight: 600;
}

/* Goal Adjuster */
.goal-adjuster {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin: 15px 0;
}

.goal-adjuster span:first-child {
    color: #94a3b8;
}

.goal-adjuster span:not(:first-child):not(.goal-btn) {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
}

.goal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.goal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Empty state */
.empty-state {
    text-align: center;
    color: #64748b;
    padding: 20px;
    font-style: italic;
    font-size: 0.9rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    min-width: 280px;
    max-width: 90%;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: #4ade80;
}

.time-inputs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 25px;
}

.time-inputs input {
    width: 65px;
    padding: 12px 8px;
    font-size: 1.3rem;
    text-align: center;
    border: 2px solid #334155;
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
    font-family: 'Courier New', monospace;
}

.time-inputs input:focus {
    outline: none;
    border-color: #4ade80;
}

.time-inputs span {
    font-size: 2rem;
    color: #94a3b8;
}

.edit-input {
    width: 100%;
    padding: 15px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid #334155;
    border-radius: 10px;
    background: #0f172a;
    color: #fff;
    font-family: 'Courier New', monospace;
    margin-bottom: 25px;
}

.edit-input:focus {
    outline: none;
    border-color: #4ade80;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-cancel,
.btn-save {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-cancel {
    background: #334155;
    color: #fff;
}

.btn-cancel:hover {
    background: #475569;
}

.btn-save {
    background: #22c55e;
    color: #fff;
}

.btn-save:hover {
    background: #16a34a;
}

/* Scrollbar styling */
.entries-list::-webkit-scrollbar {
    width: 6px;
}

.entries-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.entries-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.entries-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* History Section */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-day {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.history-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.history-day-header:hover {
    background: rgba(255, 255, 255, 0.08);
}

.history-date {
    font-weight: 600;
    color: var(--history-color);
}

.history-toggle {
    color: #94a3b8;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.history-day.expanded .history-toggle {
    transform: rotate(180deg);
}

.history-day-content {
    display: none;
    padding: 0 15px 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.history-day.expanded .history-day-content {
    display: block;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.history-stat {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.history-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #94a3b8;
    margin-bottom: 5px;
}

.history-stat-value {
    font-family: 'Courier New', monospace;
    font-weight: 600;
    font-size: 1rem;
}

.history-stat.jogging .history-stat-value { color: var(--jogging-color); }
.history-stat.walking .history-stat-value { color: var(--walking-color); }
.history-stat.water .history-stat-value { color: var(--water-color); }
.history-stat.calories .history-stat-value { color: var(--calories-color); }
.history-stat.sleep .history-stat-value { color: var(--sleep-color); }
.history-stat.weight .history-stat-value { color: var(--weight-color); }

/* Mobile breakpoint */
@media (max-width: 476px) {
    .custom-add .btn-action {
        padding: 10px 12px;
        font-size: 0.9rem;
    }

    .quick-btn {
        padding: 10px 6px;
        font-size: 0.8rem;
    }

    .goal-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .sleep-times {
        flex-direction: column;
    }
}

@media (max-width: 450px) {
    .custom-add input[type="number"] {
        max-width: 227px;
    }
}
