/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
    --color-huishoudelijk: #4A90D9;
    --color-baby: #E88DB5;
    --color-afspraken: #F5A623;
    --color-avondeten: #43A047;
    --color-katten: #374151;
    --color-handelingen: #7C3AED;
    --bg-huishoudelijk: #EBF3FB;
    --bg-baby: #FDF0F5;
    --bg-afspraken: #FEF5E7;
    --bg-avondeten: #E8F5E9;
    --bg-katten: #F3F4F6;
    --bg-handelingen: #F3E8FF;
    --color-primary: #4A90D9;
    --color-bg: #F0F2F5;
    --color-surface: #FFFFFF;
    --color-text: #1A1A2E;
    --color-text-secondary: #6B7280;
    --color-done: #9CA3AF;
    --color-border: #E5E7EB;
    --radius: 10px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ===== RESET ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
}

/* ===== LOGIN ===== */
.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.login-card {
    background: var(--color-surface);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    width: 100%;
    max-width: 380px;
    margin: 16px;
}

.login-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--color-text);
}

.login-card p {
    color: var(--color-text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
}

.login-card input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 16px;
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.login-card input:focus {
    border-color: var(--color-primary);
}

.login-card button {
    width: 100%;
    padding: 12px;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.login-card button:hover {
    opacity: 0.9;
}

.error-msg {
    color: #EF4444;
    font-size: 14px;
    margin-top: 12px;
    min-height: 20px;
}

/* ===== TOP BAR ===== */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-surface);
    box-shadow: var(--shadow);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.top-bar h1 {
    font-size: 20px;
    white-space: nowrap;
}

.app-selector {
    font-size: 20px;
    font-weight: 700;
    border: none;
    background: none;
    color: var(--color-text);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 4px center;
    padding-right: 24px;
}

.app-selector:hover {
    background-color: var(--color-bg);
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-nav {
    padding: 8px 14px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text);
    transition: background 0.15s;
}

.btn-nav:hover {
    background: var(--color-bg);
}

.current-label {
    font-weight: 600;
    font-size: 16px;
    min-width: 140px;
    text-align: center;
}

/* ===== VIEW TABS ===== */
.view-tabs {
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 12px 20px 0;
}

.tab {
    padding: 8px 24px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.tab:hover:not(.active) {
    color: var(--color-text);
}

/* ===== LEGEND ===== */
.legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 12px 20px;
    font-size: 13px;
    color: var(--color-text-secondary);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot-huishoudelijk { background: var(--color-huishoudelijk); }
.dot-baby          { background: var(--color-baby); }
.dot-afspraken     { background: var(--color-afspraken); }
.dot-avondeten     { background: var(--color-avondeten); }
.dot-katten        { background: var(--color-katten); }
.dot-handelingen   { background: var(--color-handelingen); }

/* ===== VIEW CONTAINER ===== */
.view-container {
    padding: 0 20px 100px;
    max-width: 1100px;
    margin: 0 auto;
}

/* ===== MONTH VIEW ===== */
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.month-header {
    background: var(--color-primary);
    color: white;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
}

.month-cell {
    background: var(--color-surface);
    min-height: 90px;
    padding: 8px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
}

.month-cell:hover {
    background: #F9FAFB;
}

.month-cell.other-month {
    opacity: 0.35;
}

.month-cell.today {
    background: #EFF6FF;
    border-left: 3px solid var(--color-primary);
}

.day-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.day-dots {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.day-dots .dot {
    width: 8px;
    height: 8px;
}

.day-count {
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 11px;
    color: var(--color-text-secondary);
    background: var(--color-bg);
    padding: 1px 6px;
    border-radius: 10px;
}

.day-items-preview {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.day-item-mini {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--color-text);
}

.day-item-mini.cat-huishoudelijk { background: var(--bg-huishoudelijk); }
.day-item-mini.cat-baby          { background: var(--bg-baby); }
.day-item-mini.cat-afspraken     { background: var(--bg-afspraken); }
.day-item-mini.cat-avondeten     { background: var(--bg-avondeten); }
.day-item-mini.cat-katten        { background: var(--bg-katten); }
.day-item-mini.cat-handelingen   { background: var(--bg-handelingen); }
.day-item-mini.done              { text-decoration: line-through; opacity: 0.5; }

/* ===== WEEK VIEW ===== */
.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
}

.week-column {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    min-height: 200px;
}

.week-column.today {
    box-shadow: 0 0 0 2px var(--color-primary), var(--shadow);
}

.week-day-header {
    padding: 10px 12px;
    background: var(--color-bg);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.week-day-header:hover {
    background: #E5E7EB;
}

.week-day-name {
    font-weight: 600;
    font-size: 13px;
    text-transform: capitalize;
}

.week-day-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-secondary);
}

.week-items {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ===== DAY VIEW ===== */
.day-view {
    max-width: 700px;
    margin: 0 auto;
}

.day-header {
    padding: 16px 0;
}

.day-header h2 {
    font-size: 22px;
    font-weight: 600;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
}

.empty-state p:first-child {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-hint {
    font-size: 14px;
    opacity: 0.7;
}

/* ===== ITEM CARD ===== */
.item-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 8px;
    border-left: 4px solid transparent;
    transition: opacity 0.2s, transform 0.15s;
}

.item-card.category-huishoudelijk { border-left-color: var(--color-huishoudelijk); }
.item-card.category-baby          { border-left-color: var(--color-baby); }
.item-card.category-afspraken     { border-left-color: var(--color-afspraken); }
.item-card.category-avondeten     { border-left-color: var(--color-avondeten); }
.item-card.category-katten        { border-left-color: var(--color-katten); }
.item-card.category-handelingen   { border-left-color: var(--color-handelingen); }

.item-card.done {
    opacity: 0.5;
}

.item-card.done .item-title {
    text-decoration: line-through;
    color: var(--color-done);
}

.item-card.compact {
    padding: 8px 10px;
    gap: 8px;
    margin-bottom: 0;
    box-shadow: none;
    border-radius: 6px;
    background: var(--color-bg);
}

/* Checkbox */
.item-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
    padding: 0;
    margin: 0;
}

.item-checkbox::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 7px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.15s;
}

