/* =========================================
   Загальні стилі
   ========================================= */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    text-align: center;
}

/* =========================================
   Шапка (header)
   ========================================= */
header {
    background: #1a252f;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    position: fixed;
    width: 100%;
    height: 60px;
    top: 0;
    left: 0;
    z-index: 1001;
    box-sizing: border-box;
}
.header-left, .header-right {
    display: flex;
    align-items: center;
}
.header-title {
    margin-left: 10px;
    font-weight: bold;
    font-size: 18px;
}
.header-button {
    background: none;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 18px;
    margin-left: 10px;
}

/* =========================================
   Бокове меню (nav#sidebar)
   ========================================= */
#sidebar {
    background: #2c3e50;
    width: 80px;
    height: calc(100vh - 60px);
    position: fixed;
    left: 0;
    top: 60px;
    transition: width 0.3s ease-in-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 10px;
    z-index: 1000;
    overflow-y: auto;
}
#sidebar.open,
#sidebar:hover {
    width: 200px;
}
#sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}
#sidebar ul li {
    visibility: visible;
    position: relative;
    width: 100%;
    height: 50px;
    padding: 0 15px;
    color: white;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.3s;
    box-sizing: border-box;
}
#sidebar ul li[style="display: none;"] {
    display: none;
}
#sidebar ul li a {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
}
#sidebar ul li:hover {
    background: #1a252f;
}
#sidebar ul li a img {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}
#sidebar ul li a span {
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    margin-left: 10px;
    flex-grow: 1;
    color: white;
}
#sidebar.open ul li a span,
#sidebar:hover ul li a span {
    opacity: 1;
    visibility: visible;
}
/* Зсув контенту */
#sidebar.open ~ #content,
#sidebar:hover ~ #content {
    margin-left: 200px;
}
#sidebar:not(.open):not(:hover) ~ #content {
    margin-left: 80px;
}

/* =========================================
   Основний контейнер контенту
   ========================================= */
#content {
    margin-top: 60px;
    padding: 20px;
    box-sizing: border-box;
    max-width: calc(100% - 80px);
    transition: margin-left 0.3s ease-in-out;
}

/* =========================================
   Кнопки загальні
   ========================================= */
button {
    background: #28a745;
    color: black;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: color 0.3s, background 0.3s;
}
button:hover {
    background: #218838;
    color: white;
}
.disabled-btn {
    opacity: 0.7;
    cursor: not-allowed;
}
.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =========================================
   Форми
   ========================================= */
form {
    background: white;
    padding: 20px;
    max-width: 400px;
    margin: 20px auto;
    border-radius: 5px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    text-align: left;
}
label {
    display: block;
    margin-top: 10px;
    font-weight: bold;
}
input, textarea {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

/* =========================================
   Список закритих звернень/заявок
   ========================================= */
ul.other-list {
    list-style-type: none;
    padding: 0;
}
ul.other-list li {
    background: white;
    padding: 10px;
    margin: 5px 0;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

/* =========================================
   Тікети: новий flex-рядок
   ========================================= */
.ticket-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.ticket-card {
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 5px;
    background-color: #fff;
    display: flex;
    flex-direction: row; /* Рядком, не колонкою! */
    justify-content: space-between;
    align-items: flex-start;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: left;
    gap: 20px;
}
.ticket-card .ticket-info {
    flex: 1 1 60%;
    min-width: 0;
}
.ticket-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    min-width: 180px;
    flex: 0 0 180px;
}
.ticket-card .ticket-status {
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 3px;
    min-width: 90px;
    text-align: center;
    margin-bottom: 0;
}
.ticket-card .status-new {
    background-color: #ffecb3;
    color: #a67c00;
}
.ticket-card .status-in-progress {
    background-color: #c5e1a5;
    color: #33691e;
}
.ticket-card .status-closed {
    background-color: #ef9a9a;
    color: #b71c1c;
}

/* Кнопки в колонку справа */
.ticket-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    align-items: flex-end;
    margin: 0;
}
.ticket-buttons button {
    font-size: 14px;
    padding: 4px 14px;
    border-radius: 5px;
    border: none;
    background: #43a047;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
    min-width: 90px;
    margin-top: 0;
}
.ticket-buttons button:first-child {
    background: #ffcdd2;
    color: #b71c1c;
}
.ticket-buttons button:hover {
    filter: brightness(0.95);
}
.show-comments-btn {
    background: #fff;
    color: #43a047;
    border: 1px solid #43a047;
    border-radius: 4px;
    padding: 3px 13px;
    font-size: 13px;
    margin: 0;
    width: 100%;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: inline-block;
    vertical-align: middle;
}
.show-comments-btn:hover {
    background: #43a047;
    color: #fff;
}
.admin-comments-section {
    margin-top: 10px;
    background: #f5f5f5;
    border-radius: 5px;
    padding: 7px 12px;
    font-size: 13px;
    text-align: left;
}
.admin-comments-section h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: bold;
}
.admin-comment {
    margin-bottom: 5px;
    padding-bottom: 4px;
    border-bottom: 1px dashed #cfd8dc;
}

/* =========================================
   Модальне вікно для адмін-коментарів
   ========================================= */
.modal-overlay {
    position: fixed;
    z-index: 2001;
    left: 0; top: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.30);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
}
.modal-window {
    background: #fff;
    border-radius: 8px;
    min-width: 360px;
    max-width: 420px;
    width: 100%;
    padding: 22px 22px 12px 22px;
    box-shadow: 0 4px 24px rgba(30,30,30,0.25);
    position: relative;
    text-align: left;
}
.close-modal {
    position: absolute;
    top: 10px; right: 18px;
    font-size: 26px;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
}
.close-modal:hover { color: #d32f2f; }
.modal-window h4 { margin-top: 0; }
.modal-window form { margin: 12px 0 0 0; box-shadow: none; padding: 0; background: none; }
.modal-window input[type="text"] { margin-bottom: 8px; }
.admin-comment { margin-bottom: 7px; border-bottom: 1px dashed #cfd8dc; padding-bottom: 4px; }

/* =========================================
   Сповіщення, нотифікації
   ========================================= */
.notifications {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.header-button[aria-label="notifications"] .badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: red;
    color: white;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 50%;
    display: none;
}
.notification {
    background: #4caf50;
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    animation: fadeOut 5s forwards;
}
@keyframes fadeOut {
    0% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translateY(20px);}
}
.notifications-window {
    display: none;
    position: absolute;
    top: 60px;
    right: 20px;
    width: 300px;
    max-height: 400px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.notifications-window.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}
.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
}
.notifications-header button {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
}
.notifications-header button:hover {
    background: #0056b3;
}
.notifications-list {
    padding: 0;
    margin: 0;
    list-style: none;
}
.notifications-item {
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.notifications-item:last-child {
    border-bottom: none;
}
.notifications-item .close-btn {
    background: none;
    border: none;
    color: #e74c3c;
    font-size: 16px;
    cursor: pointer;
}
.notifications-item .close-btn:hover {
    color: #c0392b;
}

.hidden {
    display: none;
}
