* {
    box-sizing: border-box;
}

:root {
    --background: #f4f6f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --border: #e5e7eb;
}

body {
    margin: 0;
    min-height: 100vh;

    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;

    background: var(--background);
    color: var(--text);

    padding-bottom: 90px;
}


/* ==========================================================
   HEADER
========================================================== */

.header {
    background: white;
    border-bottom: 1px solid var(--border);

    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1200px;
    margin: auto;
    padding: 16px 20px;

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 38px;
    height: 38px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 11px;

    background: var(--primary);
    color: white;

    font-size: 25px;
    font-weight: 600;
}

.brand-name {
    font-size: 20px;
    font-weight: 700;
}

.user {
    color: var(--muted);
    font-size: 14px;
}


/* ==========================================================
   CONTENT
========================================================== */

.container {
    width: 100%;
    max-width: 1200px;

    margin: auto;
    padding: 24px 16px;
}

.page-title {
    margin-bottom: 22px;
}

.page-title h1 {
    margin: 0 0 5px;
    font-size: 24px;
}

.page-title p {
    margin: 0;
    color: var(--muted);
}


/* ==========================================================
   COUNTER GRID
========================================================== */

.counter-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(260px, 1fr));

    gap: 18px;
}


/* ==========================================================
   COUNTER CARD
========================================================== */

.counter-card {
    background: var(--card);

    border-radius: 20px;

    padding: 22px;

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.06);

    border-top: 5px solid var(--counter-color);

    cursor: pointer;
    user-select: none;

    transition:
        transform 0.12s,
        box-shadow 0.12s,
        background 0.12s;

    -webkit-tap-highlight-color: transparent;

    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.counter-card:hover {
    transform: translateY(-2px);

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.09);
}

.counter-card:active {
    transform: scale(0.98);
}

.counter-card:focus-visible {
    outline: 3px solid var(--counter-color);
    outline-offset: 3px;
}

.counter-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.counter-icon {
    width: 48px;
    height: 48px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: #f3f4f6;

    border-radius: 14px;

    font-size: 27px;
}

.counter-info {
    min-width: 0;
}

.counter-name {
    margin: 0;

    font-size: 18px;
    font-weight: 700;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.counter-description {
    margin-top: 3px;

    color: var(--muted);
    font-size: 13px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ==========================================================
   COUNT
========================================================== */

.count-area {
    text-align: center;
    padding: 25px 0 18px;
}

.count-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;

    color: var(--muted);

    font-weight: 600;
}

.count-number {
    margin-top: 2px;

    font-size: 56px;
    line-height: 1;

    font-weight: 800;

    color: var(--counter-color);
}


/* ==========================================================
   TOTAL
========================================================== */

.counter-total {
    text-align: center;

    margin-top: 13px;

    font-size: 13px;
    color: var(--muted);
}


/* ==========================================================
   EMPTY STATE
========================================================== */

.empty {
    background: white;

    border-radius: 20px;

    padding: 50px 25px;

    text-align: center;

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.05);
}

.empty-icon {
    font-size: 45px;
}

.empty h2 {
    margin-bottom: 8px;
}

.empty p {
    color: var(--muted);
}

.empty a {
    display: inline-block;

    margin-top: 10px;

    padding: 12px 20px;

    border-radius: 10px;

    background: var(--primary);
    color: white;

    text-decoration: none;
    font-weight: 600;
}


/* ==========================================================
   BOTTOM NAVIGATION
========================================================== */

.bottom-nav {
    position: fixed;

    left: 0;
    right: 0;
    bottom: 0;

    height: 70px;

    background: white;

    border-top: 1px solid var(--border);

    display: flex;
    justify-content: center;

    z-index: 200;
}