.item-checkbox:checked {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.item-checkbox:checked::after {
    opacity: 1;
}

.category-huishoudelijk .item-checkbox:checked {
    background: var(--color-huishoudelijk);
    border-color: var(--color-huishoudelijk);
}

.category-baby .item-checkbox:checked {
    background: var(--color-baby);
    border-color: var(--color-baby);
}

.category-afspraken .item-checkbox:checked {
    background: var(--color-afspraken);
    border-color: var(--color-afspraken);
}

.category-avondeten .item-checkbox:checked {
    background: var(--color-avondeten);
    border-color: var(--color-avondeten);
}

.category-katten .item-checkbox:checked {
    background: var(--color-katten);
    border-color: var(--color-katten);
}

.category-handelingen .item-checkbox:checked {
    background: var(--color-handelingen);
    border-color: var(--color-handelingen);
}

.item-title {
    flex: 1;
    font-size: 15px;
    word-break: break-word;
}

.compact .item-title {
    font-size: 13px;
}

.item-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
    white-space: nowrap;
}

.badge-huishoudelijk { background: var(--bg-huishoudelijk); color: var(--color-huishoudelijk); }
.badge-baby          { background: var(--bg-baby); color: var(--color-baby); }
.badge-afspraken     { background: var(--bg-afspraken); color: var(--color-afspraken); }
.badge-avondeten     { background: var(--bg-avondeten); color: var(--color-avondeten); }
.badge-katten        { background: var(--bg-katten); color: var(--color-katten); }
.badge-handelingen   { background: var(--bg-handelingen); color: var(--color-handelingen); }

.recurrence-icon {
    font-size: 13px;
    color: var(--color-text-secondary);
    title: attr(data-title);
}

