/* =============================================
   Wirtz Haussysteme Corporate Design System
   Fonts: Barlow (sans) + Cormorant Garamond (display)
   ============================================= */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Cormorant+Garamond:wght@400;700&display=swap');

:root {
    /* Brand — Wirtz Haussysteme */
    --primary:          #00aeef;   /* cyan-blue accent */
    --primary-hover:    #0098d4;
    --primary-light:    #e6f6fd;
    --primary-mid:      #b3e4f8;

    /* Semantic — today highlight stays on-brand */
    --today-accent:     #00aeef;
    --today-bg:         #e6f6fd;
    --today-pill:       #00aeef;

    /* Neutrals — Wirtz charcoal palette */
    --charcoal:         #4a4a4a;   /* primary text & borders */
    --charcoal-dark:    #373737;   /* dark panels */
    --charcoal-hover:   #3a3a3a;

    /* Text */
    --text:             #4a4a4a;
    --text-secondary:   #595b5e;
    --text-muted:       #82817d;
    --text-subtle:      #979797;

    /* Surfaces */
    --bg:               #f7f7f7;
    --bg-subtle:        #f1f1f1;
    --card:             #ffffff;
    --card-elevated:    #ffffff;

    /* Borders */
    --border:           #e7e7e7;
    --border-strong:    #ccc;

    /* Feedback */
    --error-bg:         #fef2f2;
    --error-border:     #f5c6c6;
    --error-text:       #e2001a;
    --success-bg:       #f0fdf4;
    --success-border:   #bbf7d0;

    /* Layout */
    --header-h:         56px;
    --nav-h:            64px;
    --radius-sm:        4px;
    --radius-md:        6px;
    --radius-lg:        8px;
    --radius-xl:        10px;

    /* Shadows — crisp and minimal */
    --shadow-xs:        0 1px 2px rgba(0,0,0,.06);
    --shadow-sm:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:        0 3px 8px rgba(0,0,0,.08), 0 1px 3px rgba(0,0,0,.05);
    --shadow-nav:       0 -1px 0 rgba(0,0,0,.08), 0 -4px 16px rgba(0,0,0,.07);
    --shadow-header:    0 1px 0 rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.06);
}

/* =============================================
   Reset & base
   ============================================= */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Barlow', Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100%;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =============================================
   App shell
   ============================================= */
.app-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    background: var(--bg);
}

/* =============================================
   Header — Wirtz style: white background,
   charcoal text, cyan accent on the icon
   ============================================= */
.app-header {
    background: var(--card);
    color: var(--text);
    flex-shrink: 0;
    box-shadow: var(--shadow-header);
    padding-top: env(safe-area-inset-top);
    position: relative;
    z-index: 50;
    border-bottom: 2px solid var(--primary);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
    padding: 0 1rem;
    gap: .75rem;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
    flex: 1;
}

.app-title {
    font-family: 'Barlow', Helvetica, sans-serif;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--charcoal);
    line-height: 1.2;
}

.user-name {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: .03em;
    color: var(--text-muted);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.header-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--card);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid var(--primary-mid);
    overflow: hidden;
}

.header-icon svg,
.header-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.header-icon svg {
    color: var(--primary);
}

.signout-btn {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    transition: background .15s ease, color .15s ease;
    flex-shrink: 0;
    margin-right: -.25rem;
}

.signout-btn:hover {
    background: var(--bg-subtle);
    color: var(--charcoal);
}

/* =============================================
   Main content area
   ============================================= */
.app-main {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 1rem);
}

/* =============================================
   Bottom navigation — Wirtz style:
   white surface, uppercase Barlow labels,
   cyan active indicator
   ============================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    display: flex;
    background: var(--card);
    box-shadow: var(--shadow-nav);
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 100;
    border-top: 1px solid var(--border);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-subtle);
    font-family: 'Barlow', Helvetica, sans-serif;
    font-size: .6rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    transition: color .2s ease;
    padding: .5rem 0;
    position: relative;
}

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

/* Active indicator — Wirtz-style top bar in brand cyan */
.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 2px;
    background: var(--primary);
    border-radius: 0 0 2px 2px;
}

