/* ==========================================================================
   Time Tracking Page — Futuristic Neumorphism Redesign
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Page Layout
   --------------------------------------------------------------------------- */
.time-tracking-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    max-width: 1200px;
    width: 100%;
}

/* ---------------------------------------------------------------------------
   Header
   --------------------------------------------------------------------------- */
.tt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.tt-header__title {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}

.tt-header__subtitle {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.tt-header__nav {
    display: flex;
    gap: var(--space-2);
}

/* ---------------------------------------------------------------------------
   Top Row: Clock + KPIs
   --------------------------------------------------------------------------- */
.tt-top-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: var(--space-4);
    align-items: stretch;
}

/* Clock Card */
.tt-clock-card {
    grid-column: span 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    background: var(--color-bg-primary);
    border: none;
    box-shadow: var(--neu-raised);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: box-shadow 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tt-clock-card:hover {
    box-shadow: var(--neu-raised-lg);
}

.tt-clock-card__left {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    min-width: 0;
}

.tt-clock-card__time {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.tt-clock-card__date {
    font-size: 11px;
    color: var(--color-text-tertiary);
    text-transform: capitalize;
}

.tt-clock-card__status {
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-top: var(--space-1);
}

.tt-clock-card__status strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

.tt-clock-card__worked {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-top: var(--space-1);
}

.tt-clock-card__worked-label {
    font-weight: 400;
    color: var(--color-text-tertiary);
    font-size: 11px;
}

.tt-clock-card__right {
    flex-shrink: 0;
}

/* Action Button */
.tt-action-btn {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    border: none;
    background: linear-gradient(145deg, var(--color-accent-subtle), var(--color-bg-primary));
    box-shadow: var(--neu-raised);
    color: var(--color-accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--font-family);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.tt-action-btn:hover {
    background: linear-gradient(145deg, var(--color-accent), color-mix(in srgb, var(--color-accent) 80%, #000));
    color: var(--color-text-on-accent);
    box-shadow: var(--neu-raised-lg);
    transform: scale(1.05);
}

.tt-action-btn:active {
    box-shadow: var(--neu-inset-sm);
    transform: scale(0.96);
    background: linear-gradient(145deg, var(--color-bg-primary), var(--color-accent-subtle));
}

.tt-action-btn--active {
    background: linear-gradient(145deg, var(--color-success-bg), var(--color-bg-primary));
    box-shadow: var(--neu-raised);
    color: var(--color-success);
}

.tt-action-btn--active:hover {
    background: linear-gradient(145deg, var(--color-error), color-mix(in srgb, var(--color-error) 80%, #000));
    color: #fff;
    box-shadow: var(--neu-raised-lg);
}

/* KPI Cards */
.tt-kpi-card {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--color-bg-primary);
    border: none;
    box-shadow: var(--neu-raised);
    border-radius: var(--radius-xl);
    transition: box-shadow 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tt-kpi-card:hover {
    box-shadow: var(--neu-raised-lg);
}

.tt-kpi-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: var(--neu-inset-sm);
}

.tt-kpi-card__data {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tt-kpi-card__value {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.tt-kpi-card__label {
    font-size: 11px;
    color: var(--color-text-tertiary);
    white-space: nowrap;
}

/* ---------------------------------------------------------------------------
   Section
   --------------------------------------------------------------------------- */
.tt-section__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.tt-section__title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text-primary);
}

.tt-section__count {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
    background: var(--color-bg-secondary);
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

/* ---------------------------------------------------------------------------
   Employees Grid
   --------------------------------------------------------------------------- */
.tt-employees-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Employee Card */
.tt-employee-card {
    background: var(--color-bg-primary);
    border: none;
    box-shadow: var(--neu-raised);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: box-shadow 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.tt-employee-card:hover {
    box-shadow: var(--neu-raised-lg);
}

.tt-employee-card--active {
    box-shadow: var(--neu-raised), inset 3px 0 0 var(--color-success);
}

.tt-employee-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(
        to bottom,
        var(--color-bg-secondary),
        var(--color-bg-primary)
    );
    border-bottom: none;
    box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--color-bg-primary) 60%, transparent);
}

.tt-employee-card__identity {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.tt-employee-card__name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    line-height: 1.3;
}

.tt-employee-card__num {
    font-size: 11px;
    color: var(--color-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.tt-employee-card__total {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
}

.tt-employee-card__hours {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
}

/* Avatar */
.tt-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--color-accent-subtle);
    color: var(--color-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    box-shadow: var(--neu-raised-sm);
}

.tt-avatar--active {
    background: var(--color-success-bg);
    color: var(--color-success);
    box-shadow: var(--neu-raised-sm), 0 0 0 2px var(--color-success);
}

/* Pulse indicator */
.tt-pulse {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--color-success);
    animation: ttPulse 2s ease-in-out infinite;
}

@keyframes ttPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
}

/* Entry Rows */
.tt-employee-card__entries {
    display: flex;
    flex-direction: column;
}

.tt-entry-row {
    display: grid;
    grid-template-columns: 1fr 200px 80px 70px;
    align-items: center;
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    border-bottom: 1px solid color-mix(in srgb, var(--color-text-primary) 6%, transparent);
    transition: box-shadow 150ms ease, background 150ms ease;
}

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

.tt-entry-row:hover {
    background: color-mix(in srgb, var(--color-bg-primary) 50%, transparent);
    box-shadow: var(--neu-inset-sm);
    border-bottom-color: transparent;
}

.tt-entry-row--open {
    background: color-mix(in srgb, var(--color-success) 3%, transparent);
}

.tt-entry-row__site {
    font-weight: 500;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
}

.tt-entry-row__times {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-variant-numeric: tabular-nums;
}

.tt-entry-row__in,
.tt-entry-row__out {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
    color: var(--color-text-primary);
    font-size: var(--text-sm);
}

.tt-entry-row__pending {
    font-size: 11px;
    font-style: italic;
    color: var(--color-warning);
    font-weight: 500;
}

.tt-entry-row__duration {
    font-weight: 600;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.tt-entry-row__method {
    font-size: 10px;
    color: var(--color-text-quaternary);
    text-align: right;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Dots */
.tt-dot {
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.tt-dot--in {
    background: var(--color-success);
}

.tt-dot--out {
    background: var(--color-error);
}

/* ---------------------------------------------------------------------------
   Empty State
   --------------------------------------------------------------------------- */
.tt-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-12) var(--space-6);
    text-align: center;
}

.tt-empty-state p {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

/* ---------------------------------------------------------------------------
   Success Overlay
   --------------------------------------------------------------------------- */
.tt-success-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--color-bg-primary) 95%, transparent);
    backdrop-filter: blur(4px);
    z-index: 10;
    border-radius: var(--radius-xl);
    animation: fadeIn 200ms ease;
    transition: opacity 300ms ease;
    gap: var(--space-3);
    box-shadow: var(--neu-raised-lg);
}

.tt-success-overlay__icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--color-success);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: resultPop 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--neu-raised-sm);
}

