/* ============================================================
   CSS Custom Properties — inspired by the provided UI designs
   ============================================================ */
:root {
    /* Primary purple accent */
    --color-primary:       #6c3ef4;
    --color-primary-dark:  #5025d4;
    --color-primary-light: #ede9fe;
    --color-primary-muted: #f3f0ff;

    /* Status / semantic */
    --color-success:       #16a34a;
    --color-success-light: #dcfce7;
    --color-danger:        #dc2626;
    --color-danger-light:  #fee2e2;
    --color-warning:       #d97706;
    --color-warning-light: #fef3c7;
    --color-info:          #0284c7;
    --color-info-light:    #e0f2fe;

    /* Stat card pastels (matching the design's 4 colored blocks) */
    --stat-green-bg:   #e8f9ef;
    --stat-green-text: #15803d;
    --stat-green-bar:  #22c55e;
    --stat-teal-bg:    #e0f2f1;
    --stat-teal-text:  #0f766e;
    --stat-teal-bar:   #14b8a6;
    --stat-navy-bg:    #1e3a5f;
    --stat-navy-text:  #ffffff;
    --stat-navy-bar:   #3b82f6;
    --stat-sand-bg:    #fdf3e3;
    --stat-sand-text:  #92400e;
    --stat-sand-bar:   #f59e0b;

    /* Surfaces */
    --color-bg:         #f6f6fb;
    --color-surface:    #ffffff;
    --color-border:     #e8e8f0;
    --color-border-soft:#f0f0f6;

    /* Text */
    --color-text:      #1a1a2e;
    --color-text-muted:#8a8aaa;
    --color-text-sub:  #5a5a7a;

    /* Sidebar — light style as per inspiration */
    --sidebar-bg:          #ffffff;
    --sidebar-border:      #eeeef6;
    --sidebar-text:        #5a5a7a;
    --sidebar-active-bg:   #f3f0ff;
    --sidebar-active-text: #6c3ef4;
    --sidebar-width:       240px;

    --radius:    10px;
    --radius-sm:  6px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 3px rgba(30,20,60,.06);
    --shadow:    0 4px 16px rgba(30,20,60,.08);
    --shadow-lg: 0 8px 32px rgba(30,20,60,.12);

    --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --transition: 150ms ease;
}

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

body {
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }

/* ============================================================
   Layout
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.layout {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 2rem 2.25rem;
    max-width: 1200px;
    width: 100%;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar__logo {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 1.25rem 1.25rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text);
    border-bottom: 1px solid var(--sidebar-border);
}

.sidebar__logo-icon {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #6c3ef4, #a78bfa);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}

.sidebar__nav { flex: 1; padding: .75rem; }
.sidebar__item { margin-bottom: 2px; }

.sidebar__link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .85rem;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: .875rem;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}

.sidebar__link:hover {
    background: var(--color-border-soft);
    color: var(--color-text);
    text-decoration: none;
}

.sidebar__item--active .sidebar__link {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.sidebar__icon { font-size: .9rem; width: 1.1rem; text-align: center; flex-shrink: 0; }

.sidebar__footer {
    padding: .75rem .75rem 1.25rem;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar__link--logout { color: var(--color-danger); }
.sidebar__link--logout:hover { background: var(--color-danger-light); color: var(--color-danger); }

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -.01em;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem 1rem;
    font-size: .845rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition), opacity var(--transition);
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
    letter-spacing: .01em;
}

.btn:hover { text-decoration: none; }
.btn:active { opacity: .85; }

.btn--primary {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(108,62,244,.25);
}
.btn--primary:hover { background: var(--color-primary-dark); }

.btn--success { background: var(--color-success); color: #fff; }
.btn--danger  { background: var(--color-danger);  color: #fff; }

.btn--secondary {
    background: var(--color-surface);
    color: var(--color-text-sub);
    border-color: var(--color-border);
}
.btn--secondary:hover { background: var(--color-bg); border-color: #d0d0e0; }

.btn--ghost { background: transparent; color: var(--color-primary); }
.btn--ghost:hover { background: var(--color-primary-muted); }

.btn--sm   { padding: .3rem .65rem; font-size: .775rem; }
.btn--full { width: 100%; justify-content: center; }

/* ============================================================
   Forms
   ============================================================ */
.form-group { margin-bottom: 1.1rem; }

.form-label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    margin-bottom: .35rem;
    color: var(--color-text-sub);
    letter-spacing: .01em;
}

.form-control {
    width: 100%;
    padding: .55rem .8rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(108,62,244,.12);
}

textarea.form-control { resize: vertical; min-height: 120px; }

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

.form-actions {
    display: flex;
    gap: .75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--color-border-soft);
}

.form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    max-width: 680px;
}

/* ============================================================
   Alerts
   ============================================================ */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: .875rem;
    font-weight: 500;
}

