/* ===== Ported verbatim from the original uu.dakservice.ru style.css ===== */

html {
    font-size: 16px;
}

body {
    background-color: #2c3e50;
    color: #ecf0f1;
    font-family: Arial, sans-serif;
    text-align: center;
    margin: 0;
    padding: 0;
}

h1 {
   font-size:20px;
}

h2 {
   font-size:20px;
}

.button {
    background-color: #3498db;
    color: #ecf0f1;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
}

.button:hover {
    background-color: #2980b9;
}

main {
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 300px;
    margin: 30px auto;
    padding: 15px;
    background-color: #34495e;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.input-field {
    padding: 10px 8px;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    background-color: #ecf0f1;
    font-size: 16px; /* iOS Safari zooms in on focus if an input's font-size is under 16px */
    color: #2c3e50;
    width: 100%;
    box-sizing: border-box;
}

.input-field:focus {
    border-color: #3498db;
    outline: none;
}

.login-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 16px;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.login-button:hover {
    background-color: #2980b9;
}

.error {
    color: #e74c3c;
    font-size: 12px;
    margin-bottom: 8px;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #34495e;
    padding: 10px 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.nav-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.nav-buttons button,
.nav-buttons a {
    background-color: #3498db;
    color: #ecf0f1;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s;
    text-decoration: none;
    display: inline-block;
    font-size: 0.9rem;
}

.nav-buttons button:hover,
.nav-buttons a:hover {
    background-color: #2980b9;
}

.nav-buttons a.active {
    background-color: #1abc9c;
}

.nav-buttons a.active:hover {
    background-color: #16a085;
}

.logout-button {
    background-color: #e74c3c;
    color: white;
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.3s;
    font-size: 14px;
}

.logout-button:hover {
    background-color: #c0392b;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Контейнер таблицы */
.table-container {
    flex-grow: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #2c3e50;
    position: relative;
    background-color: #34495e;
    border-radius: 8px;
    margin: 0 20px 20px;
}

/* Таблица */
table {
    width: 100%;
    border-collapse: collapse;
    background-color: #34495e;
    color: #ecf0f1;
    font-size: 12px;
    table-layout: auto;
}

/* Фиксированный заголовок */
thead {
    position: sticky;
    top: 0;
    background-color: #1abc9c;
    z-index: 100;
}

thead th {
    padding: 8px;
    text-align: center;
    font-weight: bold;
    border-bottom: 2px solid #16a085;
    white-space: nowrap;
}

tbody td {
    padding: 6px;
    border-bottom: 1px solid #2c3e50;
    text-align: center;
    white-space: nowrap;
}

td:first-child, th:first-child {
    position: sticky;
    left: 0;
    background-color: #1abc9c;
    font-weight: bold;
    z-index: 101;
}

/* Стили для формы */
.form-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    gap: 16px;
}

.form-table {
    display: table;
    border-spacing: 10px;
    background-color: #34495e;
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    margin: 0 auto;
}

.form-header, .form-row {
    display: table-row;
}

.form-label, .form-input {
    display: table-cell;
    padding: 5px;
    text-align: center;
    vertical-align: middle;
}

.form-label {
    font-weight: bold;
    color: #ecf0f1;
    padding-bottom: 10px;
}

.form-input input,
.form-input select,
.form-input textarea {
    width: 100%;
    padding: 5px;
    border: 1px solid #16a085;
    border-radius: 5px;
    background-color: #2c3e50;
    color: #ecf0f1;
    text-align: center;
    font-family: inherit;
    box-sizing: border-box;
}

.button-danger {
    background-color: #e74c3c;
}

.button-danger:hover {
    background-color: #c0392b;
}

.checkbox-container {
    margin-bottom: 10px;
    padding: 8px 14px;
}

.checkbox-container label {
    font-size: 11px;
    margin-right: 10px;
    cursor: pointer;
}

.checkbox-container input {
    cursor: pointer;
    transform: scale(0.8);
}

.hidden {
    display: none;
}

.button-container {
    display: flex;
    margin: 30px auto;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.month {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    text-decoration: none;
    color: #ecf0f1;
    background: #3498db;
    border: none;
    border-radius: 5px;
    font-size: 13px;
    font-weight: 500;
    flex: 0 0 160px;
    box-shadow: 2px 5px 10px rgba(0, 0, 0, 0.3);
    transition: opacity 150ms linear;
}

.month:hover {
    opacity: 0.85;
}

.month.current {
    background: #1abc9c;
}

.year-label {
    color: #bdc3c7;
    font-size: 0.9rem;
    margin: 24px 0 0;
}

/* ===== Mobile: real phones need bigger touch targets and readable text, ===== */
/* ===== not the original's shrink-everything-to-10px approach.          ===== */

@media (max-width: 740px) {
    main { padding: 12px; }
    table { font-size: 12px; }
    thead th, tbody td { padding: 8px 6px; }

    .header-container {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo logout"
            "user user"
            "nav nav";
        row-gap: 8px;
        padding: 10px 12px;
    }
    .logo { grid-area: logo; }
    /* unwrap .header-right so its two children become individually
       placeable grid items instead of fighting for space inside it */
    .header-right {
        display: contents;
    }
    .nav-user {
        grid-area: user;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    .logout-button {
        grid-area: logout;
    }
    .nav-buttons {
        grid-area: nav;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        margin: 0 -12px;
        padding-left: 12px;
        padding-right: 12px;
    }
    .nav-buttons a, .nav-buttons button {
        flex: 0 0 auto;
    }

    .table-container {
        margin: 0 12px 12px;
        -webkit-overflow-scrolling: touch;
    }

    fieldset {
        grid-template-columns: 1fr;
    }

    .checkbox-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    /* position:sticky on a table cell combined with auto table-layout
       triggers a WebKit/mobile-Safari bug that blows the first column's
       width up to most of the viewport. Not worth it on a narrow phone
       screen anyway — just let it scroll like every other column. */
    td:first-child, th:first-child {
        position: static;
    }
}

@media (max-width: 480px) {
    .login-container { max-width: 100%; margin: 0; min-height: 100vh; border-radius: 0; display: flex; flex-direction: column; justify-content: center; }
    .nav-user { font-size: 0.8rem; }
}

/* ===== Additions for the new dakservice-orders app (statuses, admin UI, ===== */
/* ===== computed fields, role-permission checkboxes) — same palette,   ===== */
/* ===== new elements the original site never had.                     ===== */

* { box-sizing: border-box; }

a { color: #3498db; }

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 1.1rem;
    color: #ecf0f1;
    text-decoration: none;
    white-space: nowrap;
}

.logo img {
    height: 32px;
    width: 32px;
}

.nav-user {
    color: #ecf0f1;
    font-size: 0.9rem;
    font-weight: bold;
}

.count {
    color: #bdc3c7;
    font-weight: 400;
    font-size: 1rem;
}

.admin-subnav {
    margin: 20px 20px 24px;
    display: flex;
    justify-content: center;
}

.lookup-tabs {
    margin: 0 20px 20px;
    justify-content: center;
}

@media (max-width: 740px) {
    .admin-subnav, .lookup-tabs {
        margin-left: 0;
        margin-right: 0;
        justify-content: flex-start;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        padding: 0 12px 4px;
    }
    .admin-subnav a, .lookup-tabs a {
        flex: 0 0 auto;
    }
}

.table-scroll {
    overflow-x: auto;
}

.orders-table td.num {
    text-align: right;
}

.orders-table tfoot td {
    font-weight: bold;
    background-color: #2c3e50;
}

.orders-table .empty {
    text-align: center;
    color: #bdc3c7;
    padding: 24px;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: bold;
    background: #2c3e50;
    color: #ecf0f1;
}

.status-в-работе { background: #3498db; }
.status-архив { background: #7f8c8d; }
.status-планируемый { background: #f39c12; }
.status-не-подтвержден { background: #e74c3c; }
.status-работы-выполнены { background: #1abc9c; }

.btn {
    display: inline-block;
    background-color: #3498db;
    color: #ecf0f1;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.8rem;
}

.btn-danger {
    background-color: #e74c3c;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.checkbox-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    text-align: left;
}

.checkbox-label input {
    width: auto;
    cursor: pointer;
}

.field-hint {
    grid-column: 1 / -1;
    color: #bdc3c7;
    font-size: 0.8rem;
    margin: 8px 0 0;
    text-align: left;
}

.field-note {
    color: #95a5a6;
    font-size: 0.7rem;
    font-weight: normal;
    display: block;
}

.select-all-fields {
    grid-column: 1 / -1;
    border-bottom: 1px solid #2c3e50;
    padding-bottom: 10px;
    margin-bottom: 4px;
}

output.computed {
    display: block;
    padding: 5px;
    border-radius: 5px;
    background-color: #2c3e50;
    border: 1px dashed #16a085;
    color: #ecf0f1;
}

.computed-empty {
    color: #95a5a6;
    font-style: italic;
    font-size: 0.85em;
}

/* fieldset-based sections in order_edit.php get the .form-table treatment
   (dark card, rounded corners) since our form has more fields than the
   original's single-row layout can hold, grouped by category instead */
fieldset {
    background-color: #34495e;
    padding: 15px;
    border-radius: 10px;
    border: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    text-align: left;
    max-width: 900px;
    margin: 0 auto;
}

legend {
    padding: 0 8px;
    font-weight: bold;
    color: #1abc9c;
    font-size: 0.85rem;
}

fieldset label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.85rem;
    color: #ecf0f1;
    font-weight: bold;
}

fieldset input,
fieldset select,
fieldset textarea {
    width: 100%;
    padding: 8px 5px;
    border: 1px solid #16a085;
    border-radius: 5px;
    background-color: #2c3e50;
    color: #ecf0f1;
    text-align: center;
    font-family: inherit;
    font-weight: normal;
    font-size: 16px; /* prevents iOS Safari auto-zoom on focus */
    box-sizing: border-box;
}

fieldset input:focus,
fieldset select:focus,
fieldset textarea:focus {
    border-color: #3498db;
    outline: none;
}

.form {
    background-color: #34495e;
    border-radius: 10px;
    padding: 20px;
    max-width: 420px;
    margin: 20px auto;
    text-align: left;
}

.form label {
    display: block;
    margin-bottom: 12px;
    font-weight: bold;
    font-size: 0.85rem;
}

.form input,
.form select,
.form textarea {
    width: 100%;
    padding: 10px 8px;
    border: 1px solid #16a085;
    border-radius: 5px;
    background-color: #2c3e50;
    color: #ecf0f1;
    font-family: inherit;
    font-weight: normal;
    font-size: 16px; /* prevents iOS Safari auto-zoom on focus */
    margin-top: 6px;
    box-sizing: border-box;
}

.alert {
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    margin: 12px 20px;
}

.alert-error {
    background-color: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.alert-success {
    background-color: rgba(26, 188, 156, 0.15);
    color: #1abc9c;
}

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container img.login-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
}

.login-container h2 {
    margin: 0 0 20px;
    font-size: 14px;
    color: #bdc3c7;
    font-weight: normal;
}

.day-special {
    background-color: rgba(241, 196, 15, 0.35) !important;
}

.hours-input {
    width: 44px;
    padding: 4px 2px;
    text-align: center;
    background-color: #2c3e50;
    color: #ecf0f1;
    border: 1px solid #16a085;
    border-radius: 4px;
    font-size: 12px;
}

.hours-input:disabled {
    opacity: 0.6;
}

.employee-total-row td {
    font-weight: bold;
    background-color: #2c3e50;
}

.timesheet-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    justify-content: center;
    margin: 0 20px 20px;
}

.timesheet-toolbar .form {
    margin: 0;
}

.site-footer {
    padding: 20px 0;
    color: #7f8c8d;
    font-size: 0.85rem;
}
