@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    --bg: #f5f7fb;
    --card-bg: #ffffff;

    /* THEME COLORS */
    --brand-blue: #003082;
    --brand-yellow: #fbc617;

    --accent: var(--brand-blue);
    --accent-soft: rgba(0, 48, 130, 0.08);
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
    --danger: #b91c1c;
    --success: #15803d;
    --radius-lg: 18px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Poppins', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(circle at top left, rgba(0, 48, 130, 0.08), transparent 55%) var(--bg);
    color: var(--text);
}


/* HEADER */
.header-wrapper {
    background: var(--brand-blue);
    padding-top: env(safe-area-inset-top);
    margin: 0;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--brand-blue);
    position: sticky;
    top: 0;
    z-index: 10;
    color: #ffffff;
}

.header-left,
.header-center,
.header-right {
    display: flex;
    align-items: center;
}

.header-left {
    flex: 0 0 auto;
}

.header-center {
    flex: 1;
    justify-content: center;
}

.header-right {
    flex: 0 0 auto;
}

/* Logo + app name */
.home-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #ffffff;
}

.app-logo {
    height: 32px;
    width: 32px;
    object-fit: contain;
}

.app-name {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Navigation and center button */
.main-nav,
.header-center {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.main-nav a,
.header-center a {
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--brand-yellow);
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

/* Hover + Active (non-primary) */
.main-nav a:hover,
.main-nav a.active {
    background: var(--brand-yellow);
    color: #ffffff;
    transform: translateY(-1px);
}

/* + NIEUWE RIT BUTTON */
.header-center a.primary {
    background: transparent;
    color: #fff;
    border: 3px solid var(--brand-yellow);
    font-weight: 700;
    padding-inline: 50px;
}

.header-center a.primary:hover,
.header-center a.primary.active {
    background: var(--brand-yellow);
    color: var(--brand-blue);
    transform: translateY(-1px);
}


/* LAYOUT */

.app-main {
    max-width: 1040px;
    margin: 24px auto 72px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px 20px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.06);
}

.card h2 {
    margin-top: 6px;
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
}

.big-number {
    font-size: 2.1rem;
    font-weight: 700;
    margin: 8px 0 0;
}

/* === INLINE HEADER TITLES (badge + title on one line) === */
.section-title-inline,
.rides-header-title-inline,
.card-header-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title-inline .badge,
.rides-header-title-inline .badge,
.card-header-inline .badge {
    flex-shrink: 0;
}

.section-title-inline h2,
.rides-header-title-inline h2,
.card-header-inline h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}


/* BUTTONS - all solid yellow */

.btn-primary,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid var(--brand-yellow);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    background: var(--brand-yellow);
    color: #000;
    transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.15s ease;
}

/* Hover & focus states */
.btn-primary:hover,
.btn-secondary:hover,
.header-center a.primary:hover,
.header-center a.primary.active {
    background: var(--brand-yellow);
    color: var(--brand-blue);
    transform: translateY(-1px);
}

.link-small {
    font-size: 0.85rem;
    color: var(--brand-blue);
    text-decoration: none;
}

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

/* FORMS */

.error {
    color: var(--danger);
    font-size: 0.8rem;
    margin: 4px 0 0;
}

.success {
    color: var(--success);
    font-size: 0.9rem;
    margin: 0 0 8px;
}

.hint {
    font-size: 0.85rem;
    color: var(--muted);
}

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

.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
select {
    width: 100%;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 0.95rem;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1 1 150px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}

.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* RADIO GROUP */

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.radio-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9rem;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
}

/* LISTS */

.driver-list,
.ride-list,
.simple-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.driver-list li,
.simple-list li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

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

.driver-name {
    font-weight: 500;
}

.driver-km {
    color: var(--muted);
}

/* RITTEN */

.ride-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.ride-item:last-child {
    border-bottom: none;
}