.nav-icon {
    width: 22px;
    height: 22px;
    transition: transform .2s ease;
}

.nav-item.active .nav-icon {
    transform: scale(1.08);
}

/* =============================================
   Section header (shared)
   ============================================= */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .875rem;
}

.section-title {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* =============================================
   Week navigation (My Schedule)
   ============================================= */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: .5rem;
    background: var(--card);
    border-radius: var(--radius-md);
    padding: .625rem .75rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
}

.week-label-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.week-label {
    font-weight: 600;
    font-size: .875rem;
    letter-spacing: .02em;
    color: var(--charcoal);
    white-space: nowrap;
}

/* =============================================
   Day cards (My Schedule)
   ============================================= */
.day-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: .5rem;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: box-shadow .2s ease;
}

.day-card.today {
    border-color: var(--today-accent);
    border-left: 3px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

.day-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .45rem .875rem;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border);
}

.day-card.today .day-header {
    background: var(--charcoal-dark);
    border-bottom-color: transparent;
}

.day-name {
    font-weight: 700;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-secondary);
}

.day-card.today .day-name {
    color: rgba(255,255,255,.9);
}

.day-date {
    font-size: .75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.day-card.today .day-date {
    color: rgba(255,255,255,.65);
}

.today-chip {
    margin-left: auto;
    font-size: .58rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    background: var(--primary);
    color: #fff;
    padding: 2px 7px;
    border-radius: 2px;
}

.day-card.today .today-chip {
    background: rgba(255,255,255,.15);
    color: #fff;
}

.entry-item {
    display: flex;
    gap: .75rem;
    align-items: center;
    padding: .5rem .875rem;
    border-bottom: 1px solid var(--border);
}

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

.time-badge {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    font-size: .72rem;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    min-width: 48px;
    text-align: center;
    flex-shrink: 0;
    letter-spacing: .02em;
    border: 1px solid var(--primary-mid);
}

.location {
    font-size: .875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.no-entries {
    padding: .5rem .875rem;
    color: var(--text-subtle);
    font-size: .78rem;
    font-style: italic;
}

/* =============================================
   Date navigation (All Schedules)
   ============================================= */
.date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: .5rem;
    background: var(--card);
    border-radius: var(--radius-md);
    padding: .625rem .75rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border);
}

.date-display-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.date-display {
    font-weight: 700;
    font-size: .95rem;
    letter-spacing: -.01em;
    color: var(--charcoal);
}

.date-sub {
    font-size: .72rem;
    font-weight: 500;
    letter-spacing: .03em;
    color: var(--text-muted);
}

.today-jump {
    margin-bottom: .875rem;
    display: flex;
    justify-content: center;
}

.entry-count {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: .5rem;
    padding-left: .25rem;
}

