/* ============================================
   ZEITEINTRÄGE TAB - Modernisiertes Design v8.61
   Inspiriert von Arbeitszeitauswertung

   CSS Custom Properties: nutzt --fm-primary und --fm-accent
   aus 5meter-core (globale :root-Variablen).
   ============================================ */
.time-editor-container {
    background: white;
    border-radius: 8px;
    padding: 0;
}

.time-editor-info {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #166534;
}

.time-editor-info p { margin: 0; }

/* Filter-Leiste */
.time-editor-filter {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    flex-wrap: wrap;
}

.time-editor-filter label {
    font-weight: 600;
    color: #334155;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.time-editor-filter input[type="date"] {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #334155;
    background: white;
}

.time-editor-filter input[type="date"]:focus {
    border-color: var(--fm-primary);
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--fm-primary) 13%, transparent);
}

#te-load-btn {
    padding: 6px 16px;
    background: var(--fm-primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

#te-load-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Stats-Kacheln */
.te-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.te-stat-box {
    background: var(--fm-primary);
    color: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.15s, box-shadow 0.15s;
}

.te-stat-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.te-stat-box-clickable { cursor: pointer; }

.te-stat-label {
    font-size: 0.8rem;
    opacity: 0.9;
    margin-bottom: 6px;
    font-weight: 500;
}

.te-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
}

.te-stat-breakdown {
    font-size: 0.7rem;
    opacity: 0.85;
    margin-top: 4px;
}

/* Loading & Error */
.te-loading {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

/* ============================================
   ACCORDION - TAGES-GRUPPIERUNG
   ============================================ */
.te-days-accordion {
    margin-top: 16px;
}

.te-day-section {
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
}

.te-day-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, var(--fm-primary), var(--fm-accent));
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    gap: 12px;
    user-select: none;
}

.te-day-header:hover {
    filter: brightness(1.05);
}

.te-day-header.collapsed {
    background: #f8fafc;
    color: #334155;
}

.te-day-header.collapsed:hover {
    background: #f1f5f9;
}

