/* ==========================================================================
   Nejmont ERP – vlastní styly (žádné inline CSS v šablonách)
   Barevné schéma: červená #fe0202, tmavě šedá #333333, světlá #f9f9f9
   ========================================================================== */

:root {
    --nejmont-red: #fe0202;
    --nejmont-red-dark: #c40000;
    --nejmont-dark: #333333;
    --nejmont-dark-2: #2a2a2a;
    --nejmont-light: #f9f9f9;
    --sidebar-width: 250px;
    --topbar-height: 60px;

    /* Přebití barev Bootstrapu (style.css se načítá až po bootstrap.min.css) */
    --bs-primary: #fe0202;
    --bs-primary-rgb: 254, 2, 2;
    --bs-dark: #333333;
    --bs-dark-rgb: 51, 51, 51;
    --bs-link-color: #fe0202;
    --bs-link-color-rgb: 254, 2, 2;
    --bs-link-hover-color: #c40000;
    --bs-link-hover-color-rgb: 196, 0, 0;
}

html,
body {
    min-height: 100vh;
}

body {
    background-color: var(--nejmont-light);
}

/* --------------------------------------------------------------------------
   Komponenty Bootstrapu v barvách Nejmont
   -------------------------------------------------------------------------- */
.btn-primary {
    --bs-btn-bg: var(--nejmont-red);
    --bs-btn-border-color: var(--nejmont-red);
    --bs-btn-hover-bg: var(--nejmont-red-dark);
    --bs-btn-hover-border-color: var(--nejmont-red-dark);
    --bs-btn-active-bg: var(--nejmont-red-dark);
    --bs-btn-active-border-color: var(--nejmont-red-dark);
    --bs-btn-disabled-bg: var(--nejmont-red);
    --bs-btn-disabled-border-color: var(--nejmont-red);
    --bs-btn-focus-shadow-rgb: 254, 2, 2;
}

.btn-outline-primary {
    --bs-btn-color: var(--nejmont-red);
    --bs-btn-border-color: var(--nejmont-red);
    --bs-btn-hover-bg: var(--nejmont-red);
    --bs-btn-hover-border-color: var(--nejmont-red);
    --bs-btn-active-bg: var(--nejmont-red);
    --bs-btn-active-border-color: var(--nejmont-red);
    --bs-btn-focus-shadow-rgb: 254, 2, 2;
}

.page-link {
    --bs-pagination-color: var(--nejmont-red);
    --bs-pagination-hover-color: var(--nejmont-red-dark);
    --bs-pagination-focus-color: var(--nejmont-red-dark);
    --bs-pagination-active-bg: var(--nejmont-red);
    --bs-pagination-active-border-color: var(--nejmont-red);
    --bs-pagination-focus-box-shadow: 0 0 0 0.25rem rgba(254, 2, 2, 0.25);
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus {
    border-color: #fe6b6b;
    box-shadow: 0 0 0 0.25rem rgba(254, 2, 2, 0.2);
}

.form-check-input:checked {
    background-color: var(--nejmont-red);
    border-color: var(--nejmont-red);
}

/* --------------------------------------------------------------------------
   Rozložení: topbar + sidebar + obsah
   -------------------------------------------------------------------------- */
.app-topbar {
    background-color: #ffffff;
    border-bottom: 1px solid #e3e8ef;
    height: var(--topbar-height);
}

.brand-logo {
    height: 38px;
    width: auto;
}

.app-shell {
    display: flex;
    align-items: stretch;
}

.app-sidebar {
    width: var(--sidebar-width);
    /* !important přebíjí Bootstrap, který .offcanvas-lg na desktopu nastavuje
       na background-color: transparent !important (jinak sidebar splývá s pozadím) */
    background-color: var(--nejmont-dark) !important;
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: var(--topbar-height);
        height: calc(100vh - var(--topbar-height));
        overflow-y: auto;
    }
}

.app-content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 1.5rem;
}

/* --------------------------------------------------------------------------
   Sidebar navigace (tmavá)
   -------------------------------------------------------------------------- */
.sidebar-nav {
    padding: 1rem 0.75rem;
}

.sidebar-heading {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #a8a8a8;
    padding: 0.75rem 0.75rem 0.25rem;
    margin-top: 0.5rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: #cfcfcf;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.94rem;
    font-weight: 500;
}

.sidebar-nav .nav-link .bi {
    font-size: 1.05rem;
    color: #9a9a9a;
    width: 1.2rem;
    text-align: center;
}

.sidebar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-nav .nav-link:hover .bi {
    color: #ffffff;
}

.sidebar-nav .nav-link.active {
    background-color: var(--nejmont-red);
    color: #ffffff;
}

.sidebar-nav .nav-link.active .bi {
    color: #ffffff;
}

