﻿/* 3. Společné komponenty (Tlačítka, Formuláře, Upozornění) */
.btn-submit {
    width: 100%;
    padding: 12px;
    background-color: var(--color-brand);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
    display: inline-block;
    text-align: center;
}

.btn-submit:hover {
    background-color: var(--color-brand-hover);
}

/* Odsazení mezi tlačítky v buňce */
.actions-cell {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--color-text-secondary);
    font-size: 14px;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--color-border-input-alt);
    border-radius: 4px;
    font-size: 16px;
    background-color: var(--color-bg-input);
    color: var(--color-text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus-visible, .form-group select:focus-visible, .form-group textarea:focus-visible {
    border-color: var(--color-link);
    box-shadow: 0 0 0 3px var(--color-focus-ring-shadow);
    outline: none;
}

/* Upozornění (Chyby / Úspěch) */
.alert-error {
    background-color: var(--color-alert-error-bg);
    color: var(--color-alert-error-text);
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid var(--color-alert-error-border);
    text-align: left;
}

.alert-success {
    background-color: var(--color-alert-success-bg);
    color: var(--color-alert-success-text);
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid var(--color-alert-success-border);
    text-align: left;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.alert-success.alert-success-dismissing {
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
}

/* Vlastní dialogová okna (AppDialog) */
body.app-dialog-open {
    overflow: hidden;
}
.app-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--color-overlay);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.app-dialog-overlay.is-open {
    opacity: 1;
    visibility: visible;
}
.app-dialog {
    width: min(100%, 420px);
    background: var(--color-bg-surface);
    border-radius: 12px;
    box-shadow: 0 20px 50px var(--color-shadow-card);
    padding: 24px 24px 20px;
    display: grid;
    grid-template-columns: 52px 1fr;
    gap: 0 16px;
    transform: translateY(8px) scale(0.98);
    transition: transform 0.2s ease;
}
.app-dialog-overlay.is-open .app-dialog {
    transform: translateY(0) scale(1);
}
.app-dialog__icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.app-dialog__icon svg {
    width: 28px;
    height: 28px;
}
.app-dialog__icon--info {
    background: #e8f4fd;
    color: #2980b9;
}
.app-dialog__icon--confirm {
    background: #fef3e7;
    color: #e67e22;
}
.app-dialog__icon--danger {
    background: #fdecea;
    color: #c0392b;
}
.app-dialog__icon--error {
    background: #fdecea;
    color: #c0392b;
}
.app-dialog__body {
    min-width: 0;
}
.app-dialog__title {
    margin: 4px 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-heading);
    line-height: 1.3;
}
.app-dialog__message {
    margin: 0;
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.55;
    white-space: pre-wrap;
}
.app-dialog__input-wrap {
    margin-top: 14px;
}
.app-dialog__input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border-input);
    border-radius: 6px;
    font-size: 14px;
    background-color: var(--color-bg-input);
    color: var(--color-text-heading);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.app-dialog__input:focus-visible {
    outline: none;
    border-color: var(--color-link);
    box-shadow: 0 0 0 3px var(--color-focus-ring-shadow);
}
.app-dialog__input.is-invalid {
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}
.app-dialog__input-error {
    margin: 6px 0 0;
    font-size: 12px;
    color: #c0392b;
}
.app-dialog__actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border-separator);
}
.app-dialog__btn {
    min-width: 96px;
    padding: 9px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.app-dialog__btn--primary {
    background: #e67e22;
    color: #fff;
    border-color: #e67e22;
}
.app-dialog__btn--primary:hover {
    background: #d35400;
    border-color: #d35400;
}
.app-dialog__btn--secondary {
    background: var(--color-bg-surface);
    color: var(--color-text-muted);
    border-color: var(--color-border-input);
}
.app-dialog__btn--secondary:hover {
    background: var(--color-bg-surface-muted);
    border-color: var(--color-text-muted);
}
.app-dialog__btn--danger {
    background: #c0392b;
    color: #fff;
    border-color: #c0392b;
}
.app-dialog__btn--danger:hover {
    background: #a93226;
    border-color: #a93226;
}
@media (max-width: 480px) {
    .app-dialog {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .app-dialog__icon {
        margin: 0 auto;
    }
    .app-dialog__actions {
        flex-direction: column-reverse;
    }
    .app-dialog__btn {
        width: 100%;
    }
}

/* 4. Legacy přihlášení odstraněno – používá se .login-page-wrapper */

/* 5. Layout pro vnitřek aplikace (Nástěnka, Adresář atd.) */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Širší layout pro datově náročný přehled servisních úkonů */
.container--service-events {
    max-width: min(1680px, calc(100vw - 32px));
}

.container--service-events .description-cell {
    max-width: none;
    min-width: 0;
    width: 100%;
}

.container--service-events .material-cell {
    max-width: none;
    min-width: 0;
}

/* Responzivní tabulky (Zabrání přetečení na mobilech) */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-bg-surface);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-table);
}