.te-day-toggle {
    font-size: 0.9em;
    transition: transform 0.2s;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.te-day-header.collapsed .te-day-toggle {
    transform: rotate(-90deg);
}

.te-day-date {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 600;
}

.te-day-stats {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    opacity: 0.9;
}

.te-day-stat {
    display: flex;
    align-items: center;
    gap: 4px;
}

.te-day-entries {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.te-day-entries.collapsed {
    max-height: 0;
}

/* ============================================
   ENTRY CARDS - Schlicht & Modern
   ============================================ */
.te-entry-card {
    background: white;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s;
}

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

.te-entry-card:hover {
    background: #f8fafc;
}

.te-entry-card.editing {
    background: #fffbeb;
}

.te-entry-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    min-height: 44px;
}

.te-entry-bubbles {
    flex-shrink: 0;
    width: 36px;
}

.te-entry-time {
    color: #64748b;
    font-size: 0.82rem;
    white-space: nowrap;
    min-width: 140px;
    font-variant-numeric: tabular-nums;
}

.te-entry-time small {
    color: #94a3b8;
}

.te-entry-project {
    font-weight: 600;
    color: var(--fm-primary);
    font-size: 0.85rem;
    min-width: 120px;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.te-entry-description-preview {
    flex: 1;
    color: #475569;
    font-size: 0.82rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.te-entry-description-preview:hover {
    background: #e2e8f0;
}

.te-entry-description-preview .te-expand-icon {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 0.7em;
    margin-right: 4px;
    color: #94a3b8;
}

.te-entry-description-preview.expanded .te-expand-icon {
    transform: rotate(90deg);
}

.te-entry-actions {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
}

.te-entry-card:hover .te-entry-actions {
    opacity: 1;
}

.te-entry-actions .button.button-small {
    padding: 2px 8px;
    min-height: 28px;
    font-size: 0.8rem;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
}

.te-entry-actions .button.button-small:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.te-btn-save { color: #16a34a !important; }
.te-btn-cancel { color: #dc2626 !important; }
.te-btn-delete:hover { background: #fef2f2 !important; border-color: #fca5a5 !important; }

/* Description Expanded */
.te-description-full {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    background: #f8fafc;
    padding: 0 16px;
    border-top: none;
}

.te-description-full.expanded {
    max-height: 800px;
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
}

.te-description-content {
    font-size: 0.82rem;
    color: #475569;
    line-height: 1.6;
}

.te-description-goal {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    border-left: 3px solid var(--fm-primary);
}

.te-description-timer-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 10px 0;
}

.te-description-timer-section {
    padding: 10px 12px;
    border-radius: 6px;
    background: white;
}

.te-description-timer-section.start {
    border-left: 3px solid #10b981;
}

.te-description-timer-section.stop {
    border-left: 3px solid #f59e0b;
}

.te-description-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: #334155;
    margin-bottom: 6px;
}

.te-description-section {
    margin: 8px 0;
}

.te-description-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.te-description-item {
    padding: 3px 0;
    padding-left: 20px;
    position: relative;
    font-size: 0.82rem;
}

.te-description-item.completed {
    color: #16a34a;
}

.te-description-item.completed::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: #16a34a;
    font-weight: 700;
}

.te-description-item.incomplete {
    color: #94a3b8;
    text-decoration: line-through;
}

.te-description-item.incomplete::before {
    content: '\2610';
    position: absolute;
    left: 0;
    color: #94a3b8;
}

.te-description-item.additional::before {
    content: '\2022';
    position: absolute;
    left: 0;
    color: #f59e0b;
}

.te-description-stats {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    font-weight: 600;
    color: var(--fm-primary);
    font-size: 0.82rem;
}

/* TODO Bubbles */
.te-todo-bubbles {
    display: flex;
    gap: 3px;
}

.te-todo-bubble {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    cursor: help;
    position: relative;
    font-weight: 700;
}

.te-todo-bubble.start {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #86efac;
}

.te-todo-bubble.stop-completed {
    background: #dcfce7;
    color: #16a34a;
    border: 1px solid #86efac;
}

.te-todo-bubble.stop-failed {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

.te-todo-bubble.stop-mixed {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fcd34d;
}

.te-todo-bubble.no-todo {
    background: #f8fafc;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
}

.te-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.te-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
}

.te-todo-bubble:hover .te-tooltip {
    display: block;
}

/* Inline-Edit Fields */
.te-editable.editing {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 4px;
    padding: 4px 8px;
}

.te-inline-edit-field {
    padding: 4px 8px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 0.82rem;
    width: 100%;
}

.te-inline-edit-field:focus {
    border-color: var(--fm-primary);
    outline: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--fm-primary) 13%, transparent);
}

/* Autocomplete Dropdown */
.te-autocomplete-wrapper {
    position: relative;
}

.te-autocomplete-dropdown {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 999999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.te-autocomplete-dropdown.active {
    display: block;
}

.te-autocomplete-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.82rem;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.1s;
}

.te-autocomplete-item:hover,
.te-autocomplete-item.selected {
    background: #f0fdf4;
}

.te-autocomplete-favorite {
    font-weight: 600;
}

.te-favorites-section {
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}

.te-favorites-label {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-bottom: 6px;
}

.te-favorites-bubbles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.te-favorite-bubble {
    padding: 3px 10px;
    background: #e0f2e9;
    color: #166534;
    border-radius: 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    font-weight: 500;
}

.te-favorite-bubble:hover {
    background: #bbf7d0;
}

.te-autocomplete-no-results {
    padding: 12px;
    color: #94a3b8;
    text-align: center;
    font-size: 0.82rem;
}

/* Responsive */
@media (max-width: 768px) {
    .time-editor-filter {
        flex-direction: column;
        align-items: stretch;
    }

    .te-stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .te-day-stats {
        flex-direction: column;
        gap: 4px;
        font-size: 0.75rem;
    }

    .te-entry-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .te-entry-time,
    .te-entry-project {
        min-width: auto;
    }

    .te-description-timer-sections {
        grid-template-columns: 1fr;
    }
}