.tt-success-overlay p {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-primary);
}

/* ---------------------------------------------------------------------------
   Scanner Overlay
   --------------------------------------------------------------------------- */
.tt-scanner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    animation: fadeIn 200ms ease;
}

.tt-scanner-card {
    background: var(--color-bg-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    max-width: 420px;
    width: 100%;
    box-shadow: var(--neu-raised-lg);
}

.tt-scanner-card__header {
    text-align: center;
    margin-bottom: var(--space-4);
}

.tt-scanner-card__header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: var(--space-1);
}

.tt-scanner-card__header p {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}

/* ---------------------------------------------------------------------------
   Section Title (used by other time tracking pages)
   --------------------------------------------------------------------------- */
.time-tracking__section-title {
    position: relative;
    padding-left: var(--space-4);
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--color-text-primary);
    letter-spacing: -0.01em;
}

.time-tracking__section-title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 16px;
    background: linear-gradient(180deg, var(--color-accent), color-mix(in srgb, var(--color-accent) 40%, transparent));
    border-radius: var(--radius-full);
}

/* ---------------------------------------------------------------------------
   Clock-In Section (legacy, kept for other pages)
   --------------------------------------------------------------------------- */
.clock-in-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-5);
    padding: var(--space-12) var(--space-6);
    background: var(--color-bg-primary);
    border: none;
    box-shadow: var(--neu-raised);
    border-radius: var(--radius-xl);
    text-align: center;
    transition: box-shadow 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.clock-in__time {
    font-size: 52px;
    font-weight: 700;
    color: var(--color-text-primary);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.clock-in__date {
    font-size: var(--text-sm);
    color: var(--color-text-tertiary);
}

.clock-in__btn {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    border: none;
    background: linear-gradient(145deg, var(--color-accent-subtle), var(--color-bg-primary));
    box-shadow: var(--neu-raised);
    color: var(--color-accent);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--font-family);
}