/* Employee card (All Schedules) */
.employee-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: .75rem .875rem;
    margin-bottom: .5rem;
    display: flex;
    align-items: center;
    gap: .875rem;
    box-shadow: var(--shadow-xs);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.employee-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--charcoal-dark);
    color: #fff;
    font-weight: 700;
    font-size: .8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.employee-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.employee-name {
    font-weight: 600;
    font-size: .88rem;
    letter-spacing: .01em;
    color: var(--charcoal);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.employee-location {
    font-size: .75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.employee-time {
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .03em;
    color: var(--primary);
    background: var(--primary-light);
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    border: 1px solid var(--primary-mid);
}

/* =============================================
   Shared navigation buttons
   Wirtz style: outlined charcoal, no heavy radius
   ============================================= */
.nav-btn {
    background: var(--card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0;
    width: 38px;
    height: 38px;
    cursor: pointer;
    color: var(--charcoal);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
    font-size: 1rem;
}

.nav-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.nav-btn:active {
    background: var(--primary-mid);
}

/* Primary CTA button — Wirtz style:
   uppercase Barlow, charcoal fill, cyan hover */
.today-btn {
    background: var(--charcoal);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: .35rem .875rem;
    font-family: 'Barlow', Helvetica, sans-serif;
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s ease;
}

.today-btn:hover {
    background: var(--primary);
}

.today-btn:active {
    background: var(--primary-hover);
}

/* =============================================
   Refresh row
   ============================================= */
.refresh-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-top: 1rem;
    padding-top: .75rem;
    border-top: 1px solid var(--border);
}

.refresh-text-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-family: 'Barlow', Helvetica, sans-serif;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .04em;
    cursor: pointer;
    padding: .3rem .6rem;
    border-radius: var(--radius-sm);
    transition: background .15s ease;
}

.refresh-text-btn:hover {
    background: var(--primary-light);
}

.refresh-text-btn:disabled {
    color: var(--text-subtle);
    cursor: default;
    background: none;
}

.last-updated {
    font-size: .7rem;
    letter-spacing: .02em;
    color: var(--text-subtle);
}

/* =============================================
   Loading states
   ============================================= */
.spinner {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
}

.spinner-border {
    width: 26px;
    height: 26px;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .65s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton shimmer */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
    border-radius: var(--radius-sm);
    height: 14px;
}

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =============================================
   Location groups (Location Schedule)
   ============================================= */
.location-group {
    margin-bottom: 1rem;
}

.location-group-header {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .25rem .3rem .125rem;
    margin-bottom: .375rem;
    border-bottom: 1px solid var(--border);
}

.location-group-icon {
    color: var(--primary);
    flex-shrink: 0;
}

.location-group-name {
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.location-group-count {
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .04em;
    color: #fff;
    background: var(--primary);
    padding: 1px 6px;
    border-radius: 2px;
    flex-shrink: 0;
}

/* Within a location group the employee-card sits flush — remove bottom gap on last card */
.location-group .employee-card:last-child {
    margin-bottom: 0;
}

/* =============================================
   Error & empty states
   ============================================= */
.error-banner {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    border-left: 3px solid var(--error-text);
    border-radius: var(--radius-md);
    padding: .875rem 1rem;
    margin-bottom: .875rem;
    font-size: .85rem;
    color: var(--error-text);
    line-height: 1.6;
}

.empty-state {
    text-align: center;
    padding: 3.5rem 1.5rem;
    color: var(--text-muted);
    font-size: .875rem;
    line-height: 1.6;
}

.empty-state-icon {
    margin-bottom: .75rem;
    opacity: .35;
    display: block;
    color: var(--charcoal);
}

/* =============================================
   Landing page — full-viewport centered card,
   no header/nav shell.
   Visual style mirrors LocalAuthController login page.
   ============================================= */
.landing-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    padding: 1.5rem;
    padding-top: calc(1.5rem + env(safe-area-inset-top));
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
}

.landing-card {
    background: var(--card);
    border-radius: 20px;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, .07),
        0 2px 4px -2px rgba(0, 0, 0, .05),
        0 0 0 1px rgba(0, 0, 0, .04);
    padding: 2rem 1.5rem 1.75rem;
    width: 100%;
    max-width: 360px;
}

/* Square icon container — matches .app-mark in login page */
.landing-app-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--primary-light);
    border-radius: 14px;
    margin: 0 auto 1.25rem;
}

.landing-logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
}

.landing-title {
    font-family: 'Barlow', Helvetica, sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -.025em;
    color: var(--charcoal);
    text-align: center;
    margin: 0 0 .25rem;
    line-height: 1.2;
}

.landing-tagline {
    font-size: .8rem;
    font-weight: 400;
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 1.75rem;
    line-height: 1.5;
}

/* Action button — matches .user-btn pill style from login page */
.landing-btn {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .75rem .875rem;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: 'Barlow', Helvetica, sans-serif;
    font-size: .9rem;
    font-weight: 500;
    color: var(--charcoal);
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.landing-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-mid);
    color: var(--primary);
}

.landing-btn:active {
    background: var(--primary-mid);
    color: var(--primary);
}