th {
    background-color: var(--color-bg-table-head);
    color: var(--color-text-on-dark);
}

tr:hover {
    background-color: var(--color-bg-hover);
}

/* Styly pro vnitřní rozvržení aplikace (Header & Dashboard) */
.main-header {
    position: fixed;            /* Přišpendlí hlavičku trvale navrch okna */
    top: 0;
    left: 0;
    width: 100%;                /* Roztáhne lištu na celou šířku obrazovky */
    z-index: 9999;              /* Zajistí plavání nad veškerým obsahem */
    background-color: var(--color-bg-surface);
    box-shadow: 0 2px 4px var(--color-shadow-sm);
    padding: 10px 20px;
    margin-bottom: 0;           /* Odsazení vyřešeno pomocí padding-top u body */
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 40px; /* Kompaktní velikost loga v liště */
    width: auto;
}

.header-brand span {
    font-size: 18px;
    font-weight: bold;
    color: var(--color-text-heading);
}

.header-datetime {
    font-size: 14px;
    color: var(--color-text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-align: center;
    flex: 1 1 auto;
    padding: 0 12px;
}

.header-datetime time {
    font-weight: 500;
    color: var(--color-text-primary);
}

.header-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--color-text-primary);
}

.header-profile-link {
    color: inherit;
    text-decoration: none;
}

.header-profile-link:hover strong {
    color: #2980b9;
    text-decoration: underline;
}

.header-changelog-btn {
    padding: 6px 12px;
    border: 1px solid var(--color-border-input);
    border-radius: 6px;
    background: var(--color-bg-surface);
    color: var(--color-text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.header-changelog-btn:hover {
    background: var(--color-bg-surface-muted);
    border-color: var(--color-link);
    color: var(--color-link);
}

.header-changelog-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-focus-ring-shadow);
}

body.changelog-dialog-open {
    overflow: hidden;
}

.changelog-dialog-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--color-overlay);
    backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.changelog-dialog-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.changelog-dialog {
    width: min(100%, 560px);
    max-height: min(85vh, 720px);
    background: var(--color-bg-surface);
    border-radius: 12px;
    box-shadow: 0 20px 50px var(--color-shadow-card);
    display: flex;
    flex-direction: column;
    transform: translateY(8px) scale(0.98);
    transition: transform 0.2s ease;
}

.changelog-dialog-overlay.is-open .changelog-dialog {
    transform: translateY(0) scale(1);
}

.changelog-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 20px 12px;
    border-bottom: 1px solid var(--color-border-separator);
}

.changelog-dialog__title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text-heading);
}

.changelog-dialog__close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.changelog-dialog__close:hover {
    background: var(--color-bg-surface-muted);
    color: var(--color-text-heading);
}

.changelog-dialog__content {
    padding: 8px 20px 16px;
    overflow-y: auto;
}

.changelog-dialog__empty {
    margin: 12px 0 0;
    color: var(--color-text-muted);
    font-size: 14px;
}

.changelog-entry + .changelog-entry {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border-separator);
}

.changelog-entry__header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.changelog-entry__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text-heading);
}

