/* =========================================
   ОБЩИЕ СТИЛИ (Body, Container, Inputs)
   ========================================= */
body { 
    font-family: 'Segoe UI', Arial, sans-serif; 
    background: #f4f7f6; 
    margin: 0; 
    padding: 20px; 
    color: #333; 
}

.container { 
    max-width: 1000px; 
    margin: 0 auto; 
    background: white; 
    padding: 25px; 
    border-radius: 10px; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05); 
}

input, select { 
    padding: 12px; 
    margin: 5px 0; 
    width: 100%; 
    box-sizing: border-box; 
    border: 1px solid #ccc; 
    border-radius: 6px; 
}

.hidden { display: none; }

/* =========================================
   СТАНДАРТНЫЕ КНОПКИ (Верхнее меню, формы)
   ========================================= */
button { 
    font-family: inherit;
    padding: 10px 18px; 
    background: #007bff; 
    color: white; 
    border: none; 
    cursor: pointer; 
    border-radius: 8px; 
    font-weight: 600; 
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

button:hover { 
    background: #0056b3; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.15); 
    transform: translateY(-1px);
}

button:active {
    transform: translateY(2px);
    box-shadow: none;
}

.btn-success { background: #28a745; }
.btn-success:hover { background: #218838; }
.btn-danger { background: #dc3545; }
.btn-danger:hover { background: #c82333; }

/* =========================================
   ФОРМА СОЗДАНИЯ И СЕТКА КАРТОЧЕК
   ========================================= */
.creation-form { 
    background: #f8f9fa; 
    padding: 20px; 
    border-radius: 8px; 
    margin-bottom: 30px; 
    border: 1px solid #e9ecef; 
}

.clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* =========================================
   КАРТОЧКА КЛИЕНТА
   ========================================= */
.client-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: box-shadow 0.2s;
}

.client-card:hover { 
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); 
}

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

.card-title { 
    font-size: 1.2em; 
    font-weight: 600; 
    color: #222; 
    margin: 0; 
    display: flex; 
    align-items: center;
}

.card-id { 
    font-size: 0.8em; 
    color: #888; 
    background: #f0f0f0; 
    padding: 3px 8px; 
    border-radius: 12px; 
}

.card-row { 
    display: flex; 
    justify-content: space-between; 
    font-size: 0.95em; 
}

.card-label { color: #666; }
.card-value { font-weight: 500; text-align: right;}

.status-dot { 
    display: inline-block; 
    width: 10px; 
    height: 10px; 
    border-radius: 50%; 
    margin-left: 8px; 
}
.status-online { background-color: #28a745; box-shadow: 0 0 5px #28a745; }
.status-offline { background-color: #ccc; }

/* =========================================
   КНОПКИ НА КАРТОЧКЕ (Нижняя панель действий)
   ========================================= */
.card-actions { 
    display: flex; 
    justify-content: space-around; 
    border-top: 1px solid #eee; 
    padding-top: 10px; 
    margin-top: auto; 
}

/* Прозрачные кнопки-иконки без фона */
.icon-btn {
    background: transparent !important;
    color: inherit !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 1.6em;
    cursor: pointer;
    padding: 8px;
    flex: 1;
    border-radius: 8px;
    opacity: 0.7;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.icon-btn:hover {
    opacity: 1;
    transform: translateY(-3px) scale(1.15);
    background: rgba(128, 128, 128, 0.05) !important;
}

.icon-btn:active {
    transform: scale(0.9);
}

/* Маленькая круглая кнопка обновления (рядом с именем) */
.sync-btn {
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 50%;
    padding: 4px;
    margin-left: 8px;
    cursor: pointer;
    font-size: 1.1em;
    border: none;
    transition: transform 0.4s ease;
    opacity: 0.7;
    display: inline-block;
}

.sync-btn:hover {
    opacity: 1;
    transform: rotate(180deg);
    color: #000 !important;
}

.sync-btn.loading {
    animation: spin 1s linear infinite;
    pointer-events: none;
    filter: grayscale(100%);
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* =========================================
   МОДАЛЬНОЕ ОКНО (Тестирование)
   ========================================= */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    width: 350px;
    max-width: 90%;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: relative;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #888;
}

.close-btn:hover {
    color: #333;
}
.linked-badge {
    color: #0056b3;
    background: #e1ebf5;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.9em;
    cursor: help;
    display: inline-block;
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    box-sizing: border-box;
}