.bottom-nav-inner {
    width: 100%;
    max-width: 500px;

    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.nav-item {
    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    gap: 3px;

    text-decoration: none;

    color: var(--muted);

    font-size: 11px;

    transition: 0.15s;
}

.nav-item:hover {
    color: var(--primary);
}

.nav-item.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-icon {
    font-size: 22px;
}


/* ==========================================================
   MOBILE
========================================================== */

@media (max-width: 600px) {

    .header-inner {
        padding: 12px 16px;
    }

    .user {
        display: none;
    }

    .container {
        padding: 18px 12px;
    }

    .page-title {
        margin-bottom: 16px;
    }

    .page-title h1 {
        font-size: 21px;
    }

    .counter-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .counter-card {
        padding: 18px;
    }

    .count-area {
        padding: 20px 0 16px;
    }

    .count-number {
        font-size: 52px;
    }

    .plus-button {
        padding: 18px;
    }
}

/* ==========================================================
   COUNTER ANIMATION
========================================================== */

.counter-pop {
    animation: counterPop 0.25s ease;
}

@keyframes counterPop {

    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.25);
    }

    100% {
        transform: scale(1);
    }
}


/* ==========================================================
   TOAST MESSAGE
========================================================== */

.toast-message {
    position: fixed;

    left: 50%;
    bottom: 85px;

    transform: translate(-50%, 20px);

    padding: 12px 18px;

    border-radius: 12px;

    color: white;

    font-size: 14px;
    font-weight: 600;

    opacity: 0;

    z-index: 1000;

    transition:
        opacity 0.25s,
        transform 0.25s;

    box-shadow:
        0 5px 20px rgba(0, 0, 0, 0.15);
}

.toast-message.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast-success {
    background: #16a34a;
}

.toast-error {
    background: #dc2626;
}

/* ==========================================================
   CONFIG
========================================================== */

.config-section {
    background: white;
    border-radius: 20px;

    padding: 24px;

    margin-bottom: 22px;

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 22px;
}

.section-header h2 {
    margin: 0 0 4px;

    font-size: 19px;
}

.section-header p {
    margin: 0;

    color: var(--muted);

    font-size: 13px;
}


/* ==========================================================
   FORMS
========================================================== */

.counter-form {
    display: flex;
    flex-direction: column;

    gap: 16px;
}

.form-row {
    display: flex;
    gap: 14px;

    align-items: flex-end;
}

.form-field {
    display: flex;
    flex-direction: column;

    gap: 6px;
}

.form-field-large {
    flex: 1;
}

.form-field label {
    font-size: 13px;
    font-weight: 600;

    color: #374151;
}

.form-field input[type="text"] {
    width: 100%;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    padding: 12px 13px;

    font-size: 15px;

    outline: none;

    transition:
        border-color 0.15s,
        box-shadow 0.15s;
}

.form-field input[type="text"]:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.10);
}

.icon-field {
    width: 90px;
}

.icon-field input {
    text-align: center;

    font-size: 22px !important;
}

.color-field {
    width: 70px;
}

.color-field input[type="color"] {
    width: 100%;
    height: 45px;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    padding: 4px;

    background: white;

    cursor: pointer;
}


/* ==========================================================
   BUTTONS
========================================================== */

.primary-button {
    align-self: flex-start;

    border: none;
    border-radius: 10px;

    background: var(--primary);
    color: white;

    padding: 12px 18px;

    font-size: 14px;
    font-weight: 600;

    cursor: pointer;
}

.primary-button:hover {
    opacity: 0.92;
}

.secondary-button {
    border: 1px solid #d1d5db;
    border-radius: 10px;

    background: white;

    padding: 11px 17px;

    font-size: 14px;

    cursor: pointer;
}


/* ==========================================================
   CONFIG COUNTERS
========================================================== */

.config-counter-list {
    display: flex;
    flex-direction: column;

    gap: 12px;
}

.config-counter-card {
    border: 1px solid var(--border);

    border-left:
        5px solid var(--counter-color);

    border-radius: 14px;

    padding: 15px;

    transition: opacity 0.2s;
}

.config-counter-card.inactive {
    opacity: 0.55;
}

.config-counter-main {
    display: flex;
    align-items: center;

    gap: 13px;
}

.config-counter-icon {
    width: 48px;
    height: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    border-radius: 13px;

    font-size: 25px;
}

.config-counter-info {
    flex: 1;
    min-width: 0;
}

.config-counter-name {
    font-size: 16px;
    font-weight: 700;
}

.config-counter-description {
    margin-top: 3px;

    color: var(--muted);

    font-size: 13px;
}

.config-counter-total {
    margin-top: 5px;

    color: var(--muted);

    font-size: 12px;
}

