/* Custom overrides and utility classes for Zeiterfassung (Tailwind) */

/* Inline-SVG-Icons (Phosphor, siehe includes/icons.php):
   Größe folgt der font-size des Elements (width/height: 1em),
   Farbe via currentColor. :where() hält die Spezifität bei 0,
   damit Tailwind-Utilities (z. B. md:hidden) nicht überschrieben werden. */
:where(.icon) {
    width: 1em;
    height: 1em;
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
}

/* Das HTML-Attribut hidden muss Utility-Klassen wie .flex schlagen
   (Save-Bar und Bulk-Leiste werden per JS über el.hidden gesteuert). */
[hidden] {
    display: none !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #eef0f2;
}
::-webkit-scrollbar-thumb {
    background: #d3d6da;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #a6adb6;
}

/* Row states for entries table */
tr.day-row.dirty td {
    background-color: #f6efdd !important; /* warning-container for dirty (unsaved) inputs */
}
tr.day-row.selected td {
    background-color: #dde5f7 !important; /* primary-container for selected bulk rows */
}
tr.day-row.row-error td {
    background-color: #f6e2e0 !important; /* error-container for validation errors */
}

/* Netto-Zelle nach Live-Neuberechnung: Vorschau-Zustand bis zum Speichern */
td.net-cell.net-preview {
    color: #a16207; /* warning, passend zur Dirty-Markierung */
    font-variant-numeric: tabular-nums;
}

/* Datums- & Zeitfelder: Das Tailwind-Forms-Plugin setzt appearance:none, wodurch
   v. a. Safari nur noch ein Textfeld ohne Auswahl zeigt. Native Eingabe (mit
   Browser-Validierung) wiederherstellen; die Auswahl übernimmt der .picker-btn. */
input[type="date"],
input[type="time"] {
    -webkit-appearance: auto;
    appearance: auto;
}
.picker-wrap input[type="date"]::-webkit-calendar-picker-indicator,
.picker-wrap input[type="time"]::-webkit-calendar-picker-indicator {
    display: none; /* eigener Button statt Browser-Icon (einheitlich in allen Browsern) */
}
.picker-btn {
    cursor: pointer;
    color: #6e7683; /* outline */
    font-size: 17px;
    line-height: 1;
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.picker-btn:hover {
    color: #1e40af; /* primary */
}
.picker-wrap:has(input:disabled) .picker-btn {
    opacity: 0.3;
    pointer-events: none;
}

/* Zahlen und Uhrzeiten laufen in Geist Mono */
.tabular-nums,
input[type="time"],
input[type="date"],
input[type="number"] {
    font-family: 'Geist Mono', ui-monospace, SFMono-Regular, monospace;
    font-variant-numeric: tabular-nums;
}

/* Aufklappliste für die Zeitauswahl (15-Minuten-Raster) */
.time-dropdown {
    position: fixed;
    z-index: 200;
    max-height: 224px;
    overflow-y: auto;
    background: #ffffff;
    border: 1px solid #dce0e4; /* outline-variant */
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(23, 25, 28, 0.12);
    padding: 4px;
    display: flex;
    flex-direction: column;
    min-width: 92px;
}
.time-dropdown button {
    padding: 4px 14px;
    border-radius: 6px;
    font-size: 13.5px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Geist Mono', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
}
.time-dropdown button:hover {
    background: #eef0f2; /* surface-container-low */
}
.time-dropdown button.selected {
    background: #1e40af; /* primary */
    color: #ffffff;
    font-weight: 600;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(23, 25, 28, 0.12), 0 4px 6px -2px rgba(23, 25, 28, 0.06);
    animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast-success {
    background-color: #1a7f4e; /* success */
}
.toast-error {
    background-color: #ba1a1a; /* error */
}
.toast-warn {
    background-color: #a16207; /* warning */
}

@keyframes toast-in {
    from {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .animate-pulse {
        animation: none !important;
    }
    .toast {
        animation: none !important;
    }
    * {
        transition-duration: 0.01ms !important;
    }
}

/* ArbZG-Badge: Kurztext per Klick aufklappen */
.arbzg-badge:focus .arbzg-short,
.arbzg-badge.expanded .arbzg-short {
    display: none;
}
.arbzg-badge:focus .arbzg-full,
.arbzg-badge.expanded .arbzg-full {
    display: inline;
}