.clock-in__btn:hover {
    background: linear-gradient(145deg, var(--color-accent), color-mix(in srgb, var(--color-accent) 80%, #000));
    color: var(--color-text-on-accent);
    box-shadow: var(--neu-raised-lg);
    transform: scale(1.03);
}

.clock-in__btn:active {
    box-shadow: var(--neu-inset-sm);
    transform: scale(0.97);
    background: linear-gradient(145deg, var(--color-bg-primary), var(--color-accent-subtle));
}

.clock-in__btn-icon { width: 30px; height: 30px; }

.clock-in__btn-label {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.clock-in__btn--active {
    background: linear-gradient(145deg, var(--color-success-bg), var(--color-bg-primary));
    box-shadow: var(--neu-raised);
    color: var(--color-success);
}

.clock-in__btn--active:hover {
    background: linear-gradient(145deg, var(--color-error), color-mix(in srgb, var(--color-error) 80%, #000));
    color: #ffffff;
    box-shadow: var(--neu-raised-lg);
}

.clock-in__status {
    font-size: var(--text-xs);
    color: var(--color-text-tertiary);
}

.clock-in__status strong {
    color: var(--color-text-primary);
    font-weight: 600;
}

.clock-in__worked {
    display: flex;
    align-items: center;
    gap: var(--space-8);
}

.clock-in__worked-item { text-align: center; }

.clock-in__worked-value {
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
}

.clock-in__worked-label {
    font-size: 11px;
    color: var(--color-text-placeholder);
    margin-top: var(--space-1);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ---------------------------------------------------------------------------
   Daily Timeline (legacy)
   --------------------------------------------------------------------------- */
.daily-timeline {
    background: var(--color-bg-primary);
    border: none;
    box-shadow: var(--neu-raised);
    border-radius: var(--radius-xl);
    padding: var(--space-5) var(--space-6);
    transition: box-shadow 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.daily-timeline__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.daily-timeline__title {
    position: relative;
    padding-left: var(--space-4);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-primary);
}

.daily-timeline__title::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 14px;
    background: linear-gradient(180deg, var(--color-accent), color-mix(in srgb, var(--color-accent) 40%, transparent));
    border-radius: var(--radius-full);
}

.daily-timeline__entries {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.timeline-entry {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    transition: box-shadow 200ms ease, background 200ms ease;
}

.timeline-entry:hover {
    background: color-mix(in srgb, var(--color-bg-primary) 50%, transparent);
    box-shadow: var(--neu-inset-sm);
}

.timeline-entry__dot {
    width: 7px;
    height: 7px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.timeline-entry__dot--clock-in { background: var(--color-success); }
.timeline-entry__dot--clock-out { background: var(--color-error); }
.timeline-entry__dot--break { background: var(--color-warning); }

.timeline-entry__time {
    font-weight: 600;
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
    min-width: 50px;
}

.timeline-entry__label {
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

.timeline-entry__site {
    margin-left: auto;
    font-size: var(--text-xs);
    color: var(--color-text-placeholder);
}

/* ---------------------------------------------------------------------------
   Weekly Grid (used by history page)
   --------------------------------------------------------------------------- */
.weekly-grid {
    background: var(--color-bg-primary);
    border: none;
    box-shadow: var(--neu-raised);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: box-shadow 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

.weekly-grid__header {
    display: grid;
    grid-template-columns: 100px repeat(7, 1fr) 80px;
    border-bottom: 1px solid color-mix(in srgb, var(--color-text-primary) 6%, transparent);
}

.weekly-grid__header-cell {
    padding: var(--space-3);
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-tertiary);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.weekly-grid__header-cell--today { color: var(--color-accent); }

.weekly-grid__row {
    display: grid;
    grid-template-columns: 100px repeat(7, 1fr) 80px;
    border-bottom: 1px solid color-mix(in srgb, var(--color-text-primary) 6%, transparent);
    transition: box-shadow 200ms ease, background 200ms ease;
}

.weekly-grid__row:last-child { border-bottom: none; }
.weekly-grid__row:hover {
    background: color-mix(in srgb, var(--color-bg-primary) 50%, transparent);
    box-shadow: var(--neu-inset-sm);
}

.weekly-grid__label {
    padding: var(--space-3);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-primary);
    display: flex;
    align-items: center;
}

.weekly-grid__cell {
    padding: var(--space-2) var(--space-3);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    justify-content: center;
}

.weekly-grid__cell--empty { color: var(--color-text-placeholder); }

.weekly-grid__cell--today {
    background: var(--color-accent-subtle);
    font-weight: 600;
}

.weekly-grid__total {
    padding: var(--space-3);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text-primary);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */
@media (max-width: 1023px) {
    .tt-top-row {
        grid-template-columns: 1fr 1fr;
    }

    .tt-entry-row {
        grid-template-columns: 1fr 160px 70px;
    }

    .tt-entry-row__method {
        display: none;
    }

    .weekly-grid { overflow-x: auto; }
    .weekly-grid__header,
    .weekly-grid__row { min-width: 700px; }
}

@media (max-width: 639px) {
    .time-tracking-page { gap: var(--space-4); }

    .tt-top-row {
        grid-template-columns: 1fr;
    }

    .tt-clock-card {
        padding: var(--space-4);
    }

    .tt-clock-card__time {
        font-size: 26px;
    }

    .tt-action-btn {
        width: 64px;
        height: 64px;
    }

    .tt-action-btn svg {
        width: 20px;
        height: 20px;
    }

    .tt-entry-row {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-2);
        padding: var(--space-3) var(--space-4);
    }

    .tt-entry-row__duration,
    .tt-entry-row__method {
        display: none;
    }

    .tt-employee-card__header {
        padding: var(--space-3) var(--space-4);
    }

    .clock-in-section {
        padding: var(--space-8) var(--space-4);
    }

    .clock-in__time { font-size: 38px; }
    .clock-in__btn { width: 100px; height: 100px; }
    .clock-in__btn-icon { width: 24px; height: 24px; }
    .clock-in__worked { gap: var(--space-5); }
    .daily-timeline { padding: var(--space-4); }
}