.ride-top-line {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.ride-second-line {
    margin-top: 2px;
    font-size: 0.85rem;
    color: var(--muted);
}

.ride-km {
    font-weight: 600;
}

.day-heading {
    margin: 12px 0 4px;
    font-size: 0.9rem;
    color: rgb(25, 25, 25);
}

/* Vehicle image in instellingen */
.vehicle-image {
    margin-top: 8px;
    max-width: 100%;
    border-radius: 12px;
}

/* SETTINGS ICON */
.settings-icon {
    height: 22px;
    width: 22px;
    object-fit: contain;
    vertical-align: middle;
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.main-nav a:hover .settings-icon,
.main-nav a.active .settings-icon {
    filter: brightness(0) invert(1);
}

/* FOOTER */



.app-footer {
    border-top: 1px solid var(--border);
    background: #ffffff;
    padding: 10px 20px;
}



.app-footer-inner {
    max-width: 1040px;
    margin: 0 auto;
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--muted);
}

.app-footer-muted {
    opacity: 0.8;
}

/* RESPONSIVE */

@media (max-width: 700px) {
    .app-header {
        flex-wrap: wrap;
        gap: 8px;
        height: 50px;
    }

    .header-left,
    .header-right {
        flex: 0 0 auto;
    }

    .header-center {
        order: 3;
        width: 100%;
        margin-top: 4px;
        justify-content: center;
    }

    .main-nav {
        justify-content: flex-end;
        width: 100%;
    }

    .btn-primary,
    .btn-secondary {
        
        justify-content: center;
        padding: 15px 25px;
    }
}

@media (max-width: 480px) {
    .main-nav {
        justify-content: flex-start;
        overflow-x: auto;
    }

    .app-footer-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .card {
        padding: 16px;
    }

    .btn-primary,
    .btn-secondary {
        
        justify-content: center;
        padding: 15px 25px;
    }
}

/* COLOURED NAME / ACCOUNT TAGS */

.name-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    background: rgba(15, 23, 42, 0.04);
    line-height: 1.3;
}

.name-tag::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--tag-color, #9ca3af);
}

/* Persons */
.person-luca {
    --tag-color: #ef4444;
    /* red */
}

.person-marcel {
    --tag-color: #3b82f6;
    /* blue */
}

.person-marieke {
    --tag-color: #facc15;
    /* yellow */
}

/* Accounts */
.account-luca {
    --tag-color: #ef4444;
    /* red */
}

.account-prive {
    --tag-color: #16a34a;
    /* green */
}

.account-evean {
    --tag-color: #532480;
    /* purple */
}

/* ===== RADIO GROUPS – Color pills, no radio circles ===== */

.radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.radio-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    transition: all 0.2s ease;
    color: #111;
}

/* hide native radio */
/* hide native control (radio or checkbox) */
.radio-item input[type="radio"],
.radio-item input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}


/* default state: soft pastel background */
.radio-item.person-luca,
.radio-item.account-luca {
    background: rgba(255, 115, 115, 0.35);
}
.radio-item.person-marcel {
    background: rgba(100, 160, 255, 0.35);
}
.radio-item.person-marieke {
    background: rgba(255, 225, 80, 0.45);
}
.radio-item.account-prive {
    background: rgba(100, 220, 140, 0.35);
}
.radio-item.account-evean {
    background: rgba(160, 120, 200, 0.35);
    color: #fff;
}

/* hover effect */
.radio-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* when selected – brighter, more saturated version */
.radio-item.person-luca:has(input:checked),
.radio-item.account-luca:has(input:checked) {
    background: rgb(255, 95, 95);
    color: #fff;
}
.radio-item.person-marcel:has(input:checked) {
    background: rgb(70, 130, 255);
    color: #fff;
}
.radio-item.person-marieke:has(input:checked) {
    background: rgb(255, 210, 40);
    color: #111;
}
.radio-item.account-prive:has(input:checked) {
    background: rgb(60, 200, 100);
    color: #fff;
}
.radio-item.account-evean:has(input:checked) {
    background: rgb(120, 70, 180);
    color: #fff;
}

/* selection pop (no border) */
.radio-item:has(input:checked) {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* ===== NAME PILLS – Replaces colored dots ===== */

.name-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.2;
    color: #111;
    text-transform: none;
}

/* Driver colors */
.name-pill.person-luca {
    background: rgb(255, 115, 115);
    color: #fff;
}

.name-pill.person-marcel {
    background: rgb(70, 130, 255);
    color: #fff;
}

.name-pill.person-marieke {
    background: rgb(255, 210, 40);
    color: #111;
}