.btn-edit {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.btn-edit:hover {
    background: #EBF3FB;
    color: var(--color-primary);
}

.btn-delete {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.btn-delete:hover {
    background: #FEE2E2;
    color: #EF4444;
}

/* ===== FAB ===== */
.fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    font-size: 28px;
    border: none;
    box-shadow: 0 4px 12px rgba(74, 144, 217, 0.4);
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s;
    line-height: 1;
}

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

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.modal-card {
    background: var(--color-surface);
    padding: 32px;
    border-radius: var(--radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    margin: 16px;
}

.modal-card h2 {
    font-size: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--color-text-secondary);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: var(--color-surface);
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--color-primary);
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions-stack {
    flex-direction: column;
}

.btn-primary, .btn-secondary, .btn-danger {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

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

.btn-secondary {
    background: var(--color-bg);
    color: var(--color-text);
}

.btn-danger {
    background: #EF4444;
    color: white;
}

.btn-primary:hover, .btn-secondary:hover, .btn-danger:hover {
    opacity: 0.85;
}

/* ===== BOODSCHAPPEN ===== */
.boodschappen-bar {
    max-width: 700px;
    margin: 0 auto;
    padding: 16px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.boodschappen-input-row {
    display: flex;
    gap: 10px;
}

.boodschappen-input-row input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.boodschappen-input-row input:focus {
    border-color: var(--color-primary);
}

.boodschappen-input-row .btn-primary {
    flex: none;
    padding: 12px 24px;
}

.btn-clear-done {
    align-self: flex-end;
    background: none;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.btn-clear-done:hover {
    background: #FEE2E2;
    color: #EF4444;
    border-color: #FECACA;
}

.boodschappen-list {
    max-width: 700px;
    margin: 0 auto;
    padding: 12px 20px 100px;
}

.boodschap-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 8px;
    transition: opacity 0.2s;
}

.boodschap-item.done {
    opacity: 0.5;
}

.boodschap-item.done .boodschap-title {
    text-decoration: line-through;
    color: var(--color-done);
}

.boodschap-title {
    flex: 1;
    font-size: 16px;
    word-break: break-word;
}

.boodschappen-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-secondary);
}

/* ===== AFSCHRIFTEN ===== */
.afschriften-bar {
    max-width: 700px;
    margin: 0 auto;
    padding: 16px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.afschriften-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--color-surface);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--color-primary);
}

.afschriften-total-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.afschriften-total-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
}

.afschriften-bar .boodschappen-input-row input[type="number"] {
    width: 120px;
    flex: none;
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.afschriften-bar .boodschappen-input-row input[type="number"]:focus {
    border-color: var(--color-primary);
}

.afschriften-reset-info {
    font-size: 12px;
    color: var(--color-text-secondary);
    text-align: center;
    font-style: italic;
}

.afschrift-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 8px;
    transition: opacity 0.2s;
}

.afschrift-item.done {
    opacity: 0.5;
}

.afschrift-item.done .afschrift-title {
    text-decoration: line-through;
    color: var(--color-done);
}

.afschrift-item.done .afschrift-amount {
    text-decoration: line-through;
    color: var(--color-done);
}

.afschrift-title {
    flex: 1;
    font-size: 16px;
    word-break: break-word;
}

.afschrift-amount {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .top-bar {
        flex-direction: column;
        gap: 8px;
        padding: 10px 16px;
    }

    .top-bar h1 {
        font-size: 18px;
    }

    .current-label {
        min-width: auto;
        font-size: 15px;
    }

    .view-container {
        padding: 0 12px 100px;
    }

    .month-cell {
        min-height: 60px;
        padding: 4px;
    }

    .day-number {
        font-size: 12px;
    }

    .day-items-preview {
        display: none;
    }

    .week-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .week-column {
        min-height: auto;
    }

    .week-items {
        padding: 6px;
    }

    .legend {
        gap: 10px;
        font-size: 12px;
    }

    .item-card {
        padding: 10px 12px;
        gap: 10px;
    }

    .item-badge {
        display: none;
    }

    .app-selector {
        font-size: 18px;
    }

    .boodschappen-bar {
        padding: 12px 12px 0;
    }

    .boodschappen-list {
        padding: 12px 12px 100px;
    }

    .afschriften-bar {
        padding: 12px 12px 0;
    }

    .afschriften-bar .boodschappen-input-row input[type="number"] {
        width: 100px;
    }
}

@media (max-width: 480px) {
    .month-header {
        padding: 6px;
        font-size: 11px;
    }

    .month-cell {
        min-height: 48px;
    }

    .day-dots .dot {
        width: 6px;
        height: 6px;
    }
}