.inactive-badge {
    display: inline-block;

    margin-left: 6px;

    padding: 3px 7px;

    border-radius: 20px;

    background: #e5e7eb;
    color: #6b7280;

    font-size: 10px;
    font-weight: 600;

    vertical-align: middle;
}


/* ==========================================================
   CONFIG ACTIONS
========================================================== */

.config-actions {
    display: flex;
    flex-wrap: wrap;

    gap: 7px;

    margin-top: 14px;
}

.config-actions form {
    margin: 0;
}

.action-button {
    border: 1px solid #d1d5db;
    border-radius: 8px;

    background: white;
    color: #374151;

    padding: 8px 10px;

    font-size: 12px;

    cursor: pointer;
}

.action-button:hover {
    background: #f9fafb;
}

.delete-button {
    color: #dc2626;
}

.edit-button {
    color: var(--primary);
}


/* ==========================================================
   EDIT FORM
========================================================== */

.edit-counter-form {
    display: none;

    margin-top: 16px;
    padding-top: 16px;

    border-top: 1px solid var(--border);
}

.edit-counter-form.show {
    display: block;
}

.edit-counter-form .form-field {
    margin-bottom: 13px;
}

.edit-actions {
    display: flex;

    gap: 8px;

    margin-top: 5px;
}


/* ==========================================================
   ALERTS
========================================================== */

.alert {
    margin-bottom: 18px;

    padding: 12px 15px;

    border-radius: 10px;

    font-size: 14px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.empty-small {
    padding: 25px;

    text-align: center;

    color: var(--muted);
}


/* ==========================================================
   CONFIG MOBILE
========================================================== */

@media (max-width: 600px) {

    .config-section {
        padding: 18px 15px;

        border-radius: 16px;
    }

    .form-row {
        align-items: stretch;
        flex-wrap: wrap;
    }

    .form-field-large {
        flex-basis: 100%;
    }

    .icon-field {
        flex: 1;
    }

    .color-field {
        width: 90px;
    }

    .primary-button {
        width: 100%;
    }

    .edit-actions .primary-button {
        width: auto;
    }

    .config-actions {
        display: grid;

        grid-template-columns:
            repeat(2, 1fr);
    }

    .config-actions form {
        width: 100%;
    }

    .action-button {
        width: 100%;

        min-height: 40px;
    }
}

/* +1: kaartje kort lichtgroen */

.card-clicked {
    animation: cardClicked 0.65s ease;
}

@keyframes cardClicked {

    0% {
        background-color: #ffffff;
        transform: scale(1);
    }

    20% {
        background-color: #dcfce7;
        transform: scale(0.985);
    }

    65% {
        background-color: #dcfce7;
        transform: scale(1);
    }

    100% {
        background-color: #ffffff;
        transform: scale(1);
    }
}

/* ==========================================================
   -1 FEEDBACK
========================================================== */

.counter-card {
    position: relative;
    overflow: hidden;
}


/* Rode feedback bij -1 */

/* -1: kaartje kort lichtroze */

.card-decrement {
    animation: cardDecrement 0.65s ease;
}

@keyframes cardDecrement {

    0% {
        background-color: #ffffff;
        transform: scale(1);
    }

    20% {
        background-color: #ffe4e6;
        transform: scale(0.985);
    }

    65% {
        background-color: #ffe4e6;
        transform: scale(1);
    }

    100% {
        background-color: #ffffff;
        transform: scale(1);
    }
}


/* Zwevende -1 */

.minus-indicator {
    position: absolute;

    top: 50%;
    left: 50%;

    transform: translate(-50%, -50%);

    font-size: 42px;
    font-weight: 800;

    color: #dc2626;

    pointer-events: none;

    animation: minusFloat 0.6s ease forwards;
}

@keyframes minusFloat {

    0% {
        opacity: 0;
        transform:
            translate(-50%, -30%)
            scale(0.7);
    }

    30% {
        opacity: 1;
        transform:
            translate(-50%, -50%)
            scale(1.15);
    }

    100% {
        opacity: 0;
        transform:
            translate(-50%, -90%)
            scale(1);
    }
}

/* ==========================================================
   STATS
========================================================== */


/* FILTER */

.stats-filter {
    margin-bottom: 20px;
}

.stats-filter form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 350px;
}