/* --------------------------------------------------------------------------
   Page header
   -------------------------------------------------------------------------- */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--nejmont-dark);
    margin: 0;
}

.page-header .breadcrumb {
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   Karty
   -------------------------------------------------------------------------- */
.card {
    border: 1px solid #e3e8ef;
    border-radius: 0.75rem;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.card-header {
    background-color: #fbfcfe;
    border-bottom: 1px solid #e3e8ef;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Statistické dlaždice na dashboardu
   -------------------------------------------------------------------------- */
.stat-card {
    display: block;
    color: inherit;
    text-decoration: none;
    height: 100%;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.15);
}

.stat-card .stat-icon {
    font-size: 1.75rem;
    opacity: 0.85;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.85;
}

/* --------------------------------------------------------------------------
   Tabulky
   -------------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
}

.table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6b7688;
    white-space: nowrap;
}

.table td,
.table th {
    vertical-align: middle;
}

.table-actions {
    white-space: nowrap;
    text-align: end;
}

.numeric {
    text-align: end;
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Formuláře
   -------------------------------------------------------------------------- */
.form-card {
    max-width: 920px;
}

.form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--nejmont-dark);
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 2px solid var(--nejmont-red);
}

.form-section-title:first-child {
    margin-top: 0;
}

.required-mark {
    color: var(--nejmont-red);
    margin-left: 0.15rem;
}

/* Rychlá tlačítka pod datovými poli (splatnost, vystavení…) */
.date-rychlo {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.4rem;
}

.field-error {
    font-size: 0.85rem;
    color: var(--nejmont-red);
    margin-top: 0.2rem;
}

.helptext {
    font-size: 0.82rem;
    color: #8a94a6;
}

/* Řádky položek (inline formsety dokladů) */
.polozky-table input,
.polozky-table select,
.polozky-table textarea {
    min-width: 6rem;
}

.polozky-table textarea {
    min-height: 38px;
}

.row-to-delete {
    opacity: 0.45;
}

/* --------------------------------------------------------------------------
   Stavové odznaky
   -------------------------------------------------------------------------- */
.badge {
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* --------------------------------------------------------------------------
   Detail – definiční seznam
   -------------------------------------------------------------------------- */
.detail-list {
    margin: 0;
}

.detail-list dt {
    color: #6b7688;
    font-weight: 500;
    font-size: 0.85rem;
}

.detail-list dd {
    margin-bottom: 0.85rem;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Prázdný stav
   -------------------------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #8a94a6;
}

.empty-state .bi {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
    opacity: 0.6;
}

/* --------------------------------------------------------------------------
   Přihlašovací stránka
   -------------------------------------------------------------------------- */
.login-card {
    width: 100%;
    max-width: 400px;
    border: none;
    border-radius: 0.75rem;
}

.login-logo {
    max-width: 230px;
    height: auto;
}

/* Honeypot – pole je v DOM kvůli botům, ale mimo viditelnou plochu.
   Nepoužíváme display:none, aby ho boti vyplnili (a tím se prozradili). */
.hp-wrap {
    position: absolute;
    left: -5000px;
    top: 0;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Tělo e-mailu
   -------------------------------------------------------------------------- */
.email-body {
    white-space: pre-wrap;
    word-break: break-word;
    background-color: #fbfcfe;
    border: 1px solid #e3e8ef;
    border-radius: 0.5rem;
    padding: 1rem;
    font-size: 0.92rem;
}

/* --------------------------------------------------------------------------
   Vyhledávací combobox (interaktivní výběr ve formuláři schůzky)
   -------------------------------------------------------------------------- */
.combo {
    position: relative;
}

.combo-native-hidden {
    display: none !important;
}

.combo-menu {
    position: absolute;
    z-index: 1050;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    max-height: 260px;
    overflow-y: auto;
    background-color: #ffffff;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    box-shadow: 0 6px 16px rgba(16, 24, 40, 0.12);
    display: none;
}

.combo-menu.show {
    display: block;
}

.combo-option {
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    font-size: 0.94rem;
}

.combo-option.selected {
    font-weight: 600;
}

.combo-option:hover,
.combo-option.active {
    background-color: var(--nejmont-red);
    color: #ffffff;
}

.combo-empty {
    padding: 0.5rem 0.75rem;
    color: #8a94a6;
    font-size: 0.9rem;
}

/* --------------------------------------------------------------------------
   Patička – dodavatel systému (PROBISON s.r.o.)
   -------------------------------------------------------------------------- */
.app-footer {
    background-color: #ffffff;
    border-top: 1px solid #e3e8ef;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    text-align: center;
    color: #6b7688;
    font-size: 0.85rem;
}

.footer-logo {
    height: 30px;
    width: auto;
}

.app-footer a {
    color: var(--nejmont-red);
    text-decoration: none;
    font-weight: 600;
}

.app-footer a:hover {
    text-decoration: underline;
}
