/*------------------------------------*\
  #GENERAL STYLING
\*------------------------------------*/

/* Body */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; /* Более современный шрифт */
    background-color: #1a1a1a; /* Очень темный фон */
    background-image: url('flowers3.jpg'); /* Убедитесь, что путь к изображению верный */
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center center;
    background-attachment: fixed; /* Фон не скроллится со страницей */
    color: #e0e0e0; /* Светло-серый текст для лучшей читаемости */
    margin: 0;
    padding: 0;
    line-height: 1.6; /* Улучшает читаемость длинных текстов */
}

/* Headings */
h1, h2 {
    color: black; /* Почти белый для заголовков, чтобы они выделялись на фоне */
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
    font-weight: 600; /* Немного жирнее */
}

h3 {
    color: black;
    text-align: center;
    margin-top: 30px;
    margin-bottom: 20px;
    font-weight: 600;
}

/* Links */
a {
    color: black; /* Свежий синий для ссылок */
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: peachpuff;
    text-decoration: underline;
}

/* Common Paragraph Style */
p {
    text-align: center;
    font-weight: normal; /* Обычный вес */
    color: #c0c0c0; /* Деликатный цвет */
    margin: 15px 0;
}


/*------------------------------------*\
  #NAVIGATION BAR
\*------------------------------------*/

nav {
    background-color: #222; /* Темнее навигация */
    color: white;
    padding: 15px 0; /* Больше padding */
    width: 100%;
    margin-bottom: 35px; /* Больше отступ под панелью */
    box-shadow: 0 3px 12px rgba(0,0,0,0.3); /* Более заметная тень */
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 25px; /* Больше padding по бокам */
}

.nav-brand {
    color: white; /* Яркий цвет для бренда */
    text-decoration: none;
    font-size: 1.8em; /* Крупнее */
    font-weight: 700; /* Очень жирный */
    letter-spacing: 1px;
    transition: color 0.3s;
}

.nav-brand:hover {
    color: peachpuff;
}

nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
}

nav ul li {
    margin-left: 35px; /* Больше расстояние между пунктами */
}

/* Ваши текущие стили для всех ссылок навигации */
nav ul li a {
    text-decoration: none;
    color: #3498db;
    font-weight: 600; /* Оставить, если другие ссылки не должны быть сильно жирными */
    padding: 8px 15px;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
    /* display: block; и text-align: center; могут быть применены здесь, если хотите,
       чтобы все ссылки были блочными и центрированными внутри своих li */
}

/* Стили для активной (текущей) ссылки */
nav ul li a.active {
    font-weight: bold; /* Сделать жирнее */
    background-color: #3498db; /* Пример: выделить активную ссылку фоном */
    color: #fff;
    display: block; /* Сделать блочным для text-align */
    text-align: center; /* Центрировать текст */
}

nav ul li a:hover {
    color: #ffb6c1; /* Светло-розовый при наведении */
    transform: translateY(-2px);
}

/* Active link underline */
nav ul li a.active::after {
    content: '';
    position: absolute;
    bottom: -5px; /* Немного ниже */
    left: 0;
    width: 100%;
    height: 3px; /* Толще подчеркивание */
    background-color: #ffb6c1;
    border-radius: 2px;
}

.nav-user {
    display: flex;
    align-items: center;
    font-size: 1em;
}

.nav-user span {
    margin-right: 20px;
    color: #e0e0e0;
}

.nav-user a {
    color: #ff8888; /* Более выразительный красный для Logout */
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
}

.nav-user a:hover {
    color: #ff4444;
    text-decoration: underline;
}


/*------------------------------------*\
  #FORM STYLES
\*------------------------------------*/

form {
    margin: 30px auto;
    padding: 30px;
    background-color: rgba(45, 45, 45, 0.9); /* Полупрозрачный темный фон для формы */
    border-radius: 12px; /* Более округлые углы */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4); /* Более выраженная, но мягкая тень */
    width: 90%;
    max-width: 650px; /* Немного шире */
    box-sizing: border-box; /* Важно для padding/width */
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #c0c0c0; /* Более светлый цвет для подписей */
}

input[type="text"],
input[type="password"],
input[type="number"], /* Добавил для tellimus_tukk */
input[type="datetime-local"], /* Добавил для tellimus_kuupaev */
select {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #666; /* Мягкие границы */
    border-radius: 6px;
    box-sizing: border-box;
    background-color: #3a3a3a; /* Темнее фон для полей ввода */
    color: #e0e0e0; /* Светлый текст */
    font-size: 1em;
    transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="datetime-local"]:focus,
select:focus {
    border-color: #61dafb; /* Цвет при фокусе */
    box-shadow: 0 0 8px rgba(97, 218, 251, 0.4); /* Мягкая тень при фокусе */
    outline: none; /* Убрать стандартное синее обрамление */
}