.stats-filter label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}

.stats-filter select {
    width: 100%;
    padding: 11px 38px 11px 13px;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    background: white;

    font-size: 14px;
    color: var(--text);

    cursor: pointer;
    outline: none;
}

.stats-filter select:focus {
    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(37, 99, 235, 0.10);
}



/* ==========================================================
   SUMMARY
========================================================== */

.stats-summary {

    display: grid;

    grid-template-columns:
        repeat(4, 1fr);

    gap: 14px;

    margin-bottom: 22px;
}


.stat-card {

    background: white;

    border-radius: 16px;

    padding: 18px;

    text-align: center;

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.05);
}


.stat-icon {
    font-size: 20px;
    margin-bottom: 5px;
}


.stat-value {

    font-size: 30px;

    font-weight: 800;

    color: var(--text);
}


.stat-label {

    margin-top: 3px;

    font-size: 12px;

    color: var(--muted);
}



/* ==========================================================
   SECTIONS
========================================================== */

.stats-section {

    background: white;

    border-radius: 20px;

    padding: 22px;

    margin-bottom: 22px;

    box-shadow:
        0 4px 18px rgba(0, 0, 0, 0.05);
}


.stats-section-header {
    margin-bottom: 20px;
}


.stats-section-header h2 {

    margin: 0 0 4px;

    font-size: 18px;
}


.stats-section-header p {

    margin: 0;

    font-size: 13px;

    color: var(--muted);
}



/* ==========================================================
   CHART
========================================================== */

.chart-container {

    position: relative;

    width: 100%;

    height: 300px;
}



/* ==========================================================
   COUNTER STATS
========================================================== */

.counter-stats-list {

    display: flex;

    flex-direction: column;

    gap: 8px;
}


.counter-stat-row {

    display: grid;

    grid-template-columns:
        50px
        minmax(150px, 1fr)
        90px
        90px
        90px
        90px;

    align-items: center;

    gap: 10px;

    padding: 11px;

    border-radius: 12px;

    border-left:
        4px solid var(--counter-color);

    text-decoration: none;

    color: var(--text);

    transition:
        background 0.15s,
        transform 0.15s;
}


.counter-stat-row:hover {

    background: #f8fafc;

    transform: translateX(2px);
}


.counter-stat-icon {

    width: 42px;
    height: 42px;

    display: flex;

    align-items: center;
    justify-content: center;

    border-radius: 11px;

    font-size: 22px;
}


.counter-stat-name {

    font-size: 15px;

    font-weight: 700;

    overflow: hidden;

    white-space: nowrap;

    text-overflow: ellipsis;
}


.counter-stat-number {

    text-align: center;
}


.counter-stat-number strong {

    display: block;

    font-size: 17px;
}


.counter-stat-number span {

    display: block;

    margin-top: 2px;

    font-size: 10px;

    color: var(--muted);

    text-transform: uppercase;
}


.counter-stat-number.total strong {
    color: var(--counter-color);
}



/* ==========================================================
   STATS MOBILE
========================================================== */

@media (max-width: 700px) {

    .stats-summary {

        grid-template-columns:
            repeat(2, 1fr);

        gap: 10px;
    }


    .stat-card {
        padding: 15px 10px;
    }


    .stat-value {
        font-size: 27px;
    }


    .stats-section {

        padding: 17px 13px;

        border-radius: 16px;
    }


    .chart-container {
        height: 260px;
    }


    /*
     * Op smartphone tonen we per counter:
     *
     * icoon | naam | vandaag | totaal
     *
     * Week en maand verbergen we om
     * het overzicht rustig te houden.
     */

    .counter-stat-row {

        grid-template-columns:
            44px
            minmax(80px, 1fr)
            55px
            55px;

        gap: 6px;

        padding:
            10px 7px;
    }


    .counter-stat-number:nth-of-type(3),
    .counter-stat-number:nth-of-type(4) {
        display: none;
    }


    .counter-stat-icon {

        width: 38px;
        height: 38px;

        font-size: 20px;
    }


    .counter-stat-name {
        font-size: 13px;
    }


    .counter-stat-number strong {
        font-size: 15px;
    }


    .counter-stat-number span {
        font-size: 8px;
    }

}