/* Account colors */
.name-pill.account-luca {
    background: rgb(255, 115, 115);
    color: #fff;
}

.name-pill.account-prive {
    background: rgb(60, 200, 100);
    color: #fff;
}

.name-pill.account-evean {
    background: rgb(120, 70, 180);
    color: #fff;
}

/* Optional hover for consistency */
.name-pill:hover {
    
}

/* ===== RESPONSIVE HEADER (mobile adjustments) ===== */

/* Default: show desktop version, hide mobile */
.btn-desktop { display: inline-flex; }
.btn-mobile { display: none; }

/* Hide page title and switch to + on small screens */
@media (max-width: 700px) {
    /* Hide the title (center text) */
    .header-center h1,
    .header-center .page-title {
        display: none !important;
    }

    /* Hide desktop + Nieuwe Rit, show + */
    .btn-desktop { display: none !important; }
    .btn-mobile {
        display: inline-flex !important;
        justify-content: center;
        align-items: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border-radius: 50%;
        font-size: 1.5rem;
        font-weight: 700;
        line-height: 1;
        background: var(--brand-yellow);
        color: var(--brand-blue);
        border: none;
        text-decoration: none;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    }

    /* Simplify layout */
    .app-header {
        justify-content: space-between;
    }

    /* Reduce logo size for mobile */
    .app-logo {
        height: 28px;
        width: 28px;
    }
}

/* ===== HEADER: desktop vs mobile behaviour ===== */

/* By default: show desktop button, hide mobile */
.btn-desktop {
    display: inline-flex;
}
.btn-mobile {
    display: none;
}

/* ===== MOBILE HEADER: Only logo + title centered (taller version) ===== */
@media (max-width: 700px) {

    /* Hide all navigation and buttons */
    .header-center,
    .header-right,
    .btn-desktop,
    .main-nav {
        display: none !important;
    }

    /* Re-center logo and name */
    .app-header {
        justify-content: center;
        text-align: center;
        padding: 18px 0;
        /* was 10px */
        height: 50px;
        /* added fixed height */
        background: var(--brand-blue);
    }

    .header-left {
        flex: 0 0 auto;
    }

    .home-link {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-decoration: none;
        color: #fff;
    }

    .app-logo {
        height: 34px;
        /* slightly larger */
        width: 34px;
        object-fit: contain;
    }

    .app-name {
        display: inline;
        font-size: 1.2rem;
        /* slightly larger */
        font-weight: 600;
    }
}

/* ===== MOBILE STICKY FOOTER NAV (HOME - NIEUW - RITTEN) ===== */

.mobile-bottom-nav {
    display: none;
}

@media (max-width: 700px) {
    .app-footer-inner {
        display: none;
    }

    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 65px;
        background: #ffffff;
        border-top: 1px solid var(--border);
        justify-content: space-around;
        align-items: center;
        box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.08);
        z-index: 25;
    }

    .mobile-nav-item {
        flex: 0 0 auto;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 48px;
        height: 48px;
        transition: transform 0.2s ease, opacity 0.2s ease;
        text-decoration: none;
    }

    .mobile-nav-item:hover {
        transform: scale(1.05);
        opacity: 0.9;
    }

    .mobile-nav-item.active {
        transform: scale(1.1);
    }

    .mobile-nav-icon {
        width: 28px;
        height: 28px;
        object-fit: contain;
        filter: brightness(0) saturate(100%) invert(19%) sepia(92%) saturate(1400%) hue-rotate(194deg) brightness(95%) contrast(98%);
        /* brand-blue */
    }

    .mobile-nav-item.active .mobile-nav-icon {
        filter: brightness(0) saturate(100%) invert(77%) sepia(56%) saturate(692%) hue-rotate(360deg) brightness(102%) contrast(94%);
        /* brand-yellow */
    }

    /* Center button a bit larger */
    .mobile-bottom-nav .mobile-nav-item:nth-child(2) .mobile-nav-icon {
        width: 32px;
        height: 32px;
    }

    .app-main {
        padding-bottom: 0px;
        margin-top: 0;
        
    }
}