.alert--success { background: var(--color-success-light); color: #15803d; border: 1px solid #bbf7d0; }
.alert--error   { background: var(--color-danger-light);  color: #b91c1c; border: 1px solid #fca5a5; }
.alert--warning { background: var(--color-warning-light); color: #92400e; border: 1px solid #fde68a; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: .18rem .55rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .03em;
    white-space: nowrap;
}

.badge--low    { background: #dcfce7; color: #15803d; }
.badge--medium { background: #fef9c3; color: #a16207; }
.badge--high   { background: #fee2e2; color: #b91c1c; }
.badge--open   { background: #dbeafe; color: #1d4ed8; }
.badge--done   { background: #dcfce7; color: #15803d; }
.badge--tag    { background: var(--color-primary-light); color: var(--color-primary-dark); }
.badge--source { background: #f1f5f9; color: var(--color-text-muted); }

/* ============================================================
   Home — Stat Cards (4 colored blocks like the design)
   ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: .3rem;
}

/* default white card */
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }

.stat-card--green { background: var(--stat-green-bg); border: none; }
.stat-card--teal  { background: var(--stat-teal-bg);  border: none; }
.stat-card--navy  { background: var(--stat-navy-bg);  border: none; }
.stat-card--sand  { background: var(--stat-sand-bg);  border: none; }

.stat-card__label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

.stat-card--green .stat-card__label { color: var(--stat-green-text); }
.stat-card--teal  .stat-card__label { color: var(--stat-teal-text);  }
.stat-card--navy  .stat-card__label { color: rgba(255,255,255,.65);  }
.stat-card--sand  .stat-card__label { color: var(--stat-sand-text);  }

.stat-card__value {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -.03em;
}

.stat-card--green .stat-card__value { color: var(--stat-green-text); }
.stat-card--teal  .stat-card__value { color: var(--stat-teal-text);  }
.stat-card--navy  .stat-card__value { color: #ffffff; }
.stat-card--sand  .stat-card__value { color: var(--stat-sand-text);  }

.stat-card__bar {
    height: 4px;
    border-radius: 999px;
    margin-top: .7rem;
    width: 60%;
}

.stat-card--green .stat-card__bar { background: var(--stat-green-bar); }
.stat-card--teal  .stat-card__bar { background: var(--stat-teal-bar);  }
.stat-card--navy  .stat-card__bar { background: var(--stat-navy-bar);  }
.stat-card--sand  .stat-card__bar { background: var(--stat-sand-bar);  }

.stat-card__sub { font-size: .78rem; margin-top: .2rem; }
.stat-card--navy .stat-card__sub a { color: rgba(255,255,255,.6); }

/* ============================================================
   Todo
   ============================================================ */
.todo-list { display: flex; flex-direction: column; gap: .45rem; }

.todo-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: .8rem 1rem;
    display: flex;
    align-items: center;
    gap: .75rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.todo-item:hover { box-shadow: var(--shadow); }
.todo-item--done { opacity: .55; }
.todo-item--done .todo-item__title { text-decoration: line-through; }

.todo-item--high   { border-left: 3px solid #ef4444; }
.todo-item--medium { border-left: 3px solid #f59e0b; }
.todo-item--low    { border-left: 3px solid #22c55e; }

.todo-item__toggle {
    background: none;
    border: 2px solid var(--color-border);
    border-radius: 50%;
    width: 1.35rem; height: 1.35rem;
    cursor: pointer; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--transition), border-color var(--transition);
    font-size: .7rem; color: #fff;
}

.todo-item--done .todo-item__toggle {
    background: var(--color-success);
    border-color: var(--color-success);
}

.todo-item__title { flex: 1; font-size: .9rem; font-weight: 500; }
.todo-item__meta  { display: flex; gap: .4rem; align-items: center; flex-shrink: 0; flex-wrap: wrap; }
.todo-item__date  { font-size: .78rem; color: var(--color-text-muted); }
.todo-item__date--overdue { color: var(--color-danger); font-weight: 600; }

/* ============================================================
   Notes
   ============================================================ */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.note-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: .5rem;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.note-card:hover { box-shadow: var(--shadow); border-color: #d8d8ea; }

.note-card__title { font-size: .95rem; font-weight: 600; color: var(--color-text); }
.note-card__title:hover { color: var(--color-primary); text-decoration: none; }

.note-card__preview {
    font-size: .84rem;
    color: var(--color-text-muted);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-card__tags   { display: flex; flex-wrap: wrap; gap: .3rem; }
.note-card__footer { display: flex; justify-content: space-between; align-items: center; margin-top: .25rem; }
.note-card__date   { font-size: .74rem; color: var(--color-text-muted); }
.note-card__actions { display: flex; gap: .35rem; }

.note-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    max-width: 780px;
    line-height: 1.8;
    font-size: .93rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================================
   Filter bar
   ============================================================ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.filter-bar .form-control { width: auto; }

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3.5rem 1rem;
    color: var(--color-text-muted);
}

.empty-state__icon { font-size: 2.25rem; margin-bottom: .75rem; }
.empty-state__text { font-size: .95rem; }

/* ============================================================
   Planner / Week grid
   ============================================================ */
.week-nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.week-nav__title { font-size: .95rem; font-weight: 600; flex: 1; text-align: center; }

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: .5rem;
}

.week-day {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    min-height: 160px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
}

.week-day--today {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary-light);
}

.week-day__header {
    padding: .5rem .65rem;
    border-bottom: 1px solid var(--color-border-soft);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.week-day__name { font-size: .68rem; text-transform: uppercase; font-weight: 700; color: var(--color-text-muted); letter-spacing: .05em; }
.week-day__date { font-size: .88rem; font-weight: 700; }

.week-day--today .week-day__date {
    background: var(--color-primary);
    color: #fff;
    border-radius: 50%;
    width: 1.5rem; height: 1.5rem;
    display: flex; align-items: center; justify-content: center;
    font-size: .78rem;
}

.week-day__events { padding: .35rem; flex: 1; display: flex; flex-direction: column; gap: .25rem; }

.week-event {
    border-radius: var(--radius-sm);
    padding: .2rem .45rem;
    font-size: .72rem;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-decoration: none;
    display: block;
    transition: opacity var(--transition);
}

.week-event:hover { opacity: .85; text-decoration: none; color: #fff; }

.week-day__add { padding: .3rem .4rem; text-align: center; }
.week-day__add a { font-size: .72rem; color: var(--color-text-muted); text-decoration: none; }
.week-day__add a:hover { color: var(--color-primary); }

/* ============================================================
   Login page
   ============================================================ */
.body--login {
    background: var(--color-bg);
    margin-left: 0;
}

.login-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 2rem;
}

.login-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-card__header {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .65rem;
}

.login-card__logo {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, #6c3ef4, #a78bfa);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    color: #fff;
}

.login-card__title { font-size: 1.35rem; font-weight: 700; }

/* ============================================================
   Tag input pills preview
   ============================================================ */
.tag-input-preview { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }

/* ============================================================
   Error pages
   ============================================================ */
.error-page { text-align: center; padding: 5rem 2rem; }
.error-page__code  { font-size: 6rem; font-weight: 900; color: var(--color-border); line-height: 1; }
.error-page__title { font-size: 1.5rem; font-weight: 700; margin: .5rem 0 1rem; }
.error-page__text  { color: var(--color-text-muted); margin-bottom: 1.5rem; }

/* ============================================================
   Utilities
   ============================================================ */
.text-muted   { color: var(--color-text-muted); }
.text-small   { font-size: .8rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.d-flex       { display: flex; }
.gap-1        { gap: .5rem; }
.align-center { align-items: center; }

/* ============================================================
   Weekstatus
   ============================================================ */
.ws-nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

.ws-nav__title {
    flex: 1;
    text-align: center;
    font-size: .95rem;
    font-weight: 600;
}

.ws-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

/* 6-column grid: period label + 5 days */
.ws-grid {
    display: grid;
    grid-template-columns: 140px repeat(5, 1fr);
    gap: .5rem;
    margin-bottom: 1.25rem;
}

.ws-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.ws-cell--corner { /* top-left empty */ }

.ws-cell--header {
    text-align: center;
    padding: .35rem .5rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-soft);
}

.ws-day-short {
    display: block;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-sub);
}

.ws-cell--period {
    font-size: .82rem;
    font-weight: 600;
    color: var(--color-text-sub);
    padding: .35rem .5rem;
}

.ws-cell--input { }

/* The select element in each cell */
.ws-select {
    width: 100%;
    padding: .45rem .6rem;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: .84rem;
    font-family: inherit;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a8aaa'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .55rem center;
    padding-right: 1.6rem;
}

.ws-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(108,62,244,.1);
}

/* Location colour-coding on the select after a value is chosen (set by JS) */
.ws-select.loc--thuis      { border-color: #22c55e; background-color: #f0fdf4; }
.ws-select.loc--werkplaats { border-color: #f59e0b; background-color: #fffbeb; }
.ws-select.loc--kantoor    { border-color: #6c3ef4; background-color: #f5f3ff; }

.ws-actions {
    display: flex;
    gap: .75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border-soft);
}

/* Recent weeks sidebar */
.ws-recent {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    max-width: 320px;
}

.ws-recent__title {
    font-size: .82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--color-text-muted);
    margin-bottom: .65rem;
}

.ws-recent__list { display: flex; flex-direction: column; gap: .2rem; }

.ws-recent__link {
    display: block;
    padding: .35rem .6rem;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    color: var(--color-text-sub);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
}

.ws-recent__link:hover { background: var(--color-bg); color: var(--color-text); text-decoration: none; }
.ws-recent__link--active { background: var(--color-primary-light); color: var(--color-primary); font-weight: 600; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 960px) {
    :root { --sidebar-width: 0px; }
    .sidebar  { display: none; }
    .layout   { margin-left: 0; }
    .week-grid { grid-template-columns: repeat(3, 1fr); }
    .form-row  { grid-template-columns: 1fr; }
}
