/* ---------- Reset & base ---------- */
* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background: #f4f6f8;
    color: #222;
    line-height: 1.5;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
    padding-bottom: 4rem;
}

h1 { font-size: 1.6rem; margin: 0.5rem 0 1rem; display: flex; align-items: center; gap: 0.5rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; }
h3.subheader { font-size: 0.85rem; text-transform: uppercase; color: #777; margin: 1rem 0 0.5rem; letter-spacing: 0.5px; }

.date-pill {
    font-size: 0.85rem;
    background: #e3eaf2;
    color: #4a6178;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-weight: 500;
}

/* ---------- Navbar ---------- */
.navbar {
    background: #2c3e50;
    color: white;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .brand {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05rem;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: background 0.15s;
}

.nav-links a:hover, .nav-links a:active {
    background: rgba(255,255,255,0.15);
}

.nav-logout { margin: 0; padding: 0; }
.nav-logout button {
    background: none;
    border: none;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
    border-radius: 6px;
    font-family: inherit;
}
.nav-logout button:hover { background: rgba(255,255,255,0.15); color: white; }

/* ---------- Cards ---------- */
.card {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.card-inbox {
    background: #fffbe6;
    border-left: 4px solid #f0c419;
}

.grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 700px) {
    .grid { grid-template-columns: 1fr 1fr; }
    .grid .card:first-child { grid-column: 1 / -1; }
}

/* ---------- Forms ---------- */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.form-row input[type="text"],
.form-row input[type="number"],
.form-row input[type="date"],
.form-row input[type="datetime-local"],
.form-row select {
    flex: 1 1 140px;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
}

.form-row input[type="text"] { flex: 2 1 200px; }

.form-row button {
    padding: 0.6rem 1.2rem;
    background: #2c7be5;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
}

.form-row button:hover { background: #1f63c2; }

.field-label {
    display: flex;
    flex-direction: column;
    flex: 1 1 160px;
    font-size: 0.8rem;
    color: #666;
}

.field-label span { margin-bottom: 0.2rem; padding-left: 0.2rem; }

.field-label input { margin: 0; }

.quick-form {
    display: flex;
    gap: 0.5rem;
}

.quick-form input {
    flex: 1;
    padding: 0.7rem;
    border: 1px solid #e0d59e;
    border-radius: 8px;
    background: white;
    font-size: 1rem;
}

.quick-form button {
    padding: 0.7rem 1rem;
    background: #f0c419;
    color: #4a3a00;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
}

/* ---------- Login page ---------- */
.login-main {
    max-width: 360px;
    margin: 4rem auto;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.login-form input {
    padding: 0.7rem 0.9rem;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    font-size: 1rem;
}

.login-form button {
    padding: 0.7rem;
    background: #2c7be5;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    margin-top: 0.3rem;
}

.login-form button:hover { background: #1f63c2; }

/* ---------- Lists ---------- */
.task-list, .simple-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
}

.task-list li, .simple-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #eef1f4;
    flex-wrap: wrap;
}

.task-list li:last-child, .simple-list li:last-child { border-bottom: none; }

.task-list li > span { flex: 1; min-width: 0; word-wrap: break-word; }

.task-list li.done > span { color: #999; }

/* Inline edit form for open tasks */
.edit-form {
    display: flex;
    flex: 1;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
    margin: 0;
}

.edit-form input[type="text"] {
    flex: 2 1 140px;
    min-width: 0;
    padding: 0.4rem 0.6rem;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 0.95rem;
}

.edit-form select {
    flex: 1 1 90px;
    padding: 0.4rem;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
}

.btn-save {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.2rem 0.4rem;
    color: #2c7be5;
}

.btn-save:hover { color: #1f63c2; }

/* ---------- Calendar ---------- */
.month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.5rem;
}

.month-title {
    margin: 0;
    font-size: 1.2rem;
    text-align: center;
    flex: 1;
}

.month-btn {
    padding: 0.4rem 0.9rem;
    background: #e3eaf2;
    color: #2c3e50;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.month-btn:hover { background: #d0dbe7; }

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #e0e6ec;
    border: 1px solid #e0e6ec;
    border-radius: 6px;
    overflow: hidden;
}

.cal-weekday {
    background: #f8f9fa;
    padding: 0.4rem 0.3rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-day {
    background: white;
    min-height: 90px;
    padding: 0.3rem;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cal-day-out { background: #fafbfc; color: #bbb; }
.cal-day-today { background: #fff8e1; }
.cal-day-today .cal-daynum {
    background: #ff9800;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.cal-daynum {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 2px;
}

/* Make the day number a clickable link, but keep its plain look */
a.cal-daylink {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    padding: 0 0.25rem;
    border-radius: 4px;
    cursor: pointer;
}
a.cal-daylink:hover {
    background: #2c7be5;
    color: white;
}
.cal-day-today a.cal-daylink:hover {
    background: #e07c00;
}

.cal-event {
    background: #e3eaf2;
    color: #2c3e50;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.cal-event-maagd { background: #e8f4ea; color: #2d7a3e; }
.cal-event-ram { background: #fce8e6; color: #b03a2e; }
.cal-event-car { background: #eceff1; color: #455a64; border-left: 3px solid #78909c; }

.badge-car { background: #eceff1; color: #455a64; }

.cal-event-time { font-weight: 600; }

.cal-more {
    font-size: 0.65rem;
    color: #888;
    padding-left: 4px;
    font-style: italic;
}

.checkbox-label {
    flex-direction: row !important;
    align-items: center;
    gap: 0.4rem;
}

.checkbox-label input { width: auto !important; }

.form-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
    margin-top: 0.5rem;
}

.btn-cancel {
    padding: 0.6rem 1.2rem;
    background: #e3eaf2;
    color: #2c3e50;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
}

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

.hint {
    background: #fffbe6;
    border-left: 3px solid #f0c419;
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #6b5800;
    margin: 0.5rem 0;
    width: 100%;
}

a.btn-icon {
    text-decoration: none;
    color: #2c7be5;
    font-size: 1rem;
    padding: 0.2rem 0.5rem;
    line-height: 1;
}

a.btn-icon:hover { color: #1f63c2; background: #eef3fa; border-radius: 4px; }

/* ---------- Parking link (opens Google Maps in new tab) ---------- */
.btn-parking {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.15rem 0.55rem;
    font-size: 0.78rem;
    background: #e3eaf2;
    color: #2c3e50;
    border: 1px solid #c8d4e0;
    border-radius: 4px;
    text-decoration: none;
}
.btn-parking:hover { background: #d0dbe7; }

/* ---------- Cycle ---------- */
.cycle-status {
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin: 0.3rem 0;
}

.cycle-upcoming {
    background: #eef3fa;
    border-left: 3px solid #2c7be5;
    color: #2c3e50;
}

.cycle-due {
    background: #fdebef;
    border-left: 3px solid #d63384;
    color: #8a1e4a;
}

.cycle-overdue {
    background: #fff3e0;
    border-left: 3px solid #ff9800;
    color: #6b4500;
}

/* ---------- Waste ---------- */
.waste-pill {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    margin-left: 0.2rem;
}
.waste-paper    { background: #dbeafe; color: #1e40af; }
.waste-residual { background: #e5e7eb; color: #1f2937; }
.waste-organic  { background: #d1fae5; color: #065f46; }
.waste-pmd      { background: #ede9fe; color: #5b21b6; }
.waste-default  { background: #f1f5f9; color: #475569; }

.badge-due {
    background: #ff9800;
    color: white;
    padding: 0.05rem 0.4rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* Waste entries in the month calendar */
.cal-event-waste { font-weight: 600; }
.cal-waste-paper    { background: #dbeafe; color: #1e40af; }
.cal-waste-residual { background: #e5e7eb; color: #1f2937; }
.cal-waste-organic  { background: #d1fae5; color: #065f46; }
.cal-waste-pmd      { background: #ede9fe; color: #5b21b6; }
.cal-waste-default  { background: #f1f5f9; color: #475569; }

/* Recurring event occurrences */
.cal-event-recurring {
    background: #fef3c7;
    color: #92400e;
    font-style: italic;
}
.badge-recurring {
    background: #fef3c7;
    color: #92400e;
}

/* Past events: collapsible section, dimmed look */
details summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
}
details summary::-webkit-details-marker { display: none; }
details summary::before {
    content: "▸ ";
    display: inline-block;
    transition: transform 0.15s;
    margin-right: 0.2rem;
}
details[open] summary::before { content: "▾ "; }

.inline-h2 {
    display: inline;
    font-size: 1.05rem;
    margin: 0;
}

.past-event {
    color: #888;
    flex: 1;
    min-width: 0;
}

@media (max-width: 600px) {
    .cal-day { min-height: 60px; padding: 0.15rem; font-size: 0.7rem; }
    .cal-event { font-size: 0.6rem; padding: 1px 2px; }
    .cal-weekday { font-size: 0.65rem; padding: 0.3rem 0.1rem; }
    .cal-daynum { font-size: 0.7rem; }
}

.inline { display: inline; margin: 0; padding: 0; }
.ml-auto { margin-left: auto; }

/* ---------- Buttons ---------- */
.check {
    width: 28px;
    height: 28px;
    border: 2px solid #c0c8d0;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    color: #888;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.check:hover { border-color: #2c7be5; color: #2c7be5; }

.check.checked {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.check.due {
    background: #ff9800;
    color: white;
    border-color: #ff9800;
    font-weight: bold;
}

.btn-icon {
    background: transparent;
    border: none;
    color: #c0c8d0;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 0.4rem;
    line-height: 1;
}

.btn-icon:hover { color: #e74c3c; }

/* ---------- Badges & meta info ---------- */
.badge {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.3rem;
    vertical-align: middle;
}

.badge-maagd { background: #e8f4ea; color: #2d7a3e; }
.badge-ram { background: #fce8e6; color: #b03a2e; }

small.date, small.cat, small.purpose {
    display: inline-block;
    margin-left: 0.4rem;
    font-size: 0.8rem;
    color: #777;
}

small.cat { font-style: italic; }

.empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 1rem 0;
    margin: 0;
}

.link-more {
    display: inline-block;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #2c7be5;
    text-decoration: none;
}

.link-more:hover { text-decoration: underline; }

/* ---------- Flash messages ---------- */
.flash-container {
    max-width: 900px;
    margin: 0.75rem auto 0;
    padding: 0 1rem;
}

.flash {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.flash-error {
    background: #fce8e6;
    color: #b03a2e;
    border-left: 4px solid #e74c3c;
}

.flash-ok {
    background: #e8f4ea;
    color: #2d7a3e;
    border-left: 4px solid #28a745;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 500px) {
    h1 { font-size: 1.35rem; }
    h2 { font-size: 1.05rem; }
    .form-row { flex-direction: column; align-items: stretch; }
    .form-row input, .form-row select, .form-row button { width: 100%; }
    .nav-links a { padding: 0.4rem 0.6rem; font-size: 0.9rem; }
}
