/* /var/www/stavebni-den/public/style.css */

/* --- Základní a globální styly --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f3f4f6;
    color: #1f2937;
}

/* --- Styly pro přihlašovací obrazovku --- */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-container {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 15px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 400px;
}

.login-container h2 {
    text-align: center;
    color: #1f2937;
    margin-bottom: 24px;
    font-weight: 600;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #4b5563;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #6b7280;
}

/*.btn-submit {
    width: 100%;
    background-color: #374151;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 500;
}*/

/*.btn-submit:hover {
    background-color: #1f2937;
}*/

#message {
    margin-top: 15px;
    text-align: center;
    font-size: 14px;
    display: none;
    padding: 10px;
    border-radius: 6px;
}

.msg-error {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid #f87171;
}

.msg-success {
    background-color: #d1fae5;
    color: #047857;
    border: 1px solid #34d399;
}

/* --- Styly pro Dashboard --- */
.dashboard-body {
    display: flex;
    min-height: 100vh;
}

/* Levý panel Menu */
.sidebar {
    width: 250px;
    background-color: #ffffff;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    /* NOVĚ PŘIDÁNO: Zafixování na obrazovce */
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

/* UPRAVENO: Tmavý rámeček pro název aplikace */
.sidebar-header {
    padding: 20px;
    font-size: 1.2rem;
    font-weight: bold;
    background-color: #374151;
    color: #ffffff;
    text-align: center;
}

.sidebar-menu {
    list-style: none;
    padding: 10px 0;
    flex-grow: 1;
}

.sidebar-menu li a {
    display: block;
    padding: 15px 20px;
    color: #4b5563;
    text-decoration: none;
    transition: background-color 0.2s, color 0.2s;
}

/* UPRAVENO: Tmavší šedá při najetí myší na položky menu */
.sidebar-menu li a:hover {
    background-color: #d1d5db;
    color: #111827;
    font-weight: 500;
}

/* Tlačítko odhlásit */
.logout-btn {
    display: block;
    padding: 15px 20px;
    text-align: center;
    background-color: #fee2e2;
    color: #b91c1c;
    text-decoration: none;
    border-top: 1px solid #e5e7eb;
    transition: background-color 0.2s, color 0.2s;
    font-weight: 500;
}

.logout-btn:hover {
    background-color: #fca5a5;
    color: #991b1b;
}

/* Hlavní obsah */
.main-content {
    flex-grow: 1;
    padding: 30px;
}

.card {
    background-color: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- Styly pro Tabulky --- */
.table-container {
    overflow-x: auto;
    margin-top: 15px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.data-table th {
    background-color: #f9fafb;
    color: #4b5563;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
}

.data-table tbody tr:hover {
    background-color: #f3f4f6;
}

/* VRÁCENO: Třída pro dashboard.php, aby se nerozbila Nástěnka */
.btn-dark {
    background-color: #4b5563;
    color: white;
    border: none;
    padding: 6px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    display: inline-block;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.btn-dark:hover {
    background-color: #374151;
}

.action-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    margin-right: 5px;
    transition: background-color 0.2s ease;
}

.btn-edit {
    background-color: #3188aa;
    color: #fcfdfd;
}

.btn-edit:hover {
    background-color: #256a85;
}

.btn-delete {
    background-color: #da5d59;
    color: #f8f5f5;
}

.btn-delete:hover {
    background-color: #b84a47;
}

.btn-deactivate {
    background-color: #f59e0b;
    color: white;
}

.btn-deactivate:hover {
    background-color: #d98c0a;
}

.btn-activate {
    background-color: #10b981;
    color: white;
}

.btn-activate:hover {
    background-color: #0d9668;
}

.btn-cancel {
    background-color: #f3f4f6;
    color: #4b5563;
    padding: 10px 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: background-color 0.2s, color 0.2s;
}

.btn-cancel:hover {
    background-color: #e5e7eb;
    color: #111827;
}

/* Tlačítko Otevřít detail pro action-btn v tabulkách */
.btn-detail {
    background-color: #45484e;
    color: #ffffff;
    text-decoration: none;
    display: inline-block;
}

.btn-detail:hover {
    background-color: #2d2f33;
}

/* Horní akční tlačítka (např. v detailu zakázky) */
.btn-outline {
    background: #ffffff;
    border: 1px solid #d1d5db;
    padding: 8px 15px;
    border-radius: 6px;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-outline:hover {
    background-color: #f3f4f6;
    border-color: #9ca3af;
}

/* --- Záložky (Tabs) --- */
.tabs {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: #111827;
    border-bottom: 2px solid #374151;
}

.tab-btn:hover:not(.active) {
    color: #374151;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* --- Modální okna (Formuláře) --- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 10px;
}

.close-modal {
    cursor: pointer;
    font-size: 1.5rem;
    color: #9ca3af;
    border: none;
    background: none;
}

.close-modal:hover {
    color: #111827;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.btn-primary {
    background-color: #374151;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-primary:hover {
    background-color: #1f2937;
}

/* --- Styly pro rozbalovací podsložky menu --- */
.submenu-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.submenu-toggle::after {
    content: '\25BC';
    font-size: 10px;
    transition: transform 0.3s;
}

.submenu-toggle.open::after {
    transform: rotate(-180deg);
}

.submenu {
    list-style: none;
    padding-left: 0;
    display: none;
    background-color: #f9fafb;
    border-y: 1px solid #e5e7eb;
}

.submenu.open {
    display: block;
}

.submenu li a {
    padding: 10px 20px 10px 40px;
    font-size: 14px;
    border-left: 3px solid transparent;
}

.submenu li a:hover {
    border-left: 3px solid #374151;
    background-color: #e5e7eb;
}

/* ========================================= */
/* NOVĚ PŘIDÁNO: SKRYTÍ ŠIPEK A ZAROVNÁNÍ    */
/* ========================================= */

/* Šipka pro rozbalovací menu Zakázky */
.submenu-toggle {
    cursor: pointer;
    display: flex !important;
    justify-content: space-between;
    align-items: center;
}

.submenu-toggle::after {
    content: '\25BC';
    /* Unicode znak pro šipku dolů */
    font-size: 10px;
    color: #6b7280;
    transition: transform 0.2s ease-in-out;
    /* Plynulá animace otočení */
    transform: rotate(-90deg);
    /* Základní stav: otočeno vodorovně (míří doprava) */
}

/* Když je menu otevřené, vrátíme šipku tak, aby mířila dolů */
.submenu-toggle.open::after {
    transform: rotate(0deg);
}

/* Skrytí šipek u číselných polí pro Množství a Cenu */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* Třída pro zarovnání Vystaveno a Splatnost zprava (přidej do HTML class="zarovnat-vpravo") */
/*.zarovnat-vpravo {
    text-align: right;
    display: block;
}*/

/* ========================================= */
/* STYLY PRO DETAIL ZAKÁZKY (project_detail.php) */
/* ========================================= */
/*.detail-header {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}*/

/*.project-meta {
    font-size: 14px;
    color: #6b7280;
    margin-top: 5px;
}*/

/*.total-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 6px;
    font-weight: bold;
    font-size: 14px;
}*/

/*.badge-red {
    background: #fee2e2;
    color: #991b1b;
}*/

/*.badge-green {
    background: #d1fae5;
    color: #065f46;
}*/

/*.badge-gray {
    background: #f3f4f6;
    color: #374151;
}*/

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.summary-card {
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    background: #fff;
    text-align: center;
}

.summary-card.cost {
    border-bottom: 4px solid #ef4444;
}

.summary-card.revenue {
    border-bottom: 4px solid #3b82f6;
}

.summary-card.profit {
    border-bottom: 4px solid #10b981;
}

.summary-title {
    font-size: 14px;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 28px;
    font-weight: bold;
    color: #111827;
}

.summary-sub {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 5px;
}

/* ========================================= */
/* STYLY PRO FAKTURU (invoice.php)           */
/* ========================================= */
.controls {
    background: #111827;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    max-width: 210mm;
    margin: 0 auto 20px auto;
}

.btn {
    padding: 10px 18px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
    font-size: 14px;
    display: inline-block;
}

.a4-paper {
    background: white;
    width: 210mm;
    min-height: 297mm;
    margin: 0 auto;
    padding: 15mm 20mm;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.inv-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 3px solid #111827;
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    margin-bottom: 40px;
    font-size: 14px;
}

.address-box h3 {
    font-size: 12px;
    text-transform: uppercase;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 10px;
}

/* Obecná editovatelná pole (průhledná, bez rámečku dokud nenajede myš) */
input.edit,
select.edit {
    border: 1px solid transparent;
    background: transparent;
    padding: 2px 0;
    margin: 0;
    border-radius: 4px;
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

input.edit:hover,
select.edit:hover {
    border-color: #d1d5db;
    background: #fff;
}

table.inv-items {
    width: 100%;
    border-collapse: collapse;
    margin-top: 30px;
}

table.inv-items th {
    background: #f8fafc;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #111827;
    font-size: 13px;
}

table.inv-items td {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
}

/* Třída proti zalamování textu (na ceny s Kč) */
.nowrap {
    white-space: nowrap;
}

@media print {

    .controls,
    .no-print {
        display: none !important;
    }

    .a4-paper {
        box-shadow: none;
        margin: 0;
        padding: 0;
    }

    input.edit,
    select.edit {
        border: none !important;
        background: none !important;
        appearance: none;
    }
}

/* ========================================= */
/* OPRAVA FAKTURY: ŠEDÝ BOX A LÍCOVÁNÍ       */
/* ========================================= */

/* CSS Grid zaručí, že to zůstane v 1 řádku a nezlomí se to jako předtím */
.info-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.5fr 1.5fr;
    /* Větší prostor pro účet a platbu */
    gap: 20px;
    background: #f8fafc;
    padding: 15px;
    border-radius: 6px;
    font-size: 14px;
    align-items: flex-start;
}

.panel-item {
    display: flex;
    flex-direction: column;
}

.panel-item strong {
    margin-bottom: 4px;
}

/* Tvrdý reset formulářových prvků na faktuře */
.hard-reset,
.select-platba {
    padding: 0 !important;
    margin: 0 !important;
    text-indent: 0 !important;
    background: transparent;
    border: 1px solid transparent;
    outline: none;
    font-family: inherit;
    font-size: inherit;
}

/* Trik na lícování: kompenzace vnitřního nevymazatelného okraje v prohlížeči */
.posun-doleva {
    margin-left: -4px !important;
}

.hard-reset:hover,
.select-platba:hover {
    border-color: #d1d5db;
    background: #fff;
}

/* Flexbox pro QR kód a sumu dole na faktuře */
.footer-grid {
    display: flex;
    align-items: flex-end;
    margin-top: 30px;
}

/* Toto zaručí, že součet bude VŽDY na pravé straně, nezávisle na QR kódu */
.footer-grid .totals {
    margin-left: auto;
    margin-top: 0;
    width: 280px;
    /* Šířka stejná jako původně */
    text-align: right;
}

/* ==========================================================================
   OPRAVA ZOBRAZENÍ FORMULÁŘŮ PRO FIREFOX A TISK (PDF)
   ========================================================================== */

/* 1. Skryje šipky u číselných polí (všude, nejen při tisku) */
input[type="number"] {
    -moz-appearance: textfield;
    /* Oprava pro Firefox */
    appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    /* Oprava pro Chrome/Safari/Edge */
    margin: 0;
}

/* 2. Pravidla specifická POUZE pro tisk (generování PDF) */
@media print {

    /* Skryje ikonu kalendáře u datumů */
    input[type="date"]::-webkit-calendar-picker-indicator {
        display: none !important;
    }

    /* Odebere nativní vzhled políček ve Firefoxu při tisku */
    input[type="date"],
    input[type="number"],
    input[type="text"] {
        -moz-appearance: none !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        background: transparent !important;
        box-shadow: none !important;
    }
}

/* ========================================= */
/* ROZVRŽENÍ TLAČÍTEK BEZ INLINE STYLŮ       */
/* ========================================= */

.header-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn-primary {
    flex: 2;
}

.modal-actions .btn-cancel {
    flex: 1;
}