/* ===== MOBILE RITTEN PAGE LAYOUT FIX ===== */
@media (max-width: 700px) {

    /* Make ride items more touch-friendly */
    .ride-item {
        padding: 12px 0;
        border-bottom: 1px solid var(--border);
    }

    /* Ensure content wraps gracefully */
    .ride-top-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        font-size: 0.95rem;
    }

    /* Slightly larger readable text */
    .ride-second-line {
        font-size: 0.9rem;
        line-height: 1.3;
    }

    /* Make driver/account pills full width if needed */
    .name-pill {
        display: inline-block;
        margin-top: 4px;
        padding: 5px 12px;
        font-size: 0.85rem;
    }

    /* Date headings spaced out more clearly */
    .day-heading {
        margin-top: 16px;
        margin-bottom: 8px;
        font-size: 1rem;
        font-weight: 600;
        color: rgb(25,25,25);
    }

    /* Distance text emphasized */
    .ride-km {
        font-weight: 700;
        color: var(--brand-blue);
        font-size: 1rem;
    }
}

/* ===== MOBILE HEADER ICONS (back + settings) ===== */

.mobile-header-icons {
    display: none;
}

.mobile-header-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    filter: brightness(0) invert(1); /* make icons white */
}

.mobile-header-spacer {
    width: 32px;
    height: 32px;
}

/* Apply only on small screens */
@media (max-width: 700px) {
    .mobile-header-icons {
        display: flex;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 50px;
        padding: 0 14px;
        justify-content: space-between;
        align-items: center;
        pointer-events: none; /* avoid blocking center logo */
    }

    .mobile-header-icons a {
        pointer-events: auto;
    }

    /* Keep logo + name centered in header on mobile */
    .app-header {
        position: relative;
        justify-content: center;
        text-align: center;
        height: 57px;
        padding: 10px 0;
    }

    /* We already hide most desktop nav on mobile in your existing CSS:
       .header-center, .header-right, .main-nav, .btn-desktop { display: none !important; }
       So header-left (logo + name) stays visible and centered. */
}

/* ===== STICKY MOBILE HEADER (with larger settings icon) ===== */
@media (max-width: 700px) {
    .app-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
        background: var(--brand-blue);
        justify-content: center;
        text-align: center;
        height: 57px;
        /* slightly taller for balance */
        padding: 10px 0;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    }

    /* Prevent overlap with content */
    body {
        padding-top: 72px;
    }

    /* Back + Settings buttons */
    .mobile-header-icons {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 57px;
        padding: 0 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        z-index: 55;
        pointer-events: none;
        /* don't block center logo */
    }

    .mobile-header-icons a {
        pointer-events: auto;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 42px;
        height: 42px;
    }

    .mobile-header-icon {
        object-fit: contain;
        filter: brightness(0) invert(1);
    }

    /* back icon normal size */
    .mobile-back-btn .mobile-header-icon {
        width: 22px;
        height: 22px;
    }

    /* make settings slightly bigger and perfectly centered */
    .mobile-settings-btn .mobile-header-icon {
        width: 26px;
        height: 26px;
    }

    /* ensure logo + name stay centered */
    .home-link {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-decoration: none;
        color: #fff;
    }

    .app-logo {
        width: 32px;
        height: 32px;
    }

    .app-name {
        font-size: 1.1rem;
        font-weight: 600;
    }

}

/* ===========================
   GLOBAL REFRESH INDICATOR (BAR)
   =========================== */

.refresh-indicator {
    height: 4px;
    width: 100%;
    overflow: hidden;
    background: transparent;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.refresh-indicator.is-active {
    opacity: 1;
    transform: translateY(0);
}

.refresh-bar {
    position: relative;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.4) 20%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 255, 255, 0.4) 80%,
        rgba(255, 255, 255, 0) 100%
    );
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.refresh-bar::before {
    content: "";
    position: absolute;
    top: 0;
    left: -30%;
    width: 30%;
    height: 100%;
    background: var(--brand-yellow);
    animation: refresh-slide 0.8s ease-in-out infinite;
    border-radius: 999px;
}

@keyframes refresh-slide {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(450%);
    }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .refresh-bar::before {
        animation: none;
    }

}

@media (max-width: 700px) {
    .refresh-indicator {
        transform: translateY(-16px);
    }
    .refresh-indicator.is-active {
        transform: translateY(-16px);
    }
}