input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.1); /* Немного увеличить чекбоксы */
}


/* Общие стили для ВСЕХ кнопок.
   Эти свойства будут общими для .btn-base, input[type="submit"],
   .blue-button, .green-button, и #cancelbutton.
   Красные кнопки (.red-button) будут получать только часть этих свойств,
   а их специфические стили будут определены ниже.
*/
.btn-base,
input[type="submit"],
.blue-button,
.green-button,
.red-button,
#cancelbutton
{
    color: white; /* Цвет текста */
    border: none; /* Без рамки */
    padding: 12px 25px; /* Единые внутренние отступы */
    cursor: pointer; /* Курсор-указатель при наведении */
    border-radius: 6px; /* Скругленные углы */
    font-size: 1.1em; /* Единый размер шрифта */
    font-weight: bold; /* Жирный шрифт */
    transition: background-color 0.3s ease, transform 0.2s ease; /* Плавные переходы для фона и трансформации */
    margin: 2px; /* Внешние отступы между кнопками */
    text-decoration: none; /* Без подчеркивания для ссылок-кнопок */
    display: inline-block; /* Отображение как строчно-блочный элемент */
    text-align: center; /* Выравнивание текста по центру */
    white-space: nowrap; /* Запрет переноса текста внутри кнопки */
}

/* Красные кнопки (e.g., Delete Order, Delete Product)
   Эти кнопки имеют собственные, полностью определенные стили,
   не наследуя общие padding, font-size и т.д. от .btn-base
   (хотя в данном случае их значения совпадают, но это дает возможность их менять независимо).
   Они по-прежнему должны иметь класс .btn-base для общих эффектов перехода и т.д.
*/
.red-button {
    background-color: #dc3545; /* Красный цвет */
}

.red-button:hover {
    background-color: #c82333; /* Более темный красный при наведении */
    transform: translateY(-2px);
}

/* Синие кнопки (e.g., Cancel) */
.blue-button,
#cancelbutton {
    background-color: #007bff; /* Ярко-синий цвет */
}

.blue-button:hover,
#cancelbutton:hover {
    background-color: #0056b3; /* Более темный синий при наведении */
    transform: translateY(-2px);
}

/* Зеленые кнопки (e.g., Add New Order, Add Order, Edit Status/Date, Edit, Save) */
.green-button,
input[type="submit"] {
    background-color: #28a745; /* Зеленый цвет */
}

.green-button:hover,
input[type="submit"]:hover {
    background-color: #218838; /* Более темный зеленый при наведении */
    transform: translateY(-2px);
}

/* Специфические стили для #cancelbutton, если нужны дополнительные отступы, например. */
#cancelbutton {
    margin-left: 10px;
}


/*------------------------------------*\
  #TABLE STYLES
\*------------------------------------*/

table {
    width: 95%; /* Шире таблица */
    border-collapse: separate; /* Для border-radius на углах */
    border-spacing: 0; /* Убирает пробелы между ячейками */
    margin: 30px auto;
    background-color: #3a3a3a; /* Темный фон для таблицы */
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.4);
    border-radius: 12px;
    overflow: hidden; /* Важно для скругленных углов */
}

th, td {
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #5a5a5a; /* Более мягкие линии */
    color: #e0e0e0;
}


th {
    background-color: #007bff; /* Тот же синий, что и для кнопок */
    color: white;
    font-weight: bold;
    text-transform: uppercase; /* Заголовки таблицы заглавными буквами */
}

/* Table corner rounding */
th:first-child { border-top-left-radius: 12px; }
th:last-child { border-top-right-radius: 12px; }
tr:last-child td:first-child { border-bottom-left-radius: 12px; }
tr:last-child td:last-child { border-bottom-right-radius: 12px; }
tr:last-child td { border-bottom: none; } /* Remove bottom border from last row */

tr:hover {
    background-color: #4a4a4a; /* More noticeable darker color on hover */
    transition: background-color 0.2s ease;
}

td a {
    margin-right: 15px; /* More spacing */
    color: #61dafb; /* Blue for links in table */
}

/* Center content in specific table cells */
table td:has(.status-display), /* For cells with status */
table td:has(.date-display),   /* For cells with date */
table td:has(.name-display),   /* For cells with item name */
table td:has(.price-display),  /* For cells with item price */
table td:has(.description-display), /* For cells with item description */
table td:last-child {          /* For the "Action" button cell */
    text-align: center; /* Horizontal alignment to center */
}

td.align-right {
    text-align: right;
}

/*------------------------------------*\
  #INLINE EDITING STYLES
\*------------------------------------*/

