@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css');

.page-content-wrapper {
    display: flex;
    justify-content: flex-start;
    padding: 20px;
    box-sizing: border-box;
    width: 100%;
}

.add-server-container {
    max-width: 800px;
    width: 100%;
    font-family: sans-serif;
    color: #333;
}

h1 {
    color: #333;
    margin-bottom: 20px;
    text-align: left;
    font-size: 2em;
}

.messages-container {
    margin-bottom: 20px;
}

.message-box {
    padding: 10px 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    border: 1px solid transparent;
    font-size: 0.95em;
}

.message-success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.message-error, .message-danger {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.message-warning {
    color: #856404;
    background-color: #fff3cd;
    border-color: #ffeeba;
}
.message-info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.info-box {
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
}

.info-box-header {
    background-color: #f1f1f1;
    padding: 12px 20px;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    font-size: 1.1em;
    border-top-left-radius: 7px;
    border-top-right-radius: 7px;
}

.info-box-body {
    padding: 20px;
}

.form-layout-columns {
    display: flex;
    gap: 30px;
    margin-bottom: 20px; /* Отступ после колонок */
    flex-wrap: wrap;
}

.form-column {
    flex: 1;
    min-width: 280px; /* Минимальная ширина колонки для адаптивности */
}

.form-field-group {
    margin-bottom: 20px;
}

.form-field-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.form-field-group input[type="text"],
.form-field-group input[type="url"],
.form-field-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-field-group input[type="text"]:focus,
.form-field-group input[type="url"]:focus,
.form-field-group textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.25);
    outline: none;
}

.form-field-group input.error,
.form-field-group textarea.error {
    border-color: #dc3545 !important;
}

.form-field-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-text-muted {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-top: 5px;
}

.field-with-icon {
    display: flex;
    align-items: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 0 10px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.field-with-icon i {
    margin-right: 10px;
    color: #888;
    font-size: 1.2em;
}

.field-with-icon input[type="url"] {
    flex-grow: 1;
    border: none;
    padding: 10px 0;
    outline: none;
    transition: none;
}

.field-with-icon:focus-within {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.25);
}

.links-fields-container,
.tags-fields-container,
.description-field-container {
    transition: max-height 0.5s ease-in-out, opacity 0.5s ease-in-out;
}

/* Стиль для контейнера описания, когда он вне колонок */
.description-field-container {
    margin-bottom: 20px; /* Добавляем отступ после блока описания */
}

.errorlist {
    color: #dc3545;
    list-style: none;
    padding: 0;
    margin-top: 5px;
    font-size: 0.9em;
    max-height: 0; /* Изначально скрываем */
    opacity: 0; /* Изначально скрываем */
    overflow: hidden;
    transition: max-height 0.5s ease-in-out, opacity 0.5s ease-in-out; /* Анимация */
}

 .errorlist li {
     margin-bottom: 3px;
 }

 /* Стиль для видимого списка ошибок */
 .errorlist.visible {
     max-height: 100px; /* Достаточно для показа нескольких ошибок */
     opacity: 1;
 }


.tags-list-selectable {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 5px;
    padding: 0 5px; /* Горизонтальный отступ для тени */
}

.tag-item-selectable {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: bold;
    text-transform: uppercase;
    box-shadow: 3px 4px 3px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
    user-select: none;
    border: 1px solid transparent;
    opacity: 0.9;
    text-shadow: none;
    position: relative;
}

.tag-item-selectable:hover {
     opacity: 1;
     transform: translateY(-1px);
}

.tag-item-selectable.selected {
    opacity: 1;
    box-shadow: 7px 7px 7px rgba(0, 0, 0, 0.7), /* Увеличенная черная тень */
    0 0 0 3px rgba(6, 82, 0, 0.9); /* Зеленая обводка */
}

.tag-item-selectable input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 100%;
    width: 100%;
    top: 0;
    left: 0;
    margin: 0;
    z-index: 1;
}

.tag-item-selectable label {
     display: block;
     width: 100%;
     height: 100%;
     cursor: pointer;
     margin: 0;
     font-weight: normal;
     color: inherit;
     position: relative;
     z-index: 0;
     padding: 0;
 }

button[type="submit"],
.button-secondary {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease, opacity 0.3s ease;
    font-size: 1em;
    font-weight: bold;
    box-sizing: border-box;
}

.button-small {
     padding: 8px 15px;
     font-size: 0.9em;
     margin-bottom: 15px; /* Отступ после кнопки переключения */
     width: auto; /* Автоматическая ширина для кнопок переключения */
 }

 /* Кнопка submit должна быть на всю ширину */
 button[type="submit"] {
     width: 100%;
 }


button[type="submit"]:disabled,
.button-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.button-primary {
    background-color: #28a745;
    color: white;
    margin-top: 20px;
}

.button-primary:hover:not(:disabled) {
    background-color: #218838;
}

.button-secondary {
    background-color: #6c757d;
    color: white;
}

.button-secondary:hover:not(:disabled) {
    background-color: #5a6268;
}

.back-link-container {
    margin-top: 15px;
}

.back-link-container .button-secondary {
     width: 100%;
}

@media (max-width: 768px) {
    .page-content-wrapper {
        padding: 15px;
    }

    .add-server-container {
        max-width: 100%;
    }

    h1 {
        font-size: 1.8em;
    }

    .info-box-header {
        padding: 10px 15px;
        font-size: 1em;
    }

    .info-box-body {
        padding: 15px;
    }

    .form-layout-columns {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 15px; /* Уменьшен отступ на мобильных */
    }

    .form-column {
         min-width: 100%; /* Колонки занимают всю ширину на мобильных */
    }

    .button-small {
         margin-bottom: 10px; /* Уменьшен отступ после кнопки на мобильных */
    }

    .description-field-container,
    .links-fields-container,
    .tags-fields-container {
         margin-bottom: 15px; /* Уменьшен отступ на мобильных */
    }

    button[type="submit"] {
        padding: 12px; /* Немного увеличен padding для удобства нажатия */
    }
}