.changelog-entry__date {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.changelog-entry__list {
    margin: 0;
    padding-left: 1.2em;
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1.55;
}

.changelog-entry__list li + li {
    margin-top: 6px;
}

.changelog-dialog__footer {
    padding: 12px 20px 20px;
    border-top: 1px solid var(--color-border-separator);
    display: flex;
    justify-content: flex-end;
}

.profile-summary {
    margin-bottom: 20px;
}

.profile-details {
    display: grid;
    grid-template-columns: minmax(140px, auto) 1fr;
    gap: 8px 20px;
    margin: 0;
}

.profile-details dt {
    font-weight: 600;
    color: var(--color-text-muted);
}

.profile-details dd {
    margin: 0;
}

.profile-absence-empty {
    margin: 0;
    color: var(--color-text-muted);
}

.profile-absence-hint {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.profile-absence-table {
    margin-top: 4px;
}

.profile-absence-table__remaining {
    color: var(--color-alert-success-text);
    font-weight: 600;
}

.profile-preset-intro {
    margin: 0 0 16px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.profile-preset-module + .profile-preset-module {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.profile-preset-module__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.profile-preset-module__header h3 {
    margin: 0;
    font-size: 17px;
}

.profile-preset-add-link {
    text-decoration: none;
    font-size: 13px;
    padding: 8px 12px;
}

.profile-preset-empty {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 14px;
}

.profile-preset-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-preset-list__item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-bg-surface);
}

.profile-preset-list__main {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.profile-preset-list__summary {
    font-size: 12px;
    color: var(--color-text-muted);
}

.profile-preset-list__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-preset-editor {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.profile-preset-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.profile-preset-custom-dates {
    display: none;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.profile-preset-custom-dates.is-open {
    display: grid;
}

@media (max-width: 768px) {
    .profile-preset-fields,
    .profile-preset-custom-dates.is-open {
        grid-template-columns: 1fr;
    }
}

.logout-form {
    display: inline;
    margin: 0;
}

.btn-logout {
    background-color: #e74c3c;
    color: white !important;
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 13px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    line-height: inherit;
}

.btn-logout:hover {
    background-color: #c0392b;
}

.welcome-section {
    margin-bottom: 30px;
}

/* Mřížka pro dlaždice nástěnky */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dash-card {
    background: var(--color-bg-surface);
    padding: 30px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--color-shadow-sm);
    text-align: center;
    border-top: 4px solid #e67e22; /* Oranžová linka z loga */
    transition: transform 0.2s, box-shadow 0.2s;
    color: var(--color-text-primary) !important;
}

.dash-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px var(--color-shadow-md);
}

.card-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.dash-card h3 {
    margin-bottom: 10px;
    color: var(--color-text-heading);
}

.dash-card p {
    font-size: 14px;
    color: var(--color-text-secondary);
}

.dash-card--disabled {
    cursor: default;
    opacity: 0.65;
    pointer-events: none;
    border-style: dashed;
}

.desc-content {
    white-space: normal !important;
    word-break: break-word !important;
    min-width: 0;
}

/* ==========================================================================
   MODERNIZACE FILTRU PRACOVNÍKŮ (.header-worker-filter)
   ========================================================================== */

.header-worker-filter {
    /* Skrytí nativní hnusné šipky prohlížeče */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    
    /* Elegantní moderní vzhled */
    background-color: var(--color-bg-input);
    /* Vlastní stylová šipka přes SVG */
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    
    border: 1px solid var(--color-border-input);
    border-radius: 8px;
    padding: 10px 42px 10px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-strong);
    cursor: pointer;
    min-width: 240px;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.07);
    transition: all 0.2s ease-in-out;
    outline: none;
}

/* Stav při najetí myší */
.header-worker-filter:hover {
    border-color: var(--color-text-muted);
    background-color: var(--color-bg-surface-muted);
}

/* Stav při aktivaci klávesnicí */
.header-worker-filter:focus-visible {
    border-color: var(--color-link);
    background-color: var(--color-bg-input);
    box-shadow: 0 0 0 3px var(--color-focus-ring-shadow), 0 1px 3px 0 rgba(0, 0, 0, 0.07);
    outline: none;
}

/* Stylování možností uvnitř seznamu (podpora se liší dle prohlížeče, ale moderní Chrome/Edge/Firefox to uhladí) */
.header-worker-filter option {
    padding: 12px;
    background-color: var(--color-bg-surface);
    color: var(--color-text-strong);
    font-size: 14px;
}

/* Stylování pro první/výchozí možnost, aby vypadala jako placeholder */
.header-worker-filter option[value="all"] {
    font-weight: bold;
    color: #475569;
    border-bottom: 1px solid #e2e8f0;
}

/* Postupné načítání přehledů (servisní úkony, materiál) */
html.servis-page-nav-loading::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 10001;
    background: linear-gradient(90deg, transparent, var(--color-brand, #2563eb), transparent);
    background-size: 200% 100%;
    animation: list-page-progress-slide 1.1s ease-in-out infinite;
}

body.has-list-page-loading .list-page-content--pending {
    visibility: hidden;
    min-height: 120px;
}

.list-page-loading {
    margin: 16px 0 24px;
    padding: 20px 16px;
    border-radius: 8px;
    background: var(--color-bg-surface, #fff);
    border: 1px solid var(--color-border, #e2e8f0);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.list-page-loading__progress {
    height: 6px;
    border-radius: 999px;
    background: var(--color-bg-muted, #e2e8f0);
    overflow: hidden;
    margin-bottom: 12px;
}

.list-page-loading__progress-bar {
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--color-brand, #2563eb), #60a5fa);
    animation: list-page-progress-slide 1.2s ease-in-out infinite;
}

.list-page-loading__text {
    margin: 0;
    text-align: center;
    color: var(--color-text-secondary, #64748b);
    font-size: 14px;
}

@keyframes list-page-progress-slide {
    0% {
        transform: translateX(-120%);
    }
    100% {
        transform: translateX(320%);
    }
}