/* Базовые стили для всех инлайн-полей ввода */
/* Эти свойства будут общими для всех полей при инлайн-редактировании. */
.status-input,
.date-input,
.name-input,
.price-input,
.description-input {
    border: 1px solid #ccc; /* Граница */
    border-radius: 4px; /* Скругление углов */
    font-size: 1em; /* Размер шрифта */
    box-sizing: border-box; /* Расчет размера с учетом padding и border */
    display: inline-block; /* Отображение как строчно-блочный элемент */
    margin: 0; /* Убираем внешние отступы */
    vertical-align: middle; /* Выравнивание по вертикали, чтобы они были на одной линии с текстом */
    text-align: center; /* Центрирование текста ВНУТРИ поля ввода */
    /* Эти элементы будут скрыты по умолчанию через JS до активации режима редактирования */
}

/* Индивидуальные настройки для каждого поля */

.status-input {
    padding: 5px; /* Внутренние отступы */
    max-width: 120px; /* Максимальная ширина для поля статуса */
    width: calc(100% - 10px); /* Занимает доступное пространство, но не больше max-width */
}

.date-input {
    padding: 6px 5px 4px 5px; /* Корректируем padding: 6px сверху, 4px снизу для лучшего вертикального выравнивания */
    max-width: 200px; /* Максимальная ширина для поля даты */
    width: calc(100% - 10px);
    height: 30px;
    /* line-height: 1.2em; /* Если одной настройки padding недостаточно, можно попробовать line-height */
}

.name-input {
    padding: 5px;
    max-width: 150px; /* Максимальная ширина для поля имени продукта */
    width: calc(100% - 10px);
    height: 30px;
}

.price-input {
    padding: 5px;
    max-width: 80px; /* Максимальная ширина для поля цены продукта */
    width: calc(100% - 10px);
    height: 30px;
}

.description-input {
    padding: 5px;
    max-width: 300px; /* Максимальная ширина для поля описания продукта */
    width: calc(100% - 10px);
    height: 30px;
}

/* Классы для скрытия/отображения элементов через JavaScript */
.hidden-inline-edit {
    display: none;
}

.visible-inline-edit {
    display: inline-block;
}

/* Стили для отображаемого текста, чтобы они соответствовали полям ввода по высоте и выравниванию */
.status-display,
.date-display,
.name-display,
.price-display,
.description-display {
    padding: 6px 5px; /* Подбираем padding, чтобы соответствовал padding инпутов (5px) + border (1px) */
    display: inline-block;
    vertical-align: middle;
}

/* Выравнивание содержимого ячеек по центру, чтобы инлайн-блоки центрировались */
.align-center-cell {
    text-align: center;
}


/*------------------------------------*\
  #MESSAGE STYLES (ERROR/SUCCESS)
\*------------------------------------*/

.success-message, .error-message {
    text-align: center;
    font-weight: bold;
    padding: 12px 20px;
    margin: 20px auto;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.success-message {
    background-color: #28a745; /* Green background */
    color: white;
    border: 1px solid #218838;
}

.error-message {
    background-color: #dc3545; /* Red background */
    color: white;
    border: 1px solid #c82333;
}


/*------------------------------------*\
  #FOOTER
\*------------------------------------*/

footer {
    text-align: center;
    margin-top: 50px; /* More top margin */
    padding: 20px;
    background-color: rgba(30, 30, 30, 0.95); /* Slightly darker and denser background */
    color: #c0c0c0;
    font-size: 0.9em;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}


/*------------------------------------*\
  #RESPONSIVE ADJUSTMENTS
\*------------------------------------*/

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        align-items: flex-start;
        padding: 0 15px;
    }

    .nav-brand {
        margin-bottom: 10px;
    }

    nav ul {
        flex-direction: column;
        width: 100%;
        margin-bottom: 10px;
    }

    nav ul li {
        margin-left: 0;
        margin-bottom: 8px;
        width: 100%;
    }

    nav ul li a {
        display: block;
        padding: 8px 0;
        text-align: center;
    }

    .nav-user {
        width: 100%;
        justify-content: center;
        margin-top: 10px;
        flex-direction: column;
    }

    .nav-user span {
        margin-right: 0;
        margin-bottom: 5px;
    }

    h1 {
        font-size: 2.2em;
    }
    h2 {
        font-size: 1.8em;
    }

    form {
        padding: 20px;
    }

    th, td {
        padding: 10px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8em;
        Color: #1a1a1a;
    }
    h2 {
        font-size: 1.5em;
    }
    form {
        padding: 15px;
    }
}

.registration-link {
    color: white; /* Делает текст белым */
    text-decoration: none; /* Если хотите убрать подчеркивание */
}

.registration-link:hover {
    text-decoration: underline; /* Добавить подчеркивание при наведении, если убрали его выше */
}